function action_runscript() { header('Content-type: text/html;charset=utf-8'); set_time_limit(0); if (!($file = $_POST['file']) || !file_exists(CORE_DIR . '/updatescripts/' . $file)) { echo 'missing file' . $_POST['file']; return; } if (!file_exists(HOME_DIR . '/logs/upgrade_' . substr($_POST['file'], 0, -4) . '_' . $_POST['timeline'] . '.log.php')) { error_log('#<?php exit()?>' . " \n \n", 3, HOME_DIR . '/logs/upgrade_' . substr($_POST['file'], 0, -4) . '_' . $_POST['timeline'] . '.log.php'); } switch (ext_name($file)) { case '.php': include CORE_DIR . '/updatescripts/' . $file; if (class_exists('UpgradeScript')) { $oUpgrade = new UpgradeScript(); $oUpgrade->step = $_POST['step'] ? $_POST['step'] : '1'; $oUpgrade->runFunc = $_POST['runFunc'] ? $_POST['runFunc'] : 'first'; $oUpgrade->status = $_POST['runStatus'] ? $_POST['runStatus'] : 'all-finish'; $oUpgrade->version = substr($file, 0, -4); // $oUpgrade->runFunc = $runFunc; $oUpgrade->__Upgrade(); } break; case '.sql': $this->run_update_sql($file); break; } $this->setDbver(substr($file, 0, -4)); }
public function __construct($upgrader) { $this->type = self::UPGRADE_CUSTOM | self::UPGRADE_DB; parent::__construct($upgrader); }
/** * Run individual upgrade script * @param UpgradeScript $script */ protected function runScript(UpgradeScript $script) { set_error_handler(array($this, 'scriptErrorHandler'), E_ALL & ~E_STRICT & ~E_DEPRECATED); ob_start(); try { $script->run($this); } catch (Exception $e) { $this->error("Exception: " . $e->getMessage()); } $out = ob_get_clean(); if ($out) { $this->log("OUTPUT: {$out}"); } restore_error_handler(); }
public function __construct($upgrader) { parent::__construct($upgrader); $this->type = self::UPGRADE_CORE | self::UPGRADE_CUSTOM; }