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