Ejemplo n.º 1
0
}
$backupDirectory = BACKUP_DIR;
if (!file_exists($backupDirectory)) {
    if (!mkdir($backupDirectory)) {
        $status->add(sprintf('Backup directory "%s" cannot be created.', $backupDirectory));
        exit;
    }
    chmod($backupDirectory, 0770);
}
try {
    $status->setUpdateInProgress();
} catch (\RuntimeException $e) {
    $status->add($e->getMessage());
    exit;
}
$jobQueue = new \Magento\Update\Queue();
try {
    while (!empty($jobQueue->peek()) && strpos($jobQueue->peek()[\Magento\Update\Queue::KEY_JOB_NAME], 'setup:') === false) {
        $job = $jobQueue->popQueuedJob();
        $status->add(sprintf('Job "%s" has been started', $job));
        try {
            $job->execute();
            $status->add(sprintf('Job "%s" has successfully completed', $job));
        } catch (\Exception $e) {
            $status->setUpdateError();
            $status->add(sprintf('An error occurred while executing job "%s": %s', $job, $e->getMessage()));
            $status->setUpdateInProgress(false);
        }
    }
} catch (\Exception $e) {
    $status->setUpdateError();
Ejemplo n.º 2
0
 */
require_once __DIR__ . '/app/bootstrap.php';
header('X-Frame-Options: SAMEORIGIN');
header('X-Content-Type-Options: nosniff');
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 8') === false) {
    $xssHeaderValue = '1; mode=block';
} else {
    $xssHeaderValue = '0';
}
header('X-XSS-Protection: ' . $xssHeaderValue);
$status = new \Magento\Update\Status();
$isUpdateInProgress = $status->isUpdateInProgress();
$statusMessage = '';
$statusMessage .= $status->get();
$statusMessage = str_replace("\n", "<br />", $statusMessage);
$queue = new \Magento\Update\Queue();
$pending = !$status->isUpdateInProgress() && !$queue->isEmpty() && !$status->isUpdateError();
if (isset($_SERVER['PATH_INFO']) && !empty($_SERVER['PATH_INFO'])) {
    if ($_SERVER['PATH_INFO'] === '/rollback' && file_exists(MAGENTO_BP . '/var/.update_error.flag')) {
        try {
            $queue->clear();
            $backupInfo = new \Magento\Update\Backup\BackupInfo();
            $backupPaths = $backupInfo->getBackupFilePaths();
            if (isset($backupPaths['error'])) {
                $status->add('WARNING: There is a problem with backup files! Performing rollback from these' . ' files may cause the Magento application to be unstable', \Psr\Log\LogLevel::WARNING);
                foreach ($backupPaths['error'] as $error) {
                    $status->add($error, \Psr\Log\LogLevel::WARNING);
                }
                unset($backupPaths['error']);
            }
            foreach (array_values($backupPaths) as $backupPath) {
Ejemplo n.º 3
0
$status = new \Magento\Update\Status();
if ($status->isUpdateInProgress()) {
    exit('Cron is already in progress...');
}
$backupDirectory = UPDATER_BP . '/var/backup';
if (!file_exists($backupDirectory) && !mkdir($backupDirectory)) {
    $status->add(sprintf('Backup directory "%s" cannot be created.', $backupDirectory));
    exit;
}
try {
    $status->setUpdateInProgress();
} catch (\RuntimeException $e) {
    $status->add($e->getMessage());
    exit;
}
$jobQueue = new \Magento\Update\Queue();
try {
    foreach ($jobQueue->popQueuedJobs() as $job) {
        $status->add(sprintf('Job "%s" has been started', $job));
        try {
            $job->execute();
            $status->add(sprintf('Job "%s" has been successfully completed', $job));
        } catch (\Exception $e) {
            $status->add(sprintf('An error occurred while executing job "%s": %s', $job, $e->getMessage()));
        }
    }
} catch (\Exception $e) {
    $status->add($e->getMessage());
} finally {
    $status->setUpdateInProgress(false);
}