Example #1
0
 /**
  * Executes the command
  *
  * @param array $argv Associative array from $_SERVER['argv']
  */
 public static function run(array $argv)
 {
     array_shift($argv);
     $options = self::getOptions($argv);
     $sites = array_shift($argv);
     $extdirs = isset($options['extdir']) ? (array) $options['extdir'] : array();
     $aimeos = new \Aimeos\Bootstrap($extdirs);
     $ctx = self::getContext($aimeos->getConfigPaths(), $options);
     $siteItems = self::getSiteItems($ctx, $sites);
     self::clear($ctx, $siteItems);
 }
Example #2
0
     $site = 'default';
 }
 if (($parent = array_shift($params)) === null) {
     $parent = $site;
 }
 spl_autoload_register('setup_autoload');
 require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
 $aimeos = new \Aimeos\Bootstrap(isset($options['extdir']) ? (array) $options['extdir'] : array());
 $taskPaths = $aimeos->getSetupPaths($parent);
 $includePaths = $taskPaths;
 $includePaths[] = get_include_path();
 if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) {
     throw new \Exception('Unable to extend include path');
 }
 $ctx = new \Aimeos\MShop\Context\Item\Standard();
 $confPaths = $aimeos->getConfigPaths('mysql');
 if (isset($options['config'])) {
     $confPaths = array_merge($confPaths, (array) $options['config']);
 }
 $conf = new \Aimeos\MW\Config\PHPArray(array(), $confPaths);
 $conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
 $ctx->setConfig($conf);
 $conf->set('setup/site', $site);
 if (isset($options['option'])) {
     foreach ((array) $options['option'] as $option) {
         $parts = explode(':', $option);
         if (count($parts) !== 2) {
             printf("Invalid config option \"%1\$s\"\n", $option);
             usage();
         }
         $conf->set($parts[0], $parts[1]);
Example #3
0
try {
    $params = $_SERVER['argv'];
    array_shift($params);
    $options = getOptions($params);
    if (($site = array_shift($params)) === null) {
        $site = 'default';
    }
    if (($tplsite = array_shift($params)) === null) {
        $tplsite = 'default';
    }
    spl_autoload_register('setupAutoload');
    require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
    $aimeos = new \Aimeos\Bootstrap(isset($options['extdir']) ? (array) $options['extdir'] : array());
    $taskPaths = $aimeos->getSetupPaths($tplsite);
    setIncludePaths($taskPaths);
    $conf = getConfig($aimeos->getConfigPaths(), $options);
    $conf->set('setup/site', $site);
    $dbconfig = getDbConfig($conf);
    $ctx = getContext($conf);
    $dbm = $ctx->getDatabaseManager();
    $manager = new \Aimeos\MW\Setup\Manager\Multiple($dbm, $dbconfig, $taskPaths, $ctx);
    $action = isset($options['action']) ? $options['action'] : 'migrate';
    $task = isset($options['task']) ? $options['task'] : null;
    switch ($action) {
        case 'clean':
            $manager->clean($task);
            break;
        case 'migrate':
            $manager->migrate($task);
            break;
        case 'rollback':
Example #4
0
     $site = 'default';
 }
 if (($tplsite = array_shift($params)) === null) {
     $parent = 'default';
 }
 spl_autoload_register('setup_autoload');
 require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
 $aimeos = new \Aimeos\Bootstrap(isset($options['extdir']) ? (array) $options['extdir'] : array());
 $taskPaths = $aimeos->getSetupPaths($tplsite);
 $includePaths = $taskPaths;
 $includePaths[] = get_include_path();
 if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) {
     throw new \Exception('Unable to extend include path');
 }
 $ctx = new \Aimeos\MShop\Context\Item\Standard();
 $confPaths = $aimeos->getConfigPaths();
 if (isset($options['config'])) {
     $confPaths = array_merge($confPaths, (array) $options['config']);
 }
 $conf = new \Aimeos\MW\Config\PHPArray(array(), $confPaths);
 $conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
 $ctx->setConfig($conf);
 $conf->set('setup/site', $site);
 if (isset($options['option'])) {
     foreach ((array) $options['option'] as $option) {
         $parts = explode(':', $option);
         if (count($parts) !== 2) {
             printf("Invalid config option \"%1\$s\"\n", $option);
             usage();
         }
         $conf->set($parts[0], $parts[1]);