Пример #1
0
 /**
  * retrieves a list of files to be included at the very end of the upgrade
  * include each file
  *
  * @return array | false
  */
 function executePostUpgradeTasks()
 {
     $oldAudit = $GLOBALS['_MAX']['CONF']['audit']['enabled'];
     $GLOBALS['_MAX']['CONF']['audit']['enabled'] = 0;
     if (file_exists($this->postTaskFile)) {
         $aContent = array_unique(explode(';', trim(file_get_contents($this->postTaskFile))));
         foreach ($aContent as $k => &$v) {
             if (trim($v)) {
                 $file = $this->upgradePath . "tasks/openads_upgrade_task_" . trim($v) . ".php";
                 if (file_exists($file)) {
                     $this->oLogger->logOnly('attempting to include file ' . $file);
                     include $file;
                     $this->oLogger->logOnly('executed file ' . $file);
                 } else {
                     $this->oLogger->logOnly('file not found ' . $file);
                 }
                 $aResult[$k]['task'] = trim($v);
                 $aResult[$k]['file'] = $file;
                 $aResult[$k]['result'] = $upgradeTaskResult;
                 $aResult[$k]['message'] = $upgradeTaskMessage;
                 $aResult[$k]['error'] = $upgradeTaskError;
             }
         }
         $this->_pickupPostUpgradeTasksFile();
         return $aResult;
     }
     $GLOBALS['_MAX']['CONF']['audit']['enabled'] = $oldAudit;
     return true;
 }
Пример #2
0
 /**
  * Run single post upgrade task
  *
  * @param string $task task name
  * @return array contains 'task' - task name, 'file' - executed file, 'result' - task result 'errors' - array of errors if any
  */
 public function runPostUpgradeTask($task)
 {
     require_once MAX_PATH . '/lib/OX/Upgrade/PostUpgradeTask/MessagesCollector.php';
     $oldAudit = $GLOBALS['_MAX']['CONF']['audit']['enabled'];
     $GLOBALS['_MAX']['CONF']['audit']['enabled'] = 0;
     $file = $this->upgradePath . "tasks/openads_upgrade_task_" . $task . ".php";
     $upgradeTaskResult = null;
     $oMessages = new OX_Upgrade_PostUpgradeTask_MessagesCollector($this->oLogger);
     if (file_exists($file)) {
         $this->oLogger->logOnly('attempting to include file ' . $file);
         include $file;
         $this->oLogger->logOnly('executed file ' . $file);
     } else {
         $oMessages->logError('file not found ' . $file);
     }
     $aResult['task'] = $task;
     $aResult['file'] = $file;
     $aResult['result'] = $upgradeTaskResult;
     $aResult['errors'] = $oMessages->getErrors();
     $GLOBALS['_MAX']['CONF']['audit']['enabled'] = $oldAudit;
     return $aResult;
 }
 /**
  * Log info message
  *
  * @param string $message
  */
 public function logInfo($message)
 {
     $this->aInfos[] = $message;
     $this->oUpgradeLogger->logOnly($message);
 }