Prestashop Installer

This commit is contained in:
usmannasir
2018-08-05 01:46:31 +05:00
parent 162321a477
commit d8da9d1321
9 changed files with 855 additions and 3 deletions

View File

@@ -566,6 +566,7 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) {
$scope.wordPressInstallURL = $("#domainNamePage").text() + "/wordpressInstall";
$scope.joomlaInstallURL = $("#domainNamePage").text() + "/joomlaInstall";
$scope.setupGit = $("#domainNamePage").text() + "/setupGit";
$scope.installPrestaURL = $("#domainNamePage").text() + "/installPrestaShop";
$scope.domainAliasURL = "/websites/"+$("#domainNamePage").text()+"/domainAlias";
$scope.previewUrl = "/preview/"+$("#domainNamePage").text()+"/";
@@ -1443,6 +1444,7 @@ app.controller('websitePages', function($scope, $http, $timeout, $window) {
};
//////// SSL Part
$scope.sslSaved = true;
@@ -4720,4 +4722,197 @@ app.controller('setupGit', function($scope, $http, $timeout, $window) {
};
});
app.controller('installPrestaShopCTRL', function($scope, $http, $timeout) {
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = true;
$scope.databasePrefix = 'ps_';
var statusFile;
var domain = $("#domainNamePage").text();
var path;
$scope.goBack = function () {
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = true;
$("#installProgress").css("width", "0%");
};
function getInstallStatus(){
url = "/websites/installWordpressStatus";
var data = {
statusFile: statusFile,
domainName: domain
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if(response.data.abort === 1){
if(response.data.installStatus === 1){
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = true;
$scope.installationSuccessfull = false;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = false;
if (typeof path !== 'undefined'){
$scope.installationURL = "http://"+domain+"/"+path;
}
else{
$scope.installationURL = domain;
}
$("#installProgress").css("width", "100%");
$scope.installPercentage = "100";
$scope.currentStatus = response.data.currentStatus;
$timeout.cancel();
}
else{
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = false;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = false;
$scope.errorMessage = response.data.error_message;
$("#installProgress").css("width", "0%");
$scope.installPercentage = "0";
}
}
else{
$("#installProgress").css("width", response.data.installationProgress + "%");
$scope.installPercentage = response.data.installationProgress;
$scope.currentStatus = response.data.currentStatus;
$timeout(getInstallStatus,1000);
}
}
function cantLoadInitialDatas(response) {
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
}
}
$scope.installPrestShop = function(){
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = false;
$scope.goBackDisable = true;
$scope.currentStatus = "Starting installation..";
path = $scope.installPath;
url = "/websites/prestaShopInstall";
var home = "1";
if (typeof path !== 'undefined'){
home = "0";
}
var data = {
domain: domain,
home:home,
path:path,
shopName: $scope.shopName,
firstName: $scope.firstName,
lastName: $scope.lastName,
databasePrefix: $scope.databasePrefix,
email: $scope.email,
password: $scope.password
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.installStatus === 1)
{
statusFile = response.data.tempStatusPath;
getInstallStatus();
}
else{
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = false;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.wpInstallLoading = true;
$scope.goBackDisable = false;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {}
};
});