Exemplo n.º 1
0
 /**
  * @param string $site
  */
 private static function createContext($site)
 {
     $ctx = new \Aimeos\MShop\Context\Item\Standard();
     $aimeos = self::getAimeos();
     $paths = $aimeos->getConfigPaths('mysql');
     $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
     $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
     $local = array('resource' => array('fs' => array('adapter' => 'Standard', 'basedir' => __DIR__ . '/tmp')));
     $conf = new \Aimeos\MW\Config\PHPArray($local, $paths);
     $conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
     $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file);
     $ctx->setConfig($conf);
     $logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG);
     $ctx->setLogger($logger);
     $dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
     $ctx->setDatabaseManager($dbm);
     $fs = new \Aimeos\MW\Filesystem\Manager\Standard($conf);
     $ctx->setFilesystemManager($fs);
     $mq = new \Aimeos\MW\MQueue\Manager\Standard($conf);
     $ctx->setMessageQueueManager($mq);
     $cache = new \Aimeos\MW\Cache\None();
     $ctx->setCache($cache);
     $i18n = new \Aimeos\MW\Translation\None('de');
     $ctx->setI18n(array('de' => $i18n));
     $session = new \Aimeos\MW\Session\None();
     $ctx->setSession($session);
     $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
     $locale = $localeManager->bootstrap($site, '', '', false);
     $ctx->setLocale($locale);
     $ctx->setEditor('core:client/html');
     return $ctx;
 }
Exemplo n.º 2
0
 /**
  * @param string $site
  */
 private static function createContext($site)
 {
     $ctx = new \Aimeos\MShop\Context\Item\Standard();
     $aimeos = self::getAimeos();
     $paths = $aimeos->getConfigPaths('mysql');
     $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
     $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
     $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths);
     $conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
     $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file);
     $ctx->setConfig($conf);
     $dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
     $ctx->setDatabaseManager($dbm);
     $logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG);
     $ctx->setLogger($logger);
     $cache = new \Aimeos\MW\Cache\None();
     $ctx->setCache($cache);
     $i18n = new \Aimeos\MW\Translation\None('de');
     $ctx->setI18n(array('de' => $i18n));
     $session = new \Aimeos\MW\Session\None();
     $ctx->setSession($session);
     $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
     $locale = $localeManager->bootstrap($site, '', '', false);
     $ctx->setLocale($locale);
     $ctx->setEditor('core:admin/jqadm');
     return $ctx;
 }
Exemplo n.º 3
0
 /**
  * Returns a new context object.
  *
  * @return MShop_Context_Item_Interface Context object
  */
 protected static function getContext()
 {
     $ctx = new \Aimeos\MShop\Context\Item\Standard();
     $conf = \Aimeos\Aimeos\Base::getConfig();
     $ctx->setConfig($conf);
     $dbm = new \Aimeos\MW\DB\Manager\DBAL($conf);
     $ctx->setDatabaseManager($dbm);
     $logger = new \Aimeos\MW\Logger\Errorlog(\Aimeos\MW\Logger\Base::INFO);
     $ctx->setLogger($logger);
     $session = new \Aimeos\MW\Session\None();
     $ctx->setSession($session);
     $cache = new \Aimeos\MW\Cache\None();
     $ctx->setCache($cache);
     return $ctx;
 }
Exemplo n.º 4
0
    $dbconfig = $conf->get('resource', array());
    foreach ($dbconfig as $rname => $dbconf) {
        if (strncmp($rname, 'db', 2) !== 0) {
            unset($dbconfig[$rname]);
        } else {
            $conf->set("resource/{$rname}/limit", 2);
        }
    }
    $dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
    $ctx->setDatabaseManager($dbm);
    $logger = new \Aimeos\MW\Logger\Errorlog(\Aimeos\MW\Logger\Base::INFO);
    $ctx->setLogger($logger);
    $session = new \Aimeos\MW\Session\None();
    $ctx->setSession($session);
    $cache = new \Aimeos\MW\Cache\None();
    $ctx->setCache($cache);
    $manager = new \Aimeos\MW\Setup\Manager\Multiple($dbm, $dbconfig, $taskPaths, $ctx);
    $manager->run('mysql');
} catch (Throwable $t) {
    echo "\n\nCaught PHP error while processing setup";
    echo "\n\nMessage:\n";
    echo $t->getMessage();
    echo "\n\nStack trace:\n";
    echo $t->getTraceAsString();
    echo "\n\n";
    exit(1);
} catch (\Exception $e) {
    echo "\n\nCaught exception while processing setup";
    echo "\n\nMessage:\n";
    echo $e->getMessage();
    echo "\n\nStack trace:\n";