Example #1
0
 /**
  * @see UpgradeDriver::getScripts()
  *
  * @param string $dir Sugar directory
  * @param string $stage
  * @return array
  */
 protected function getScripts($dir, $stage)
 {
     //For the pre stage step, use the post template location
     if ($stage == 'pre') {
         $dir = $this->context['post_template'];
         $this->log("Pre stage will get scripts from location: {$dir}");
     }
     return parent::getScripts($dir, $stage);
 }
Example #2
0
     * @return bool|false
     */
    protected function verify($zip, $dir)
    {
        if (!empty($this->state['stage']['pre'])) {
            $this->cleanState();
        }
        return parent::verify($zip, $dir);
    }
    /**
     * Run given stage
     * If stage healthcheck and healthcheck doesn't exists we run unpack stage
     * @inheritdoc
     */
    public function run($stage)
    {
        if ($stage == 'healthcheck' && (!file_exists($this->context['health_check_path']) || empty($this->state['stage']['unpack']) || $this->state['stage']['unpack'] == 'failed') && !$this->run('unpack')) {
            return false;
        }
        return parent::run($stage);
    }
}
if (empty($argv[0]) || basename($argv[0]) != basename(__FILE__)) {
    return;
}
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) != 'cli') {
    die("This is command-line only script");
}
$upgrader = new CliUpgrader();
$upgrader->start();