Example #1
0
 protected function doUpgrade($name)
 {
     $upgradeFile = Module::getUpgradeDir() . '/' . $name . '.php';
     if (!is_file($upgradeFile)) {
         return false;
     }
     /** @noinspection PhpIncludeInspection */
     require_once $upgradeFile;
     $class = 'Sprint\\Migration\\' . $name;
     if (!class_exists($class)) {
         return false;
     }
     /** @var Upgrade $obj */
     $obj = new $class();
     $obj->setDebug($this->debug);
     $obj->doUpgrade();
     if ($this->debug) {
         Out::out('Upgrade to version: %s', $name);
     }
     Module::setDbOption('upgrade_version', $name);
     return true;
 }
Example #2
0
 protected function outParamsError()
 {
     Out::out('Required params not found, see help');
 }
 public function executeConsoleCommand($args)
 {
     $this->script = array_shift($args);
     if (empty($args) || count($args) <= 0) {
         $this->commandHelp();
         return false;
     }
     $command = array_shift($args);
     $command = str_replace(array('_', '-', ' '), '*', $command);
     $command = explode('*', $command);
     $tmp = array();
     foreach ($command as $val) {
         $tmp[] = ucfirst(strtolower($val));
     }
     $command = 'command' . implode('', $tmp);
     if (!method_exists($this, $command)) {
         Out::out('Command not found, see help');
         return false;
     }
     $this->initializeArgs($args);
     call_user_func(array($this, $command));
     return true;
 }
Example #4
0
 protected static function outTableContent($row)
 {
     $colCnt = count(self::$tableMaxCol);
     $res = '';
     foreach ($row as $colNum => $col) {
         $border = $colNum < $colCnt - 1 ? '|' : '';
         $cont = self::strPad($col, self::$tableMaxCol[$colNum], ' ');
         $res .= ' ' . $cont . ' ' . $border;
     }
     Out::out('|' . $res . '|');
 }