public function processing()
 {
     $oController = new BxDolUpgradeController();
     if ($oController->setMaintenanceMode(true)) {
         // if upgrade was successful
         if (($sFolder = $oController->getAvailableUpgrade()) && $oController->runUpgrade($sFolder)) {
             // write upgrade log
             $oController->writeLog();
             // send email notification
             bx_import('BxDolLanguages');
             sendMailTemplateSystem('t_UpgradeSuccess', array('new_version' => bx_get_ver(true), 'conclusion' => $oController->getConclusion() ? _t('_sys_upgrade_conclusion', $oController->getConclusion()) : ''));
             // if next upgrade is available (in case of bulk upgrade) then schedule to run it upon next cron run
             $sUpgradeDir = pathinfo(__FILE__, PATHINFO_DIRNAME);
             if ($oController->getAvailableUpgrade()) {
                 $oUpgrader = bx_instance('BxDolUpgrader');
                 $oUpgrader->setTransientUpgradeCronJob($sUpgradeDir);
             } elseif (0 === strpos($sUpgradeDir, BX_DIRECTORY_PATH_TMP)) {
                 @bx_rrmdir($sUpgradeDir);
             }
         }
         $oController->setMaintenanceMode(false);
     }
     // if something went grong during upgrade
     if ($sErrorMsg = $oController->getErrorMsg()) {
         // write upgrade log
         $oController->writeLog();
         // send email notification
         sendMailTemplateSystem('t_UpgradeFailed', array('error_msg' => $sErrorMsg));
         // disable auto-upgrade if it is failed
         setParam('sys_autoupdate_system', '');
     } elseif ('on' == getParam('sys_autoupdate_modules')) {
         // run modules update after successful system upgrade
         bx_import('BxDolCronQuery');
         BxDolCronQuery::getInstance()->addTransientJobClass('sys_perform_upgrade_modules', 'BxDolCronUpgradeModulesCheck', 'inc/classes/BxDolCronUpgradeModulesCheck.php');
     }
 }
 private function addTransientJob($sAction, $aParams)
 {
     bx_import('BxDolCronQuery');
     if (BxDolCronQuery::getInstance()->addTransientJobService('sys_' . $sAction, array('system', $sAction, $aParams, 'DolStudioInstallerUtils'))) {
         return true;
     }
     return false;
 }
Exemple #3
0
 public function setTransientUpgradeCronJob($sUnpackedPath)
 {
     $sUnpackedPath = rtrim($sUnpackedPath, '/') . '/';
     bx_import('BxDolCronQuery');
     return BxDolCronQuery::getInstance()->addTransientJobClass('sys_perform_upgrade', 'BxDolUpgradeCron', bx_ltrim_str($sUnpackedPath, BX_DIRECTORY_PATH_ROOT) . 'BxDolUpgradeCron.php');
 }
Exemple #4
0
function runJob($aJob)
{
    if (!empty($aJob['file']) && !empty($aJob['class']) && file_exists(BX_DIRECTORY_PATH_ROOT . $aJob['file'])) {
        if (!class_exists($aJob['class'])) {
            require_once BX_DIRECTORY_PATH_ROOT . $aJob['file'];
        }
        $oHandler = new $aJob['class']();
        $oHandler->processing();
    } else {
        if (!empty($aJob['service_call']) && BxDolService::isSerializedService($aJob['service_call'])) {
            BxDolService::callSerialized($aJob['service_call']);
        }
    }
}
bx_import('BxDolCronQuery');
$oDb = BxDolCronQuery::getInstance();
// run one time transient jobs
$aJobsTransient = $oDb->getTransientJobs();
if (!empty($aJobsTransient)) {
    $oDb->deleteTransientJobs();
    foreach ($aJobsTransient as $aRow) {
        runJob($aRow);
    }
    if (isset($aJobsTransient['sys_perform_upgrade'])) {
        exit;
    }
}
if (bx_check_maintenance_mode()) {
    // don't run regular cron jobs when site is in maintenance mode
    exit;
}
 protected function downloadFile($aItem, $bUseFtp = BX_FORCE_USE_FTP_FILE_TRANSFER)
 {
     if (defined('BX_DOL_CRON_EXECUTE') || self::isRealOwner()) {
         return $this->performDownload($aItem, $bUseFtp);
     }
     bx_import('BxDolCronQuery');
     if (BxDolCronQuery::getInstance()->addTransientJobService('sys_perform_download', array('system', 'download_file', array($aItem, $bUseFtp), 'DolStudioInstallerUtils'))) {
         return _t('_adm_str_msg_download_scheduled');
     }
     return false;
 }