69 lines
3.2 KiB
PHP
Executable File
69 lines
3.2 KiB
PHP
Executable File
<?php
|
|
include_once 'path.php';
|
|
if(!isset($_SESSION['validUser']) || $_SESSION['validUser'] !== true)
|
|
exit(header("Location:../index.php"));
|
|
|
|
$pidFile = PID_FILE;
|
|
if($_GET['type'] == 'backup') {
|
|
$startPidfilePath = Scheduler::$backup_dir."+ManualTask/$startPid";
|
|
$pidfilePath = Scheduler::$backup_dir."+ManualTask/$pidFile";
|
|
$userCancelPath = Scheduler::$backup_dir."+ManualTask/".CANCEL_PATH;
|
|
$backupSetFilePath = Scheduler::$backup_dir."+ManualTask/".BACKUPSETFILEDISPLAY;
|
|
|
|
if(file_exists($startPidfilePath) && file_exists($pidfilePath) && !file_exists($userCancelPath)){
|
|
exit('running');
|
|
} else if(file_exists($startPidfilePath) && !file_exists($pidfilePath) && file_exists($userCancelPath)){
|
|
exit('cancelling');
|
|
} else {
|
|
$_SESSION['currentBackupJob'] = '';
|
|
if(file_exists($backupSetFilePath) && !file_exists($startPidfilePath)) unlink($backupSetFilePath);
|
|
exit('completed');
|
|
}
|
|
} else if($_GET['type'] == 'localBackup') {
|
|
$startPidfilePath = Scheduler::$localbackup_dir."+ManualTask/$startPid";
|
|
$pidfilePath = Scheduler::$localbackup_dir."+ManualTask/$pidFile";
|
|
$userCancelPath = Scheduler::$localbackup_dir."+ManualTask/".CANCEL_PATH;
|
|
$backupSetFilePath = Scheduler::$localbackup_dir."+ManualTask/".BACKUPSETFILEDISPLAY;
|
|
|
|
if(file_exists($startPidfilePath) && file_exists($pidfilePath) && !file_exists($userCancelPath)){
|
|
exit('running');
|
|
} else if(file_exists($startPidfilePath) && !file_exists($pidfilePath) && file_exists($userCancelPath)){
|
|
exit('cancelling');
|
|
} else {
|
|
$_SESSION['currentLocalBackupJob'] = '';
|
|
if(file_exists($backupSetFilePath) && !file_exists($startPidfilePath)) unlink($backupSetFilePath);
|
|
exit('completed');
|
|
}
|
|
} else if($_GET['type'] == 'localRestore') {
|
|
$startPidfilePath = Scheduler::$localrestore_dir . "+ManualTask/$startPid";
|
|
$pidfilePath = Scheduler::$localrestore_dir . "+ManualTask/$pidFile";
|
|
$userCancelPath = Scheduler::$localrestore_dir . "+ManualTask/" . CANCEL_PATH;
|
|
$restoreSetFilePath = Scheduler::$localrestore_dir . "+ManualTask/" . RESTORESETFILEDISPLAY;
|
|
|
|
if(file_exists($startPidfilePath) && file_exists($pidfilePath) && !file_exists($userCancelPath)) {
|
|
exit('running');
|
|
} else if(file_exists($startPidfilePath) && !file_exists($pidfilePath) && file_exists($userCancelPath)) {
|
|
exit('cancelling');
|
|
} else {
|
|
$_SESSION['currentRestoreJob'] = '';
|
|
if(file_exists($restoreSetFilePath) && !file_exists($startPidfilePath)) unlink($restoreSetFilePath);
|
|
exit('completed');
|
|
}
|
|
} else {
|
|
$startPidfilePath = Scheduler::$restore_dir."+ManualTask/$startPid";
|
|
$pidfilePath = Scheduler::$restore_dir."+ManualTask/$pidFile";
|
|
$userCancelPath = Scheduler::$restore_dir."+ManualTask/".CANCEL_PATH;
|
|
$restoreSetFilePath = Scheduler::$restore_dir."+ManualTask/".RESTORESETFILEDISPLAY;
|
|
|
|
if(file_exists($startPidfilePath) && file_exists($pidfilePath) && !file_exists($userCancelPath)){
|
|
exit('running');
|
|
} else if(file_exists($startPidfilePath) && !file_exists($pidfilePath) && file_exists($userCancelPath)){
|
|
exit('cancelling');
|
|
} else {
|
|
$_SESSION['currentRestoreJob'] = '';
|
|
if(file_exists($restoreSetFilePath) && !file_exists($startPidfilePath)) unlink($restoreSetFilePath);
|
|
exit('completed');
|
|
}
|
|
}
|
|
?>
|