コード例 #1
0
ファイル: TestHelper.php プロジェクト: Bananamoon/aimeos-core
 /**
  * @param string $site
  */
 private static function _createContext($site)
 {
     $ctx = new MShop_Context_Item_Default();
     $arcavias = self::_getArcavias();
     $paths = $arcavias->getConfigPaths('mysql');
     $paths[] = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config';
     $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
     $conf = new MW_Config_Array(array(), $paths);
     $conf = new MW_Config_Decorator_Memory($conf);
     $conf = new MW_Config_Decorator_Documentor($conf, $file);
     $ctx->setConfig($conf);
     $dbm = new MW_DB_Manager_PDO($conf);
     $ctx->setDatabaseManager($dbm);
     $logger = new MW_Logger_File($site . '.log', MW_Logger_Abstract::DEBUG);
     $ctx->setLogger($logger);
     $cache = new MW_Cache_None();
     $ctx->setCache($cache);
     $i18n = new MW_Translation_None('de');
     $ctx->setI18n(array('de' => $i18n));
     $session = new MW_Session_None();
     $ctx->setSession($session);
     $localeManager = MShop_Locale_Manager_Factory::createManager($ctx);
     $locale = $localeManager->bootstrap($site, '', '', false);
     $ctx->setLocale($locale);
     $ctx->setEditor('core:client/html');
     return $ctx;
 }
コード例 #2
0
ファイル: Setup.php プロジェクト: nos3/aimeos-typo3
 /**
  * Returns a new context object.
  *
  * @return MShop_Context_Item_Interface Context object
  */
 protected static function getContext()
 {
     $ctx = new \MShop_Context_Item_Default();
     $conf = \Aimeos\Aimeos\Base::getConfig();
     $ctx->setConfig($conf);
     $dbm = new \MW_DB_Manager_PDO($conf);
     $ctx->setDatabaseManager($dbm);
     $logger = new \MW_Logger_Errorlog(\MW_Logger_ABSTRACT::INFO);
     $ctx->setLogger($logger);
     $session = new \MW_Session_None();
     $ctx->setSession($session);
     $cache = new \MW_Cache_None();
     $ctx->setCache($cache);
     return $ctx;
 }
コード例 #3
0
ファイル: setup.php プロジェクト: Bananamoon/aimeos-core
    $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 MW_DB_Manager_PDO($conf);
    $ctx->setDatabaseManager($dbm);
    $logger = new MW_Logger_Errorlog(MW_Logger_ABSTRACT::INFO);
    $ctx->setLogger($logger);
    $session = new MW_Session_None();
    $ctx->setSession($session);
    $cache = new MW_Cache_None();
    $ctx->setCache($cache);
    $manager = new 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";