/**
  * @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;
 }
Exemple #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;
 }
Exemple #3
0
 /**
  * Returns the current context
  *
  * @param boolean $locale True to add locale object to context, false if not
  * @return \Aimeos\MShop\Context\Item\Iface Context object
  */
 public function get($locale = true)
 {
     if (self::$context === null) {
         $context = new \Aimeos\MShop\Context\Item\Standard();
         $config = $this->getConfig();
         $context->setConfig($config);
         $dbm = new \Aimeos\MW\DB\Manager\PDO($config);
         $context->setDatabaseManager($dbm);
         $fs = new \Aimeos\MW\Filesystem\Manager\Laravel(app('filesystem'), $config, storage_path('aimeos'));
         $context->setFilesystemManager($fs);
         $mail = new \Aimeos\MW\Mail\Swift(function () {
             return app('mailer')->getSwiftMailer();
         });
         $context->setMail($mail);
         $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context);
         $context->setLogger($logger);
         $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context);
         $context->setCache($cache);
         self::$context = $context;
     }
     $context = self::$context;
     if ($locale === true) {
         $localeItem = $this->getLocale($context);
         $langid = $localeItem->getLanguageId();
         $context->setLocale($localeItem);
         $context->setI18n(app('\\Aimeos\\Shop\\Base\\I18n')->get(array($langid)));
     }
     $session = new \Aimeos\MW\Session\Laravel5($this->session);
     $context->setSession($session);
     $this->addUser($context);
     return $context;
 }
 /**
  * Returns the current context.
  *
  * @param boolean $locale True to add locale object to context, false if not
  * @return \Aimeos\MShop\Context\Item\Iface Context object
  */
 public function get($locale = true)
 {
     if (self::$context === null) {
         $context = new \Aimeos\MShop\Context\Item\Standard();
         $config = $this->getConfig();
         $context->setConfig($config);
         $dbm = new \Aimeos\MW\DB\Manager\PDO($config);
         $context->setDatabaseManager($dbm);
         $fs = new \Aimeos\MW\Filesystem\Manager\Standard($config);
         $context->setFilesystemManager($fs);
         $container = $this->container;
         $mail = new \Aimeos\MW\Mail\Swift(function () use($container) {
             return $container->get('mailer');
         });
         $context->setMail($mail);
         $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context);
         $context->setLogger($logger);
         $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context);
         $context->setCache($cache);
         self::$context = $context;
     }
     $context = self::$context;
     if ($locale === true) {
         $localeItem = $this->getLocale($context);
         $langid = $localeItem->getLanguageId();
         $context->setLocale($localeItem);
         $context->setI18n($this->container->get('aimeos_i18n')->get(array($langid)));
     }
     $session = new \Aimeos\MW\Session\Symfony2($this->container->get('session'));
     $context->setSession($session);
     $this->addUser($context);
     return $context;
 }
Exemple #5
0
 /**
  * Returns a new context object
  *
  * @param array $confPaths List of configuration paths from the bootstrap object
  * @param array $options Associative list of configuration options as key/value pairs
  * @return \Aimeos\MShop\Context\Item\Iface Context object
  */
 protected static function getContext(array $confPaths, array $options)
 {
     $config = array();
     $ctx = new \Aimeos\MShop\Context\Item\Standard();
     if (isset($options['config'])) {
         foreach ((array) $options['config'] as $path) {
             if (is_file($path)) {
                 $config = array_replace_recursive($config, require $path);
             } else {
                 $confPaths[] = $path;
             }
         }
     }
     $conf = new \Aimeos\MW\Config\PHPArray($config, $confPaths);
     $conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
     if (($cfg = $conf->get('command')) !== null) {
         $conf = new \Aimeos\MW\Config\Decorator\Memory($conf, $cfg);
     }
     $ctx->setConfig($conf);
     $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);
     return $ctx;
 }
Exemple #6
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;
 }
Exemple #7
0
 /**
  * Creates a new context item.
  *
  * @param string $site Unique site code
  * @return \\Aimeos\MShop\Context\Item\Iface Context object
  */
 private static function createContext($site)
 {
     $ctx = new \Aimeos\MShop\Context\Item\Standard();
     $mshop = self::getAimeos();
     $paths = $mshop->getConfigPaths('mysql');
     $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
     $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths);
     $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);
     $session = new \Aimeos\MW\Session\None();
     $ctx->setSession($session);
     $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
     $localeItem = $localeManager->bootstrap($site, '', '', false);
     $ctx->setLocale($localeItem);
     $ctx->setEditor('zend:unittest');
     return $ctx;
 }
Exemple #8
0
 /**
  * @param string $site
  */
 private static function createContext($site)
 {
     $ctx = new \Aimeos\MShop\Context\Item\Standard();
     $aimeos = self::getAimeos();
     $paths = $aimeos->getConfigPaths('mysql');
     $paths[] = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config';
     $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths);
     $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);
     $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);
     $localeItem = $localeManager->bootstrap($site, '', '', false);
     $ctx->setLocale($localeItem);
     $ctx->setEditor('ai-monolog:lib/custom');
     return $ctx;
 }
Exemple #9
0
 /**
  * @param string $site
  */
 private static function createContext($site)
 {
     $ctx = new \Aimeos\MShop\Context\Item\Standard();
     $aimeos = self::getAimeos();
     $paths = $aimeos->getConfigPaths();
     $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
     $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths);
     $ctx->setConfig($conf);
     $dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
     $ctx->setDatabaseManager($dbm);
     $fs = new \Aimeos\MW\Filesystem\Manager\Standard($conf);
     $ctx->setFilesystemManager($fs);
     $logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG);
     $ctx->setLogger($logger);
     $session = new \Aimeos\MW\Session\None();
     $ctx->setSession($session);
     $i18n = new \Aimeos\MW\Translation\None('de');
     $ctx->setI18n(array('de' => $i18n));
     $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
     $locale = $localeManager->bootstrap($site, '', '', false);
     $ctx->setLocale($locale);
     $ctx->setEditor('phpexcel:controller/extjs');
     return $ctx;
 }
Exemple #10
0
                printf("Invalid config option \"%1\$s\"\n", $option);
                usage();
            }
            $conf->set($parts[0], $parts[1]);
        }
    }
    $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";