예제 #1
0
function shutdownAction($actionId, $actionType, $filePath, $dbFilePath, $backupObj)
{
    if ($backupObj->getReloading()) {
        return;
    }
    $action = SGBackup::getAction($actionId);
    if ($action && ($action['status'] == SG_ACTION_STATUS_IN_PROGRESS_DB || $action['status'] == SG_ACTION_STATUS_IN_PROGRESS_FILES)) {
        SGBackupLog::writeExceptionObject(new SGExceptionServerError('Execution time abort'));
        SGBackup::changeActionStatus($actionId, SG_ACTION_STATUS_ERROR);
        if ($actionType == SG_ACTION_TYPE_BACKUP) {
            @unlink($filePath);
            @unlink($dbFilePath);
        }
    }
}
예제 #2
0
파일: SGBackup.php 프로젝트: Finzy/stageDB
 public function restore($backupName)
 {
     $this->prepareForRestore($backupName);
     try {
         $this->backupFiles->restore($this->filesBackupPath);
         $this->didFinishFilesRestore();
     } catch (SGException $exception) {
         if (!$exception instanceof SGExceptionSkip) {
             SGBackupLog::writeExceptionObject($exception);
             if (SGBoot::isFeatureAvailable('NOTIFICATIONS')) {
                 SGBackupMailNotification::sendRestoreNotification(false);
             }
             self::changeActionStatus($this->actionId, SG_ACTION_STATUS_ERROR);
         } else {
             self::changeActionStatus($this->actionId, SG_ACTION_STATUS_CANCELLED);
         }
     }
 }