@@ -29,33 +29,33 @@ discard block |
||
| 29 | 29 | * @param \Aimeos\Base\Config\Iface Configuration object |
| 30 | 30 | * @return \Aimeos\MShop\ContextIface Context object |
| 31 | 31 | */ |
| 32 | - public static function get(\Aimeos\Base\Config\Iface $config) : \Aimeos\MShop\ContextIface |
|
| 32 | + public static function get( \Aimeos\Base\Config\Iface $config ) : \Aimeos\MShop\ContextIface |
|
| 33 | 33 | { |
| 34 | - if (self::$context === null) { |
|
| 34 | + if( self::$context === null ) { |
|
| 35 | 35 | // TYPO3 specifc context with password hasher |
| 36 | 36 | $context = new \Aimeos\MShop\Context\Item\Typo3(); |
| 37 | - $context->setConfig($config); |
|
| 38 | - |
|
| 39 | - self::addDataBaseManager($context); |
|
| 40 | - self::addFilesystemManager($context); |
|
| 41 | - self::addMessageQueueManager($context); |
|
| 42 | - self::addLogger($context); |
|
| 43 | - self::addCache($context); |
|
| 44 | - self::addMailer($context); |
|
| 45 | - self::addNonce($context); |
|
| 46 | - self::addProcess($context); |
|
| 47 | - self::addSession($context); |
|
| 48 | - self::addHasher($context); |
|
| 49 | - self::addToken($context); |
|
| 50 | - self::addUser($context); |
|
| 51 | - self::addGroups($context); |
|
| 52 | - self::addDateTime($context); |
|
| 37 | + $context->setConfig( $config ); |
|
| 38 | + |
|
| 39 | + self::addDataBaseManager( $context ); |
|
| 40 | + self::addFilesystemManager( $context ); |
|
| 41 | + self::addMessageQueueManager( $context ); |
|
| 42 | + self::addLogger( $context ); |
|
| 43 | + self::addCache( $context ); |
|
| 44 | + self::addMailer( $context ); |
|
| 45 | + self::addNonce( $context ); |
|
| 46 | + self::addProcess( $context ); |
|
| 47 | + self::addSession( $context ); |
|
| 48 | + self::addHasher( $context ); |
|
| 49 | + self::addToken( $context ); |
|
| 50 | + self::addUser( $context ); |
|
| 51 | + self::addGroups( $context ); |
|
| 52 | + self::addDateTime( $context ); |
|
| 53 | 53 | |
| 54 | 54 | self::$context = $context; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // Use local TS configuration from plugins |
| 58 | - self::$context->setConfig($config); |
|
| 58 | + self::$context->setConfig( $config ); |
|
| 59 | 59 | |
| 60 | 60 | return self::$context; |
| 61 | 61 | } |
@@ -67,35 +67,35 @@ discard block |
||
| 67 | 67 | * @param \Aimeos\MShop\ContextIface $context Context object including config |
| 68 | 68 | * @return \Aimeos\MShop\ContextIface Modified context object |
| 69 | 69 | */ |
| 70 | - protected static function addCache(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
| 70 | + protected static function addCache( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
| 71 | 71 | { |
| 72 | - if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_cache']) |
|
| 73 | - && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_cache'])) |
|
| 72 | + if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_cache'] ) |
|
| 73 | + && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_cache'] ) ) |
|
| 74 | 74 | ) { |
| 75 | - return $fcn($context); |
|
| 75 | + return $fcn( $context ); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $cacheName = \Aimeos\Aimeos\Base::getExtConfig('cacheName', 'Typo3'); |
|
| 79 | - if (isset($GLOBALS['TSFE']) && $GLOBALS['TSFE']->headerNoCache()) { |
|
| 78 | + $cacheName = \Aimeos\Aimeos\Base::getExtConfig( 'cacheName', 'Typo3' ); |
|
| 79 | + if( isset( $GLOBALS['TSFE'] ) && $GLOBALS['TSFE']->headerNoCache() ) { |
|
| 80 | 80 | $cacheName = 'None'; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - switch ($cacheName) { |
|
| 83 | + switch( $cacheName ) { |
|
| 84 | 84 | case 'None': |
| 85 | - $context->config()->set('client/html/basket/cache/enable', false); |
|
| 86 | - $cache = \Aimeos\Base\Cache\Factory::create('None', [], null); |
|
| 85 | + $context->config()->set( 'client/html/basket/cache/enable', false ); |
|
| 86 | + $cache = \Aimeos\Base\Cache\Factory::create( 'None', [], null ); |
|
| 87 | 87 | break; |
| 88 | 88 | |
| 89 | 89 | case 'Typo3': |
| 90 | - $manager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class); |
|
| 91 | - $cache = (new \Aimeos\MAdmin\Cache\Manager\Typo3($context, $manager->getCache('aimeos')))->getCache(); |
|
| 90 | + $manager = GeneralUtility::makeInstance( \TYPO3\CMS\Core\Cache\CacheManager::class ); |
|
| 91 | + $cache = ( new \Aimeos\MAdmin\Cache\Manager\Typo3( $context, $manager->getCache( 'aimeos' ) ) )->getCache(); |
|
| 92 | 92 | break; |
| 93 | 93 | |
| 94 | 94 | default: |
| 95 | - $cache = (new \Aimeos\MAdmin\Cache\Manager\Standard($context))->getCache(); |
|
| 95 | + $cache = ( new \Aimeos\MAdmin\Cache\Manager\Standard( $context ) )->getCache(); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - return $context->setCache($cache); |
|
| 98 | + return $context->setCache( $cache ); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
@@ -105,16 +105,16 @@ discard block |
||
| 105 | 105 | * @param \Aimeos\MShop\ContextIface $context Context object |
| 106 | 106 | * @return \Aimeos\MShop\ContextIface Modified context object |
| 107 | 107 | */ |
| 108 | - protected static function addDatabaseManager(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
| 108 | + protected static function addDatabaseManager( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
| 109 | 109 | { |
| 110 | - if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_dbm']) |
|
| 111 | - && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_dbm'])) |
|
| 110 | + if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_dbm'] ) |
|
| 111 | + && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_dbm'] ) ) |
|
| 112 | 112 | ) { |
| 113 | - return $fcn($context); |
|
| 113 | + return $fcn( $context ); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $dbm = new \Aimeos\Base\DB\Manager\Standard($context->config()->get('resource', []), 'DBAL'); |
|
| 117 | - return $context->setDatabaseManager($dbm); |
|
| 116 | + $dbm = new \Aimeos\Base\DB\Manager\Standard( $context->config()->get( 'resource', [] ), 'DBAL' ); |
|
| 117 | + return $context->setDatabaseManager( $dbm ); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | |
@@ -124,16 +124,16 @@ discard block |
||
| 124 | 124 | * @param \Aimeos\MShop\ContextIface $context Context object |
| 125 | 125 | * @return \Aimeos\MShop\ContextIface Modified context object |
| 126 | 126 | */ |
| 127 | - protected static function addFilesystemManager(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
| 127 | + protected static function addFilesystemManager( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
| 128 | 128 | { |
| 129 | - if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_fsm']) |
|
| 130 | - && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_fsm'])) |
|
| 129 | + if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_fsm'] ) |
|
| 130 | + && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_fsm'] ) ) |
|
| 131 | 131 | ) { |
| 132 | - return $fcn($context); |
|
| 132 | + return $fcn( $context ); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $fsm = new \Aimeos\Base\Filesystem\Manager\Standard($context->config()->get('resource', [])); |
|
| 136 | - return $context->setFilesystemManager($fsm); |
|
| 135 | + $fsm = new \Aimeos\Base\Filesystem\Manager\Standard( $context->config()->get( 'resource', [] ) ); |
|
| 136 | + return $context->setFilesystemManager( $fsm ); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
@@ -143,16 +143,16 @@ discard block |
||
| 143 | 143 | * @param \Aimeos\MShop\ContextIface $context Context object |
| 144 | 144 | * @return \Aimeos\MShop\ContextIface Modified context object |
| 145 | 145 | */ |
| 146 | - protected static function addHasher(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
| 146 | + protected static function addHasher( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
| 147 | 147 | { |
| 148 | - if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_hasher']) |
|
| 149 | - && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_hasher'])) |
|
| 148 | + if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_hasher'] ) |
|
| 149 | + && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_hasher'] ) ) |
|
| 150 | 150 | ) { |
| 151 | - return $fcn($context); |
|
| 151 | + return $fcn( $context ); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - $factory = GeneralUtility::makeInstance('TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory'); |
|
| 155 | - return $context->setPassword(new \Aimeos\Base\Password\Typo3($factory->getDefaultHashInstance('FE'))); |
|
| 154 | + $factory = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory' ); |
|
| 155 | + return $context->setPassword( new \Aimeos\Base\Password\Typo3( $factory->getDefaultHashInstance( 'FE' ) ) ); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | |
@@ -162,15 +162,15 @@ discard block |
||
| 162 | 162 | * @param \Aimeos\MShop\ContextIface $context Context object |
| 163 | 163 | * @return \Aimeos\MShop\ContextIface Modified context object |
| 164 | 164 | */ |
| 165 | - protected static function addLogger(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
| 165 | + protected static function addLogger( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
| 166 | 166 | { |
| 167 | - if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_logger']) |
|
| 168 | - && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_logger'])) |
|
| 167 | + if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_logger'] ) |
|
| 168 | + && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_logger'] ) ) |
|
| 169 | 169 | ) { |
| 170 | - return $fcn($context); |
|
| 170 | + return $fcn( $context ); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - return $context->setLogger(\Aimeos\MAdmin::create($context, 'log')); |
|
| 173 | + return $context->setLogger( \Aimeos\MAdmin::create( $context, 'log' ) ); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | |
@@ -180,17 +180,17 @@ discard block |
||
| 180 | 180 | * @param \Aimeos\MShop\ContextIface $context Context object |
| 181 | 181 | * @return \Aimeos\MShop\ContextIface Modified context object |
| 182 | 182 | */ |
| 183 | - protected static function addMailer(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
| 183 | + protected static function addMailer( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
| 184 | 184 | { |
| 185 | - if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mailer']) |
|
| 186 | - && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mailer'])) |
|
| 185 | + if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mailer'] ) |
|
| 186 | + && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mailer'] ) ) |
|
| 187 | 187 | ) { |
| 188 | - return $fcn($context); |
|
| 188 | + return $fcn( $context ); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - return $context->setMail(new \Aimeos\Base\Mail\Typo3(function() { |
|
| 192 | - return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailMessage::class); |
|
| 193 | - })); |
|
| 191 | + return $context->setMail( new \Aimeos\Base\Mail\Typo3( function() { |
|
| 192 | + return GeneralUtility::makeInstance( \TYPO3\CMS\Core\Mail\MailMessage::class ); |
|
| 193 | + }) ); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
@@ -200,16 +200,16 @@ discard block |
||
| 200 | 200 | * @param \Aimeos\MShop\ContextIface $context Context object |
| 201 | 201 | * @return \Aimeos\MShop\ContextIface Modified context object |
| 202 | 202 | */ |
| 203 | - protected static function addMessageQueueManager(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
| 203 | + protected static function addMessageQueueManager( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
| 204 | 204 | { |
| 205 | - if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mqueue']) |
|
| 206 | - && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mqueue'])) |
|
| 205 | + if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mqueue'] ) |
|
| 206 | + && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mqueue'] ) ) |
|
| 207 | 207 | ) { |
| 208 | - return $fcn($context); |
|
| 208 | + return $fcn( $context ); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - $mqm = new \Aimeos\Base\MQueue\Manager\Standard($context->config()->get('resource', [])); |
|
| 212 | - return $context->setMessageQueueManager($mqm); |
|
| 211 | + $mqm = new \Aimeos\Base\MQueue\Manager\Standard( $context->config()->get( 'resource', [] ) ); |
|
| 212 | + return $context->setMessageQueueManager( $mqm ); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | |
@@ -219,15 +219,15 @@ discard block |
||
| 219 | 219 | * @param \Aimeos\MShop\ContextIface $context Context object |
| 220 | 220 | * @return \Aimeos\MShop\ContextIface Modified context object |
| 221 | 221 | */ |
| 222 | - protected static function addNonce(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
| 222 | + protected static function addNonce( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
| 223 | 223 | { |
| 224 | - if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_nounce']) |
|
| 225 | - && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_nounce'])) |
|
| 224 | + if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_nounce'] ) |
|
| 225 | + && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_nounce'] ) ) |
|
| 226 | 226 | ) { |
| 227 | - return $fcn($context); |
|
| 227 | + return $fcn( $context ); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - return $context->setNonce(base64_encode(random_bytes(16))); |
|
| 230 | + return $context->setNonce( base64_encode( random_bytes( 16 ) ) ); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | |
@@ -237,24 +237,24 @@ discard block |
||
| 237 | 237 | * @param \Aimeos\MShop\ContextIface $context Context object |
| 238 | 238 | * @return \Aimeos\MShop\ContextIface Modified context object |
| 239 | 239 | */ |
| 240 | - protected static function addProcess(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
| 240 | + protected static function addProcess( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
| 241 | 241 | { |
| 242 | - if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_process']) |
|
| 243 | - && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_process'])) |
|
| 242 | + if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_process'] ) |
|
| 243 | + && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_process'] ) ) |
|
| 244 | 244 | ) { |
| 245 | - return $fcn($context); |
|
| 245 | + return $fcn( $context ); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - $process = new \Aimeos\Base\Process\Pcntl(\Aimeos\Aimeos\Base::getExtConfig('pcntlMax', 4)); |
|
| 248 | + $process = new \Aimeos\Base\Process\Pcntl( \Aimeos\Aimeos\Base::getExtConfig( 'pcntlMax', 4 ) ); |
|
| 249 | 249 | |
| 250 | 250 | // Reset before child processes are spawned to avoid lost DB connections afterwards |
| 251 | - if (method_exists('\TYPO3\CMS\Core\Database\ConnectionPool', 'resetConnections') === false |
|
| 251 | + if( method_exists( '\TYPO3\CMS\Core\Database\ConnectionPool', 'resetConnections' ) === false |
|
| 252 | 252 | || $process->isAvailable() === false |
| 253 | 253 | ) { |
| 254 | 254 | $process = new \Aimeos\Base\Process\None(); |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - return $context->setProcess($process); |
|
| 257 | + return $context->setProcess( $process ); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
@@ -264,25 +264,25 @@ discard block |
||
| 264 | 264 | * @param \Aimeos\MShop\ContextIface $context Context object |
| 265 | 265 | * @return \Aimeos\MShop\ContextIface Modified context object |
| 266 | 266 | */ |
| 267 | - protected static function addSession(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
| 267 | + protected static function addSession( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
| 268 | 268 | { |
| 269 | - if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_session']) |
|
| 270 | - && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_session'])) |
|
| 269 | + if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_session'] ) |
|
| 270 | + && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_session'] ) ) |
|
| 271 | 271 | ) { |
| 272 | - return $fcn($context); |
|
| 272 | + return $fcn( $context ); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | $class = \TYPO3\CMS\Core\Authentication\CommandLineUserAuthentication::class; |
| 276 | 276 | |
| 277 | - if (isset($GLOBALS['TSFE']->fe_user)) { |
|
| 278 | - $session = new \Aimeos\Base\Session\Typo3($GLOBALS['TSFE']->fe_user); |
|
| 279 | - } elseif (isset($GLOBALS['BE_USER']) && !($GLOBALS['BE_USER'] instanceof $class)) { |
|
| 280 | - $session = new \Aimeos\Base\Session\Typo3($GLOBALS['BE_USER']); |
|
| 277 | + if( isset( $GLOBALS['TSFE']->fe_user ) ) { |
|
| 278 | + $session = new \Aimeos\Base\Session\Typo3( $GLOBALS['TSFE']->fe_user ); |
|
| 279 | + } elseif( isset( $GLOBALS['BE_USER'] ) && !( $GLOBALS['BE_USER'] instanceof $class ) ) { |
|
| 280 | + $session = new \Aimeos\Base\Session\Typo3( $GLOBALS['BE_USER'] ); |
|
| 281 | 281 | } else { |
| 282 | 282 | $session = new \Aimeos\Base\Session\None(); |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - return $context->setSession($session); |
|
| 285 | + return $context->setSession( $session ); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
@@ -292,21 +292,21 @@ discard block |
||
| 292 | 292 | * @param \Aimeos\MShop\ContextIface $context Context object |
| 293 | 293 | * @return \Aimeos\MShop\ContextIface Modified context object |
| 294 | 294 | */ |
| 295 | - protected static function addToken(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
| 295 | + protected static function addToken( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
| 296 | 296 | { |
| 297 | - if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_token']) |
|
| 298 | - && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_token'])) |
|
| 297 | + if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_token'] ) |
|
| 298 | + && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_token'] ) ) |
|
| 299 | 299 | ) { |
| 300 | - return $fcn($context); |
|
| 300 | + return $fcn( $context ); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | $session = $context->session(); |
| 304 | 304 | |
| 305 | - if (($token = $session->get('token')) === null) { |
|
| 306 | - $session->set('token', isset($GLOBALS['TSFE']->fe_user) ? $GLOBALS['TSFE']->fe_user->id : md5(microtime(true) . getmypid())); |
|
| 305 | + if( ( $token = $session->get( 'token' ) ) === null ) { |
|
| 306 | + $session->set( 'token', isset( $GLOBALS['TSFE']->fe_user ) ? $GLOBALS['TSFE']->fe_user->id : md5( microtime( true ) . getmypid() ) ); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - return $context->setToken($token); |
|
| 309 | + return $context->setToken( $token ); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | |
@@ -316,28 +316,28 @@ discard block |
||
| 316 | 316 | * @param \Aimeos\MShop\ContextIface $context Context object |
| 317 | 317 | * @return \Aimeos\MShop\ContextIface Modified context object |
| 318 | 318 | */ |
| 319 | - protected static function addUser(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
| 319 | + protected static function addUser( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
| 320 | 320 | { |
| 321 | - if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_user']) |
|
| 322 | - && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_user'])) |
|
| 321 | + if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_user'] ) |
|
| 322 | + && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_user'] ) ) |
|
| 323 | 323 | ) { |
| 324 | - return $fcn($context); |
|
| 324 | + return $fcn( $context ); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | $appType = null; |
| 328 | - $t3context = GeneralUtility::makeInstance('TYPO3\CMS\Core\Context\Context'); |
|
| 328 | + $t3context = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\Context\Context' ); |
|
| 329 | 329 | |
| 330 | - if (($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface) { |
|
| 331 | - $appType = \TYPO3\CMS\Core\Http\ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST']); |
|
| 330 | + if( ( $GLOBALS['TYPO3_REQUEST'] ?? null ) instanceof ServerRequestInterface ) { |
|
| 331 | + $appType = \TYPO3\CMS\Core\Http\ApplicationType::fromRequest( $GLOBALS['TYPO3_REQUEST'] ); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if ($appType && $appType->isFrontend() && $t3context->getPropertyFromAspect('frontend.user', 'isLoggedIn')) { |
|
| 335 | - $context->setUserId($GLOBALS['TSFE']->fe_user->user[$GLOBALS['TSFE']->fe_user->userid_column]); |
|
| 336 | - $context->setEditor((string) $GLOBALS['TSFE']->fe_user->user['username']); |
|
| 337 | - } elseif ($appType && $appType->isBackend() && isset($GLOBALS['BE_USER']->user['username'])) { |
|
| 338 | - $context->setEditor((string) $GLOBALS['BE_USER']->user['username']); |
|
| 334 | + if( $appType && $appType->isFrontend() && $t3context->getPropertyFromAspect( 'frontend.user', 'isLoggedIn' ) ) { |
|
| 335 | + $context->setUserId( $GLOBALS['TSFE']->fe_user->user[$GLOBALS['TSFE']->fe_user->userid_column] ); |
|
| 336 | + $context->setEditor( (string) $GLOBALS['TSFE']->fe_user->user['username'] ); |
|
| 337 | + } elseif( $appType && $appType->isBackend() && isset( $GLOBALS['BE_USER']->user['username'] ) ) { |
|
| 338 | + $context->setEditor( (string) $GLOBALS['BE_USER']->user['username'] ); |
|
| 339 | 339 | } else { |
| 340 | - $context->setEditor((string) GeneralUtility::getIndpEnv('REMOTE_ADDR')); |
|
| 340 | + $context->setEditor( (string) GeneralUtility::getIndpEnv( 'REMOTE_ADDR' ) ); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | return $context; |
@@ -350,27 +350,27 @@ discard block |
||
| 350 | 350 | * @param \Aimeos\MShop\ContextIface $context Context object |
| 351 | 351 | * @return \Aimeos\MShop\ContextIface Modified context object |
| 352 | 352 | */ |
| 353 | - protected static function addGroups(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
| 353 | + protected static function addGroups( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
| 354 | 354 | { |
| 355 | - if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_groups']) |
|
| 356 | - && is_callable(($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_groups'])) |
|
| 355 | + if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_groups'] ) |
|
| 356 | + && is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_groups'] ) ) |
|
| 357 | 357 | ) { |
| 358 | - return $fcn($context); |
|
| 358 | + return $fcn( $context ); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - $t3context = GeneralUtility::makeInstance('TYPO3\CMS\Core\Context\Context'); |
|
| 361 | + $t3context = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\Context\Context' ); |
|
| 362 | 362 | |
| 363 | 363 | $appType = null; |
| 364 | - if (($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface) { |
|
| 365 | - $appType = \TYPO3\CMS\Core\Http\ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST']); |
|
| 364 | + if( ( $GLOBALS['TYPO3_REQUEST'] ?? null ) instanceof ServerRequestInterface ) { |
|
| 365 | + $appType = \TYPO3\CMS\Core\Http\ApplicationType::fromRequest( $GLOBALS['TYPO3_REQUEST'] ); |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - if ($appType && $appType->isFrontend() && $t3context->getPropertyFromAspect('frontend.user', 'isLoggedIn')) { |
|
| 369 | - $ids = GeneralUtility::trimExplode(',', $GLOBALS['TSFE']->fe_user->user['usergroup']); |
|
| 370 | - $context->setGroupIds($ids); |
|
| 371 | - } elseif ($appType && $appType->isBackend() && $GLOBALS['BE_USER']->userGroups) { |
|
| 372 | - $ids = array_keys($GLOBALS['BE_USER']->userGroups); |
|
| 373 | - $context->setGroupIds($ids); |
|
| 368 | + if( $appType && $appType->isFrontend() && $t3context->getPropertyFromAspect( 'frontend.user', 'isLoggedIn' ) ) { |
|
| 369 | + $ids = GeneralUtility::trimExplode( ',', $GLOBALS['TSFE']->fe_user->user['usergroup'] ); |
|
| 370 | + $context->setGroupIds( $ids ); |
|
| 371 | + } elseif( $appType && $appType->isBackend() && $GLOBALS['BE_USER']->userGroups ) { |
|
| 372 | + $ids = array_keys( $GLOBALS['BE_USER']->userGroups ); |
|
| 373 | + $context->setGroupIds( $ids ); |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | return $context; |
@@ -383,20 +383,20 @@ discard block |
||
| 383 | 383 | * @param \Aimeos\MShop\ContextIface $context Context object including config |
| 384 | 384 | * @return \Aimeos\MShop\ContextIface Modified context object |
| 385 | 385 | */ |
| 386 | - protected static function addDateTime(\Aimeos\MShop\ContextIface $context) : \Aimeos\MShop\ContextIface |
|
| 386 | + protected static function addDateTime( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface |
|
| 387 | 387 | { |
| 388 | 388 | $appType = null; |
| 389 | - if (($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface) { |
|
| 390 | - $appType = \TYPO3\CMS\Core\Http\ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST']); |
|
| 389 | + if( ( $GLOBALS['TYPO3_REQUEST'] ?? null ) instanceof ServerRequestInterface ) { |
|
| 390 | + $appType = \TYPO3\CMS\Core\Http\ApplicationType::fromRequest( $GLOBALS['TYPO3_REQUEST'] ); |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - if ($appType && $appType->isFrontend() && isset($GLOBALS['BE_USER']->adminPanel) |
|
| 394 | - && class_exists('TYPO3\\CMS\\Adminpanel\\Service\\ConfigurationService')) { |
|
| 395 | - $service = GeneralUtility::makeInstance('TYPO3\\CMS\\Adminpanel\\Service\\ConfigurationService'); |
|
| 396 | - $tstamp = strtotime($service->getConfigurationOption('preview', 'simulateDate')); |
|
| 393 | + if( $appType && $appType->isFrontend() && isset( $GLOBALS['BE_USER']->adminPanel ) |
|
| 394 | + && class_exists( 'TYPO3\\CMS\\Adminpanel\\Service\\ConfigurationService' ) ) { |
|
| 395 | + $service = GeneralUtility::makeInstance( 'TYPO3\\CMS\\Adminpanel\\Service\\ConfigurationService' ); |
|
| 396 | + $tstamp = strtotime( $service->getConfigurationOption( 'preview', 'simulateDate' ) ); |
|
| 397 | 397 | |
| 398 | - if (!empty($tstamp)) { |
|
| 399 | - $context->setDateTime(date('Y-m-d H:i:s', $tstamp)); |
|
| 398 | + if( !empty( $tstamp ) ) { |
|
| 399 | + $context->setDateTime( date( 'Y-m-d H:i:s', $tstamp ) ); |
|
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | |
@@ -72,16 +72,16 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | try { |
| 74 | 74 | ob_start(); |
| 75 | - $exectimeStart = microtime(true); |
|
| 75 | + $exectimeStart = microtime( true ); |
|
| 76 | 76 | |
| 77 | 77 | self::execute(); |
| 78 | 78 | |
| 79 | - $this->output->writeln(ob_get_clean()); |
|
| 80 | - $this->output->writeln(sprintf('Setup process lasted %1$f sec', (microtime(true) - $exectimeStart))); |
|
| 81 | - } catch(\Throwable $t) { |
|
| 82 | - $this->output->writeln(ob_get_clean()); |
|
| 83 | - $this->output->writeln($t->getMessage()); |
|
| 84 | - $this->output->writeln($t->getTraceAsString()); |
|
| 79 | + $this->output->writeln( ob_get_clean() ); |
|
| 80 | + $this->output->writeln( sprintf( 'Setup process lasted %1$f sec', ( microtime( true ) - $exectimeStart ) ) ); |
|
| 81 | + } catch( \Throwable $t ) { |
|
| 82 | + $this->output->writeln( ob_get_clean() ); |
|
| 83 | + $this->output->writeln( $t->getMessage() ); |
|
| 84 | + $this->output->writeln( $t->getTraceAsString() ); |
|
| 85 | 85 | |
| 86 | 86 | return false; |
| 87 | 87 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @param OutputInterface $output |
| 108 | 108 | */ |
| 109 | - public function setOutput(OutputInterface $output) : void |
|
| 109 | + public function setOutput( OutputInterface $output ) : void |
|
| 110 | 110 | { |
| 111 | 111 | $this->output = $output; |
| 112 | 112 | } |
@@ -128,29 +128,29 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public static function execute() |
| 130 | 130 | { |
| 131 | - ini_set('max_execution_time', 0); |
|
| 131 | + ini_set( 'max_execution_time', 0 ); |
|
| 132 | 132 | |
| 133 | - $objectManager = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class); |
|
| 134 | - $extconf = $objectManager->get('TYPO3\CMS\Core\Configuration\ExtensionConfiguration'); |
|
| 135 | - $demo = $extconf->get('aimeos', 'useDemoData'); |
|
| 133 | + $objectManager = GeneralUtility::makeInstance( \TYPO3\CMS\Extbase\Object\ObjectManager::class ); |
|
| 134 | + $extconf = $objectManager->get( 'TYPO3\CMS\Core\Configuration\ExtensionConfiguration' ); |
|
| 135 | + $demo = $extconf->get( 'aimeos', 'useDemoData' ); |
|
| 136 | 136 | |
| 137 | - \Aimeos\MShop::cache(false); |
|
| 138 | - \Aimeos\MAdmin::cache(false); |
|
| 137 | + \Aimeos\MShop::cache( false ); |
|
| 138 | + \Aimeos\MAdmin::cache( false ); |
|
| 139 | 139 | |
| 140 | - $site = \Aimeos\Aimeos\Base::getExtConfig('siteCode', 'default'); |
|
| 141 | - $template = \Aimeos\Aimeos\Base::getExtConfig('siteTpl', 'default'); |
|
| 140 | + $site = \Aimeos\Aimeos\Base::getExtConfig( 'siteCode', 'default' ); |
|
| 141 | + $template = \Aimeos\Aimeos\Base::getExtConfig( 'siteTpl', 'default' ); |
|
| 142 | 142 | |
| 143 | 143 | $boostrap = \Aimeos\Aimeos\Base::aimeos(); |
| 144 | - $ctx = self::context(['setup' => ['default' => ['demo' => (string) $demo]]])->setEditor('setup'); |
|
| 144 | + $ctx = self::context( ['setup' => ['default' => ['demo' => (string) $demo]]] )->setEditor( 'setup' ); |
|
| 145 | 145 | |
| 146 | - \Aimeos\Setup::use($boostrap)->verbose('vvv') |
|
| 147 | - ->context($ctx->setEditor('aimeos:setup')) |
|
| 148 | - ->up($site, $template); |
|
| 146 | + \Aimeos\Setup::use( $boostrap )->verbose( 'vvv' ) |
|
| 147 | + ->context( $ctx->setEditor( 'aimeos:setup' ) ) |
|
| 148 | + ->up( $site, $template ); |
|
| 149 | 149 | |
| 150 | - if (defined('TYPO3_version') && version_compare(constant('TYPO3_version'), '11.0.0', '<')) { |
|
| 151 | - $extconf->set('aimeos', 'useDemoData', ''); |
|
| 150 | + if( defined( 'TYPO3_version' ) && version_compare( constant( 'TYPO3_version' ), '11.0.0', '<' ) ) { |
|
| 151 | + $extconf->set( 'aimeos', 'useDemoData', '' ); |
|
| 152 | 152 | } else { |
| 153 | - $extconf->set('aimeos', ['useDemoData' => '']); |
|
| 153 | + $extconf->set( 'aimeos', ['useDemoData' => ''] ); |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
@@ -161,27 +161,27 @@ discard block |
||
| 161 | 161 | * @param array $sql List of SQL statements |
| 162 | 162 | * @return array SQL statements required for the install tool |
| 163 | 163 | */ |
| 164 | - public static function schema(array $sql) : array |
|
| 164 | + public static function schema( array $sql ) : array |
|
| 165 | 165 | { |
| 166 | 166 | $tables = []; |
| 167 | 167 | $conn = self::context()->db(); |
| 168 | 168 | |
| 169 | - foreach (['fe_users_', 'madmin_', 'mshop_'] as $prefix) { |
|
| 170 | - $result = $conn->create('SHOW TABLES like \'' . $prefix . '%\'')->execute(); |
|
| 169 | + foreach( ['fe_users_', 'madmin_', 'mshop_'] as $prefix ) { |
|
| 170 | + $result = $conn->create( 'SHOW TABLES like \'' . $prefix . '%\'' )->execute(); |
|
| 171 | 171 | |
| 172 | - while (($row = $result->fetch(\Aimeos\Base\DB\Result\Base::FETCH_NUM)) !== null) { |
|
| 172 | + while( ( $row = $result->fetch( \Aimeos\Base\DB\Result\Base::FETCH_NUM ) ) !== null ) { |
|
| 173 | 173 | $tables[] = $row[0]; |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - foreach ($tables as $table) { |
|
| 178 | - $result = $conn->create('SHOW CREATE TABLE ' . $table)->execute(); |
|
| 177 | + foreach( $tables as $table ) { |
|
| 178 | + $result = $conn->create( 'SHOW CREATE TABLE ' . $table )->execute(); |
|
| 179 | 179 | |
| 180 | - while (($row = $result->fetch(\Aimeos\Base\DB\Result\Base::FETCH_NUM)) !== null) { |
|
| 181 | - $str = preg_replace('/,[\n ]*CONSTRAINT.+CASCADE/', '', $row[1]); |
|
| 182 | - $str = preg_replace('/ DEFAULT CHARSET=[^ ;]+/', '', $str); |
|
| 183 | - $str = preg_replace('/ COLLATE=[^ ;]+/', '', $str); |
|
| 184 | - $str = str_replace('"', '`', $str); |
|
| 180 | + while( ( $row = $result->fetch( \Aimeos\Base\DB\Result\Base::FETCH_NUM ) ) !== null ) { |
|
| 181 | + $str = preg_replace( '/,[\n ]*CONSTRAINT.+CASCADE/', '', $row[1] ); |
|
| 182 | + $str = preg_replace( '/ DEFAULT CHARSET=[^ ;]+/', '', $str ); |
|
| 183 | + $str = preg_replace( '/ COLLATE=[^ ;]+/', '', $str ); |
|
| 184 | + $str = str_replace( '"', '`', $str ); |
|
| 185 | 185 | |
| 186 | 186 | $sql[] = $str . ";\n"; |
| 187 | 187 | } |
@@ -196,9 +196,9 @@ discard block |
||
| 196 | 196 | * |
| 197 | 197 | * @param string|null $extname Installed extension name |
| 198 | 198 | */ |
| 199 | - public static function executeOnSignal(string $extname = null) |
|
| 199 | + public static function executeOnSignal( string $extname = null ) |
|
| 200 | 200 | { |
| 201 | - self::signal($extname); |
|
| 201 | + self::signal( $extname ); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
@@ -207,9 +207,9 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @param string|null $extname Installed extension name |
| 209 | 209 | */ |
| 210 | - public static function signal(string $extname = null) |
|
| 210 | + public static function signal( string $extname = null ) |
|
| 211 | 211 | { |
| 212 | - if ($extname === 'aimeos' && \Aimeos\Aimeos\Base::getExtConfig('autoSetup', true)) { |
|
| 212 | + if( $extname === 'aimeos' && \Aimeos\Aimeos\Base::getExtConfig( 'autoSetup', true ) ) { |
|
| 213 | 213 | self::execute(); |
| 214 | 214 | } |
| 215 | 215 | } |
@@ -220,12 +220,12 @@ discard block |
||
| 220 | 220 | * |
| 221 | 221 | * @param AlterTableDefinitionStatementsEvent $event Event object |
| 222 | 222 | */ |
| 223 | - public function schemaEvent(AlterTableDefinitionStatementsEvent $event) |
|
| 223 | + public function schemaEvent( AlterTableDefinitionStatementsEvent $event ) |
|
| 224 | 224 | { |
| 225 | - $list = self::schema([]); |
|
| 225 | + $list = self::schema( [] ); |
|
| 226 | 226 | |
| 227 | - foreach ($list['sqlString'] ?? [] as $sql) { |
|
| 228 | - $event->addSqlData($sql); |
|
| 227 | + foreach( $list['sqlString'] ?? [] as $sql ) { |
|
| 228 | + $event->addSqlData( $sql ); |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
@@ -235,9 +235,9 @@ discard block |
||
| 235 | 235 | * |
| 236 | 236 | * @param AfterPackageActivationEvent $event Event object |
| 237 | 237 | */ |
| 238 | - public function setupEvent(AfterPackageActivationEvent $event) |
|
| 238 | + public function setupEvent( AfterPackageActivationEvent $event ) |
|
| 239 | 239 | { |
| 240 | - if ($event->getPackageKey() === 'aimeos' && \Aimeos\Aimeos\Base::getExtConfig('autoSetup', true)) { |
|
| 240 | + if( $event->getPackageKey() === 'aimeos' && \Aimeos\Aimeos\Base::getExtConfig( 'autoSetup', true ) ) { |
|
| 241 | 241 | self::execute(); |
| 242 | 242 | } |
| 243 | 243 | } |
@@ -249,34 +249,34 @@ discard block |
||
| 249 | 249 | * @param array $config Nested array of configuration settings |
| 250 | 250 | * @return \Aimeos\MShop\ContextIface Context object |
| 251 | 251 | */ |
| 252 | - protected static function context(array $config = []) : \Aimeos\MShop\ContextIface |
|
| 252 | + protected static function context( array $config = [] ) : \Aimeos\MShop\ContextIface |
|
| 253 | 253 | { |
| 254 | - $aimeosExtPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('aimeos'); |
|
| 254 | + $aimeosExtPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath( 'aimeos' ); |
|
| 255 | 255 | |
| 256 | - if (file_exists($aimeosExtPath . '/Resources/Libraries/autoload.php') === true) { |
|
| 256 | + if( file_exists( $aimeosExtPath . '/Resources/Libraries/autoload.php' ) === true ) { |
|
| 257 | 257 | require_once $aimeosExtPath . '/Resources/Libraries/autoload.php'; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | $ctx = new \Aimeos\MShop\Context(); |
| 261 | - $conf = \Aimeos\Aimeos\Base::config($config); |
|
| 261 | + $conf = \Aimeos\Aimeos\Base::config( $config ); |
|
| 262 | 262 | |
| 263 | - $ctx->setConfig($conf); |
|
| 264 | - $ctx->setDatabaseManager(new \Aimeos\Base\DB\Manager\Standard($conf->get('resource', []), 'DBAL')); |
|
| 265 | - $ctx->setFilesystemManager(new \Aimeos\Base\Filesystem\Manager\Standard($conf->get('resource', []))); |
|
| 266 | - $ctx->setLogger(new \Aimeos\Base\Logger\Errorlog(\Aimeos\Base\Logger\Iface::INFO)); |
|
| 267 | - $ctx->setSession(new \Aimeos\Base\Session\None()); |
|
| 268 | - $ctx->setCache(new \Aimeos\Base\Cache\None()); |
|
| 263 | + $ctx->setConfig( $conf ); |
|
| 264 | + $ctx->setDatabaseManager( new \Aimeos\Base\DB\Manager\Standard( $conf->get( 'resource', [] ), 'DBAL' ) ); |
|
| 265 | + $ctx->setFilesystemManager( new \Aimeos\Base\Filesystem\Manager\Standard( $conf->get( 'resource', [] ) ) ); |
|
| 266 | + $ctx->setLogger( new \Aimeos\Base\Logger\Errorlog( \Aimeos\Base\Logger\Iface::INFO ) ); |
|
| 267 | + $ctx->setSession( new \Aimeos\Base\Session\None() ); |
|
| 268 | + $ctx->setCache( new \Aimeos\Base\Cache\None() ); |
|
| 269 | 269 | |
| 270 | 270 | // Reset before child processes are spawned to avoid lost DB connections afterwards (TYPO3 9.4 and above) |
| 271 | - if (php_sapi_name() === 'cli' && class_exists('\TYPO3\CMS\Core\Database\ConnectionPool') |
|
| 272 | - && method_exists('\TYPO3\CMS\Core\Database\ConnectionPool', 'resetConnections') |
|
| 271 | + if( php_sapi_name() === 'cli' && class_exists( '\TYPO3\CMS\Core\Database\ConnectionPool' ) |
|
| 272 | + && method_exists( '\TYPO3\CMS\Core\Database\ConnectionPool', 'resetConnections' ) |
|
| 273 | 273 | ) { |
| 274 | - $ctx->setProcess(new \Aimeos\Base\Process\Pcntl(\Aimeos\Aimeos\Base::getExtConfig('pcntlMax', 4))); |
|
| 274 | + $ctx->setProcess( new \Aimeos\Base\Process\Pcntl( \Aimeos\Aimeos\Base::getExtConfig( 'pcntlMax', 4 ) ) ); |
|
| 275 | 275 | } else { |
| 276 | - $ctx->setProcess(new \Aimeos\Base\Process\None()); |
|
| 276 | + $ctx->setProcess( new \Aimeos\Base\Process\None() ); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - $factory = GeneralUtility::makeInstance('TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory'); |
|
| 280 | - return $ctx->setPassword(new \Aimeos\Base\Password\Typo3($factory->getDefaultHashInstance('FE'))); |
|
| 279 | + $factory = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory' ); |
|
| 280 | + return $ctx->setPassword( new \Aimeos\Base\Password\Typo3( $factory->getDefaultHashInstance( 'FE' ) ) ); |
|
| 281 | 281 | } |
| 282 | 282 | } |