@@ -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,40 +161,40 @@ 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 | $ctx = self::getContext(); |
| 167 | 167 | $dbm = $ctx->getDatabaseManager(); |
| 168 | - $connectionNames = array_keys($ctx->getConfig()->get( 'resource')); |
|
| 169 | - $connectionNames = array_filter($connectionNames, fn (string $key): bool => str_starts_with($key, 'db')); |
|
| 168 | + $connectionNames = array_keys( $ctx->getConfig()->get( 'resource' ) ); |
|
| 169 | + $connectionNames = array_filter( $connectionNames, fn ( string $key ): bool => str_starts_with( $key, 'db' ) ); |
|
| 170 | 170 | |
| 171 | - foreach ($connectionNames as $connectionName) { |
|
| 172 | - $conn = $dbm->acquire($connectionName); |
|
| 171 | + foreach( $connectionNames as $connectionName ) { |
|
| 172 | + $conn = $dbm->acquire( $connectionName ); |
|
| 173 | 173 | |
| 174 | 174 | $tables = []; |
| 175 | 175 | |
| 176 | - foreach(['fe_users_', 'madmin_', 'mshop_'] as $prefix) { |
|
| 177 | - $result = $conn->create('SHOW TABLES like \'' . $prefix . '%\'')->execute(); |
|
| 176 | + foreach( ['fe_users_', 'madmin_', 'mshop_'] as $prefix ) { |
|
| 177 | + $result = $conn->create( 'SHOW TABLES like \'' . $prefix . '%\'' )->execute(); |
|
| 178 | 178 | |
| 179 | - while(($row = $result->fetch(\Aimeos\Base\DB\Result\Base::FETCH_NUM)) !== null) { |
|
| 179 | + while( ( $row = $result->fetch( \Aimeos\Base\DB\Result\Base::FETCH_NUM ) ) !== null ) { |
|
| 180 | 180 | $tables[] = $row[0]; |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - foreach($tables as $table) { |
|
| 185 | - $result = $conn->create('SHOW CREATE TABLE `' . $table . '`')->execute(); |
|
| 184 | + foreach( $tables as $table ) { |
|
| 185 | + $result = $conn->create( 'SHOW CREATE TABLE `' . $table . '`' )->execute(); |
|
| 186 | 186 | |
| 187 | - while(($row = $result->fetch(\Aimeos\Base\DB\Result\Base::FETCH_NUM)) !== null) { |
|
| 187 | + while( ( $row = $result->fetch( \Aimeos\Base\DB\Result\Base::FETCH_NUM ) ) !== null ) { |
|
| 188 | 188 | $str = $row[1]; |
| 189 | 189 | |
| 190 | - $str = str_replace('"', '`', $str); |
|
| 191 | - $str = preg_replace('#CONSTRAINT `[a-zA-Z0-9_-]+` #', '', $str); |
|
| 190 | + $str = str_replace( '"', '`', $str ); |
|
| 191 | + $str = preg_replace( '#CONSTRAINT `[a-zA-Z0-9_-]+` #', '', $str ); |
|
| 192 | 192 | |
| 193 | 193 | $sql[] = $str . ";\n"; |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - $dbm->release($conn); |
|
| 197 | + $dbm->release( $conn ); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | return ['sqlString' => $sql]; |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @param string|null $extname Installed extension name |
| 208 | 208 | */ |
| 209 | - public static function executeOnSignal(string $extname = null) |
|
| 209 | + public static function executeOnSignal( string $extname = null ) |
|
| 210 | 210 | { |
| 211 | - self::signal($extname); |
|
| 211 | + self::signal( $extname ); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | |
@@ -217,9 +217,9 @@ discard block |
||
| 217 | 217 | * |
| 218 | 218 | * @param string|null $extname Installed extension name |
| 219 | 219 | */ |
| 220 | - public static function signal(string $extname = null) |
|
| 220 | + public static function signal( string $extname = null ) |
|
| 221 | 221 | { |
| 222 | - if ($extname === 'aimeos' && \Aimeos\Aimeos\Base::getExtConfig('autoSetup', true)) { |
|
| 222 | + if( $extname === 'aimeos' && \Aimeos\Aimeos\Base::getExtConfig( 'autoSetup', true ) ) { |
|
| 223 | 223 | self::execute(); |
| 224 | 224 | } |
| 225 | 225 | } |
@@ -230,12 +230,12 @@ discard block |
||
| 230 | 230 | * |
| 231 | 231 | * @param AlterTableDefinitionStatementsEvent $event Event object |
| 232 | 232 | */ |
| 233 | - public function schemaEvent(AlterTableDefinitionStatementsEvent $event) |
|
| 233 | + public function schemaEvent( AlterTableDefinitionStatementsEvent $event ) |
|
| 234 | 234 | { |
| 235 | - $list = self::schema([]); |
|
| 235 | + $list = self::schema( [] ); |
|
| 236 | 236 | |
| 237 | - foreach ($list['sqlString'] ?? [] as $sql) { |
|
| 238 | - $event->addSqlData($sql); |
|
| 237 | + foreach( $list['sqlString'] ?? [] as $sql ) { |
|
| 238 | + $event->addSqlData( $sql ); |
|
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | |
@@ -245,9 +245,9 @@ discard block |
||
| 245 | 245 | * |
| 246 | 246 | * @param AfterPackageActivationEvent $event Event object |
| 247 | 247 | */ |
| 248 | - public function setupEvent(AfterPackageActivationEvent $event) |
|
| 248 | + public function setupEvent( AfterPackageActivationEvent $event ) |
|
| 249 | 249 | { |
| 250 | - if ($event->getPackageKey() === 'aimeos' && \Aimeos\Aimeos\Base::getExtConfig('autoSetup', true)) { |
|
| 250 | + if( $event->getPackageKey() === 'aimeos' && \Aimeos\Aimeos\Base::getExtConfig( 'autoSetup', true ) ) { |
|
| 251 | 251 | self::execute(); |
| 252 | 252 | } |
| 253 | 253 | } |
@@ -259,34 +259,34 @@ discard block |
||
| 259 | 259 | * @param array $config Nested array of configuration settings |
| 260 | 260 | * @return \Aimeos\MShop\ContextIface Context object |
| 261 | 261 | */ |
| 262 | - protected static function context(array $config = []) : \Aimeos\MShop\ContextIface |
|
| 262 | + protected static function context( array $config = [] ) : \Aimeos\MShop\ContextIface |
|
| 263 | 263 | { |
| 264 | - $aimeosExtPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('aimeos'); |
|
| 264 | + $aimeosExtPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath( 'aimeos' ); |
|
| 265 | 265 | |
| 266 | - if (file_exists($aimeosExtPath . '/Resources/Libraries/autoload.php') === true) { |
|
| 266 | + if( file_exists( $aimeosExtPath . '/Resources/Libraries/autoload.php' ) === true ) { |
|
| 267 | 267 | require_once $aimeosExtPath . '/Resources/Libraries/autoload.php'; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | $ctx = new \Aimeos\MShop\Context(); |
| 271 | - $conf = \Aimeos\Aimeos\Base::config($config); |
|
| 271 | + $conf = \Aimeos\Aimeos\Base::config( $config ); |
|
| 272 | 272 | |
| 273 | - $ctx->setConfig($conf); |
|
| 274 | - $ctx->setDatabaseManager(new \Aimeos\Base\DB\Manager\Standard($conf->get('resource', []), 'DBAL')); |
|
| 275 | - $ctx->setFilesystemManager(new \Aimeos\Base\Filesystem\Manager\Standard($conf->get('resource', []))); |
|
| 276 | - $ctx->setLogger(new \Aimeos\Base\Logger\Errorlog(\Aimeos\Base\Logger\Iface::INFO)); |
|
| 277 | - $ctx->setSession(new \Aimeos\Base\Session\None()); |
|
| 278 | - $ctx->setCache(new \Aimeos\Base\Cache\None()); |
|
| 273 | + $ctx->setConfig( $conf ); |
|
| 274 | + $ctx->setDatabaseManager( new \Aimeos\Base\DB\Manager\Standard( $conf->get( 'resource', [] ), 'DBAL' ) ); |
|
| 275 | + $ctx->setFilesystemManager( new \Aimeos\Base\Filesystem\Manager\Standard( $conf->get( 'resource', [] ) ) ); |
|
| 276 | + $ctx->setLogger( new \Aimeos\Base\Logger\Errorlog( \Aimeos\Base\Logger\Iface::INFO ) ); |
|
| 277 | + $ctx->setSession( new \Aimeos\Base\Session\None() ); |
|
| 278 | + $ctx->setCache( new \Aimeos\Base\Cache\None() ); |
|
| 279 | 279 | |
| 280 | 280 | // Reset before child processes are spawned to avoid lost DB connections afterwards (TYPO3 9.4 and above) |
| 281 | - if (php_sapi_name() === 'cli' && class_exists('\TYPO3\CMS\Core\Database\ConnectionPool') |
|
| 282 | - && method_exists('\TYPO3\CMS\Core\Database\ConnectionPool', 'resetConnections') |
|
| 281 | + if( php_sapi_name() === 'cli' && class_exists( '\TYPO3\CMS\Core\Database\ConnectionPool' ) |
|
| 282 | + && method_exists( '\TYPO3\CMS\Core\Database\ConnectionPool', 'resetConnections' ) |
|
| 283 | 283 | ) { |
| 284 | - $ctx->setProcess(new \Aimeos\Base\Process\Pcntl(\Aimeos\Aimeos\Base::getExtConfig('pcntlMax', 4))); |
|
| 284 | + $ctx->setProcess( new \Aimeos\Base\Process\Pcntl( \Aimeos\Aimeos\Base::getExtConfig( 'pcntlMax', 4 ) ) ); |
|
| 285 | 285 | } else { |
| 286 | - $ctx->setProcess(new \Aimeos\Base\Process\None()); |
|
| 286 | + $ctx->setProcess( new \Aimeos\Base\Process\None() ); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - $factory = GeneralUtility::makeInstance('TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory'); |
|
| 290 | - return $ctx->setPassword(new \Aimeos\Base\Password\Typo3($factory->getDefaultHashInstance('FE'))); |
|
| 289 | + $factory = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory' ); |
|
| 290 | + return $ctx->setPassword( new \Aimeos\Base\Password\Typo3( $factory->getDefaultHashInstance( 'FE' ) ) ); |
|
| 291 | 291 | } |
| 292 | 292 | } |