/** * Executes the setup tasks for updating the database. * * The setup tasks print their information directly to the standard output. * To avoid this, it's necessary to use the output buffering handler * (ob_start(), ob_get_contents() and ob_end_clean()). */ public static function execute() { ini_set('max_execution_time', 0); $aimeos = \Aimeos\Aimeos\Base::getAimeos(); $sitecode = \Aimeos\Aimeos\Base::getExtConfig('siteCode', 'default'); $taskPaths = $aimeos->getSetupPaths('default'); $includePaths = $taskPaths; $includePaths[] = get_include_path(); if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) { throw new Exception('Unable to extend include path'); } if (spl_autoload_register('Aimeos\\Aimeos\\Setup::autoload') === false) { throw new Exception('Unable to register Aimeos\\Aimeos\\Setup::autoload'); } $ctx = self::getContext(); $dbm = $ctx->getDatabaseManager(); $config = $ctx->getConfig(); $local = array(); $config->set('setup/site', $sitecode); $dbconfig = $config->get('resource', array()); foreach ($dbconfig as $rname => $dbconf) { if (strncmp($rname, 'db', 2) !== 0) { unset($dbconfig[$rname]); } else { $config->set("resource/{$rname}/limit", 2); } } if (\Aimeos\Aimeos\Base::getExtConfig('useDemoData', 1) == 1) { $local = array('setup' => array('default' => array('demo' => true))); } $ctx->setConfig(new \MW_Config_Decorator_Memory($config, $local)); $manager = new \MW_Setup_Manager_Multiple($dbm, $dbconfig, $taskPaths, $ctx); $manager->run('mysql'); }
/** * Executes the setup tasks for updating the database. * * The setup tasks print their information directly to the standard output. * To avoid this, it's necessary to use the output buffering handler * (ob_start(), ob_get_contents() and ob_end_clean()). */ public static function execute() { ini_set('max_execution_time', 0); $aimeos = \Aimeos\Aimeos\Base::getAimeos(); $sitecode = \Aimeos\Aimeos\Base::getExtConfig('siteCode', 'default'); $taskPaths = $aimeos->getSetupPaths('default'); $ctx = self::getContext(); $dbm = $ctx->getDatabaseManager(); $config = $ctx->getConfig(); $config->set('setup/site', $sitecode); $dbconfig = $config->get('resource', array()); foreach ($dbconfig as $rname => $dbconf) { if (strncmp($rname, 'db', 2) !== 0) { unset($dbconfig[$rname]); } else { $config->set("resource/{$rname}/limit", 2); } } $class = 'TYPO3\\CMS\\Extbase\\Object\\ObjectManager'; $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($class); $utility = $objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility'); $conf = $utility->convertValuedToNestedConfiguration($utility->getCurrentConfiguration('aimeos')); $value = isset($conf['useDemoData']) ? $conf['useDemoData'] : ''; $local = array('setup' => array('default' => array('demo' => (string) $value))); $ctx->setConfig(new \Aimeos\MW\Config\Decorator\Memory($config, $local)); $manager = new \Aimeos\MW\Setup\Manager\Multiple($dbm, $dbconfig, $taskPaths, $ctx); $manager->migrate(); $conf['useDemoData'] = ''; $utility->writeConfiguration($conf, 'aimeos'); }
/** * Adds the cache object to the context * * @param \Aimeos\MShop\Context\Item\Iface $context Context object including config * @return \Aimeos\MShop\Context\Item\Iface Modified context object */ protected static function addCache(\Aimeos\MShop\Context\Item\Iface $context) { if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_cache']) && is_callable($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_cache'])) { return $fcn($context); } switch (\Aimeos\Aimeos\Base::getExtConfig('cacheName', 'Typo3')) { case 'None': $context->getConfig()->set('client/html/basket/cache/enable', false); $cache = \Aimeos\MW\Cache\Factory::createManager('None', array(), null); break; case 'Typo3': $manager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager'); $cache = new \Aimeos\MAdmin\Cache\Proxy\Typo3($context, $manager->getCache('aimeos')); break; default: $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); } return $context->setCache($cache); }
/** * Creates new translation objects. * * @param array $i18nPaths Paths to the translation directories * @param array $langIds List of two letter ISO language IDs * @param array $local List of local translation entries overwriting the standard ones * @return array List of translation objects implementing MW_Translation_Interface */ public static function get(array $i18nPaths, array $languageIds, array $local = array()) { $i18nList = array(); foreach ($languageIds as $langid) { if (!isset(self::$i18n[$langid])) { $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $langid); if (function_exists('apc_store') === true && (bool) \Aimeos\Aimeos\Base::getExtConfig('useAPC', false) === true) { $i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, \Aimeos\Aimeos\Base::getExtConfig('apcPrefix', 't3:')); } self::$i18n[$langid] = $i18n; } $i18nList[$langid] = self::$i18n[$langid]; if (isset($local[$langid])) { $translations = self::parseTranslations((array) $local[$langid]); $i18nList[$langid] = new \Aimeos\MW\Translation\Decorator\Memory($i18nList[$langid], $translations); } } return $i18nList; }
/** * Executes the setup tasks for updating the database. * * The setup tasks print their information directly to the standard output. * To avoid this, it's necessary to use the output buffering handler * (ob_start(), ob_get_contents() and ob_end_clean()). */ public static function execute() { ini_set('max_execution_time', 0); $aimeos = \Aimeos\Aimeos\Base::getAimeos(); $sitecode = \Aimeos\Aimeos\Base::getExtConfig('siteCode', 'default'); $taskPaths = $aimeos->getSetupPaths($sitecode); $includePaths = $taskPaths; $includePaths[] = get_include_path(); if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) { throw new \Exception('Unable to extend include path'); } if (spl_autoload_register('Aimeos\\Aimeos\\Setup::autoload') === false) { throw new \Exception('Unable to register Aimeos\\Aimeos\\Setup::autoload'); } $ctx = self::getContext(); $dbm = $ctx->getDatabaseManager(); $config = $ctx->getConfig(); $config->set('setup/site', $sitecode); $dbconfig = $config->get('resource', array()); foreach ($dbconfig as $rname => $dbconf) { if (strncmp($rname, 'db', 2) !== 0) { unset($dbconfig[$rname]); } else { $config->set("resource/{$rname}/limit", 2); } } $class = '\\TYPO3\\CMS\\Extbase\\Object\\ObjectManager'; $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($class); $utility = $objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility'); $conf = $utility->getCurrentConfiguration('aimeos'); $local = array('setup' => array('default' => array('demo' => (string) $conf['useDemoData']))); $ctx->setConfig(new \Aimeos\MW\Config\Decorator\Memory($config, $local)); $manager = new \Aimeos\MW\Setup\Manager\Multiple($dbm, $dbconfig, $taskPaths, $ctx); $manager->run('mysql'); $conf['useDemoData'] = ''; $utility->writeConfiguration($conf, 'aimeos'); }
/** * Creates a new configuration object. * * @param array $paths Paths to the configuration directories * @param array $local Multi-dimensional associative list with local configuration * @return \Aimeos\MW\Config\Iface Configuration object */ public static function get(array $paths, array $local = array()) { if (self::$config === null) { // Using extension config directories if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs'])) { ksort($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs']); foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs'] as $dir) { if (($absPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($dir)) !== '') { $paths[] = $absPath; } } } $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths); if (function_exists('apc_store') === true && (bool) \Aimeos\Aimeos\Base::getExtConfig('useAPC', false) === true) { $conf = new \Aimeos\MW\Config\Decorator\APC($conf, \Aimeos\Aimeos\Base::getExtConfig('apcPrefix', 't3:')); } self::$config = $conf; } if (isset($local['typo3']['tsconfig'])) { $tsconfig = \Aimeos\Aimeos\Base::parseTS($local['typo3']['tsconfig']); $local = \TYPO3\CMS\Extbase\Utility\ArrayUtility::arrayMergeRecursiveOverrule($local, $tsconfig); } return new \Aimeos\MW\Config\Decorator\Memory(self::$config, $local); }