@@ -6,12 +6,12 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | |
| 9 | -if( php_sapi_name() != 'cli' ) { |
|
| 10 | - exit( 'Setup can only be started via command line for security reasons' ); |
|
| 9 | +if (php_sapi_name() != 'cli') { |
|
| 10 | + exit('Setup can only be started via command line for security reasons'); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | -ini_set( 'display_errors', 1 ); |
|
| 14 | -date_default_timezone_set( 'UTC' ); |
|
| 13 | +ini_set('display_errors', 1); |
|
| 14 | +date_default_timezone_set('UTC'); |
|
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | |
@@ -21,35 +21,35 @@ discard block |
||
| 21 | 21 | * @param array &$params List of parameters |
| 22 | 22 | * @return array Associative list of option name and value(s) |
| 23 | 23 | */ |
| 24 | -function getOptions( array &$params ) |
|
| 24 | +function getOptions(array &$params) |
|
| 25 | 25 | { |
| 26 | 26 | $options = array(); |
| 27 | 27 | |
| 28 | - foreach( $params as $key => $option ) |
|
| 28 | + foreach ($params as $key => $option) |
|
| 29 | 29 | { |
| 30 | - if( $option === '--help' ) { |
|
| 30 | + if ($option === '--help') { |
|
| 31 | 31 | usage(); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if( strncmp( $option, '--', 2 ) === 0 && ( $pos = strpos( $option, '=', 2 ) ) !== false ) |
|
| 34 | + if (strncmp($option, '--', 2) === 0 && ($pos = strpos($option, '=', 2)) !== false) |
|
| 35 | 35 | { |
| 36 | - if( ( $name = substr( $option, 2, $pos - 2 ) ) !== false ) |
|
| 36 | + if (($name = substr($option, 2, $pos - 2)) !== false) |
|
| 37 | 37 | { |
| 38 | - if( isset( $options[$name] ) ) |
|
| 38 | + if (isset($options[$name])) |
|
| 39 | 39 | { |
| 40 | 40 | $options[$name] = (array) $options[$name]; |
| 41 | - $options[$name][] = substr( $option, $pos + 1 ); |
|
| 41 | + $options[$name][] = substr($option, $pos + 1); |
|
| 42 | 42 | } |
| 43 | 43 | else |
| 44 | 44 | { |
| 45 | - $options[$name] = substr( $option, $pos + 1 ); |
|
| 45 | + $options[$name] = substr($option, $pos + 1); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - unset( $params[$key] ); |
|
| 48 | + unset($params[$key]); |
|
| 49 | 49 | } |
| 50 | 50 | else |
| 51 | 51 | { |
| 52 | - printf( "Invalid option \"%1\$s\"\n", $option ); |
|
| 52 | + printf("Invalid option \"%1\$s\"\n", $option); |
|
| 53 | 53 | usage(); |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -66,32 +66,32 @@ discard block |
||
| 66 | 66 | * @param array $options Associative list of configuration options as key/value pairs |
| 67 | 67 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
| 68 | 68 | */ |
| 69 | -function getContext( array $confPaths, array $options ) |
|
| 69 | +function getContext(array $confPaths, array $options) |
|
| 70 | 70 | { |
| 71 | 71 | $config = array(); |
| 72 | 72 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
| 73 | 73 | |
| 74 | - if( isset( $options['config'] ) ) |
|
| 74 | + if (isset($options['config'])) |
|
| 75 | 75 | { |
| 76 | - foreach( (array) $options['config'] as $path ) |
|
| 76 | + foreach ((array) $options['config'] as $path) |
|
| 77 | 77 | { |
| 78 | - if( is_file( $path ) ) { |
|
| 79 | - $config = array_replace_recursive( $config, require $path ); |
|
| 78 | + if (is_file($path)) { |
|
| 79 | + $config = array_replace_recursive($config, require $path); |
|
| 80 | 80 | } else { |
| 81 | 81 | $confPaths[] = $path; |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $conf = new \Aimeos\MW\Config\PHPArray( $config, $confPaths ); |
|
| 87 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
| 88 | - $ctx->setConfig( $conf ); |
|
| 86 | + $conf = new \Aimeos\MW\Config\PHPArray($config, $confPaths); |
|
| 87 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
| 88 | + $ctx->setConfig($conf); |
|
| 89 | 89 | |
| 90 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
| 91 | - $ctx->setDatabaseManager( $dbm ); |
|
| 90 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
| 91 | + $ctx->setDatabaseManager($dbm); |
|
| 92 | 92 | |
| 93 | - $logger = new \Aimeos\MW\Logger\Errorlog( \Aimeos\MW\Logger\Base::INFO ); |
|
| 94 | - $ctx->setLogger( $logger ); |
|
| 93 | + $logger = new \Aimeos\MW\Logger\Errorlog(\Aimeos\MW\Logger\Base::INFO); |
|
| 94 | + $ctx->setLogger($logger); |
|
| 95 | 95 | |
| 96 | 96 | return $ctx; |
| 97 | 97 | } |
@@ -103,20 +103,20 @@ discard block |
||
| 103 | 103 | * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object |
| 104 | 104 | * @param string|null $sites List of site codes separated by a space |
| 105 | 105 | */ |
| 106 | -function getSiteItems( \Aimeos\MShop\Context\Item\Iface $ctx, $sites ) |
|
| 106 | +function getSiteItems(\Aimeos\MShop\Context\Item\Iface $ctx, $sites) |
|
| 107 | 107 | { |
| 108 | - $manager = \Aimeos\MShop\Factory::createManager( $ctx, 'locale/site' ); |
|
| 108 | + $manager = \Aimeos\MShop\Factory::createManager($ctx, 'locale/site'); |
|
| 109 | 109 | $search = $manager->createSearch(); |
| 110 | 110 | |
| 111 | - if( is_scalar( $sites ) && $sites != '' ) { |
|
| 112 | - $sites = explode( ' ', $sites ); |
|
| 111 | + if (is_scalar($sites) && $sites != '') { |
|
| 112 | + $sites = explode(' ', $sites); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if( !empty( $sites ) ) { |
|
| 116 | - $search->setConditions( $search->compare( '==', 'locale.site.code', $sites ) ); |
|
| 115 | + if (!empty($sites)) { |
|
| 116 | + $search->setConditions($search->compare('==', 'locale.site.code', $sites)); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - return $manager->searchItems( $search ); |
|
| 119 | + return $manager->searchItems($search); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
@@ -126,23 +126,23 @@ discard block |
||
| 126 | 126 | * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object |
| 127 | 127 | * @param array $siteItems List of site items implementing \Aimeos\MShop\Locale\Site\Iface |
| 128 | 128 | */ |
| 129 | -function clear( \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems ) |
|
| 129 | +function clear(\Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems) |
|
| 130 | 130 | { |
| 131 | - $localeManager = \Aimeos\MShop\Factory::createManager( $ctx, 'locale' ); |
|
| 131 | + $localeManager = \Aimeos\MShop\Factory::createManager($ctx, 'locale'); |
|
| 132 | 132 | |
| 133 | - foreach( $siteItems as $siteItem ) |
|
| 133 | + foreach ($siteItems as $siteItem) |
|
| 134 | 134 | { |
| 135 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
| 135 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
| 136 | 136 | |
| 137 | 137 | $lcontext = clone $ctx; |
| 138 | - $lcontext->setLocale( $localeItem ); |
|
| 138 | + $lcontext->setLocale($localeItem); |
|
| 139 | 139 | |
| 140 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext ); |
|
| 141 | - $lcontext->setCache( $cache ); |
|
| 140 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext); |
|
| 141 | + $lcontext->setCache($cache); |
|
| 142 | 142 | |
| 143 | - printf( "Clearing the Aimeos cache for site \"%1\$s\"\n", $siteItem->getCode() ); |
|
| 143 | + printf("Clearing the Aimeos cache for site \"%1\$s\"\n", $siteItem->getCode()); |
|
| 144 | 144 | |
| 145 | - \Aimeos\MAdmin\Cache\Manager\Factory::createManager( $lcontext )->getCache()->flush(); |
|
| 145 | + \Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->flush(); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
@@ -152,28 +152,28 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | function usage() |
| 154 | 154 | { |
| 155 | - printf( "Usage: php cache.php [--extdir=<path>]* [--config=<path>|<file>]* [\"sitecode1 [sitecode2]*\"]\n" ); |
|
| 156 | - exit( 1 ); |
|
| 155 | + printf("Usage: php cache.php [--extdir=<path>]* [--config=<path>|<file>]* [\"sitecode1 [sitecode2]*\"]\n"); |
|
| 156 | + exit(1); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | |
| 160 | 160 | try |
| 161 | 161 | { |
| 162 | 162 | $params = $_SERVER['argv']; |
| 163 | - array_shift( $params ); |
|
| 163 | + array_shift($params); |
|
| 164 | 164 | |
| 165 | - $options = getOptions( $params ); |
|
| 166 | - $sites = array_shift( $params ); |
|
| 165 | + $options = getOptions($params); |
|
| 166 | + $sites = array_shift($params); |
|
| 167 | 167 | |
| 168 | 168 | require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; |
| 169 | 169 | |
| 170 | - $aimeos = new \Aimeos\Bootstrap( ( isset( $options['extdir'] ) ? (array) $options['extdir'] : array() ) ); |
|
| 171 | - $ctx = getContext( $aimeos->getConfigPaths(), $options ); |
|
| 172 | - $siteItems = getSiteItems( $ctx, $sites ); |
|
| 170 | + $aimeos = new \Aimeos\Bootstrap((isset($options['extdir']) ? (array) $options['extdir'] : array())); |
|
| 171 | + $ctx = getContext($aimeos->getConfigPaths(), $options); |
|
| 172 | + $siteItems = getSiteItems($ctx, $sites); |
|
| 173 | 173 | |
| 174 | - clear( $ctx, $siteItems ); |
|
| 174 | + clear($ctx, $siteItems); |
|
| 175 | 175 | } |
| 176 | -catch( \Throwable $t ) |
|
| 176 | +catch (\Throwable $t) |
|
| 177 | 177 | { |
| 178 | 178 | echo "\n\nCaught PHP error while processing setup"; |
| 179 | 179 | echo "\n\nMessage:\n"; |
@@ -181,9 +181,9 @@ discard block |
||
| 181 | 181 | echo "\n\nStack trace:\n"; |
| 182 | 182 | echo $t->getTraceAsString(); |
| 183 | 183 | echo "\n\n"; |
| 184 | - exit( 1 ); |
|
| 184 | + exit(1); |
|
| 185 | 185 | } |
| 186 | -catch( \Exception $e ) |
|
| 186 | +catch (\Exception $e) |
|
| 187 | 187 | { |
| 188 | 188 | echo "\n\nCaught exception while processing setup"; |
| 189 | 189 | echo "\n\nMessage:\n"; |
@@ -191,5 +191,5 @@ discard block |
||
| 191 | 191 | echo "\n\nStack trace:\n"; |
| 192 | 192 | echo $e->getTraceAsString(); |
| 193 | 193 | echo "\n\n"; |
| 194 | - exit( 1 ); |
|
| 194 | + exit(1); |
|
| 195 | 195 | } |
@@ -39,15 +39,13 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | $options[$name] = (array) $options[$name]; |
| 41 | 41 | $options[$name][] = substr( $option, $pos + 1 ); |
| 42 | - } |
|
| 43 | - else |
|
| 42 | + } else |
|
| 44 | 43 | { |
| 45 | 44 | $options[$name] = substr( $option, $pos + 1 ); |
| 46 | 45 | } |
| 47 | 46 | |
| 48 | 47 | unset( $params[$key] ); |
| 49 | - } |
|
| 50 | - else |
|
| 48 | + } else |
|
| 51 | 49 | { |
| 52 | 50 | printf( "Invalid option \"%1\$s\"\n", $option ); |
| 53 | 51 | usage(); |
@@ -172,8 +170,7 @@ discard block |
||
| 172 | 170 | $siteItems = getSiteItems( $ctx, $sites ); |
| 173 | 171 | |
| 174 | 172 | clear( $ctx, $siteItems ); |
| 175 | -} |
|
| 176 | -catch( \Throwable $t ) |
|
| 173 | +} catch( \Throwable $t ) |
|
| 177 | 174 | { |
| 178 | 175 | echo "\n\nCaught PHP error while processing setup"; |
| 179 | 176 | echo "\n\nMessage:\n"; |
@@ -182,8 +179,7 @@ discard block |
||
| 182 | 179 | echo $t->getTraceAsString(); |
| 183 | 180 | echo "\n\n"; |
| 184 | 181 | exit( 1 ); |
| 185 | -} |
|
| 186 | -catch( \Exception $e ) |
|
| 182 | +} catch( \Exception $e ) |
|
| 187 | 183 | { |
| 188 | 184 | echo "\n\nCaught exception while processing setup"; |
| 189 | 185 | echo "\n\nMessage:\n"; |
@@ -6,12 +6,12 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | |
| 9 | -if( php_sapi_name() != 'cli' ) { |
|
| 10 | - exit( 'Setup can only be started via command line for security reasons' ); |
|
| 9 | +if (php_sapi_name() != 'cli') { |
|
| 10 | + exit('Setup can only be started via command line for security reasons'); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | -ini_set( 'display_errors', 1 ); |
|
| 14 | -date_default_timezone_set( 'UTC' ); |
|
| 13 | +ini_set('display_errors', 1); |
|
| 14 | +date_default_timezone_set('UTC'); |
|
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | |
@@ -21,35 +21,35 @@ discard block |
||
| 21 | 21 | * @param array &$params List of parameters |
| 22 | 22 | * @return array Associative list of option name and value(s) |
| 23 | 23 | */ |
| 24 | -function getOptions( array &$params ) |
|
| 24 | +function getOptions(array &$params) |
|
| 25 | 25 | { |
| 26 | 26 | $options = array(); |
| 27 | 27 | |
| 28 | - foreach( $params as $key => $option ) |
|
| 28 | + foreach ($params as $key => $option) |
|
| 29 | 29 | { |
| 30 | - if( $option === '--help' ) { |
|
| 30 | + if ($option === '--help') { |
|
| 31 | 31 | usage(); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if( strncmp( $option, '--', 2 ) === 0 && ( $pos = strpos( $option, '=', 2 ) ) !== false ) |
|
| 34 | + if (strncmp($option, '--', 2) === 0 && ($pos = strpos($option, '=', 2)) !== false) |
|
| 35 | 35 | { |
| 36 | - if( ( $name = substr( $option, 2, $pos - 2 ) ) !== false ) |
|
| 36 | + if (($name = substr($option, 2, $pos - 2)) !== false) |
|
| 37 | 37 | { |
| 38 | - if( isset( $options[$name] ) ) |
|
| 38 | + if (isset($options[$name])) |
|
| 39 | 39 | { |
| 40 | 40 | $options[$name] = (array) $options[$name]; |
| 41 | - $options[$name][] = substr( $option, $pos + 1 ); |
|
| 41 | + $options[$name][] = substr($option, $pos + 1); |
|
| 42 | 42 | } |
| 43 | 43 | else |
| 44 | 44 | { |
| 45 | - $options[$name] = substr( $option, $pos + 1 ); |
|
| 45 | + $options[$name] = substr($option, $pos + 1); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - unset( $params[$key] ); |
|
| 48 | + unset($params[$key]); |
|
| 49 | 49 | } |
| 50 | 50 | else |
| 51 | 51 | { |
| 52 | - printf( "Invalid option \"%1\$s\"\n", $option ); |
|
| 52 | + printf("Invalid option \"%1\$s\"\n", $option); |
|
| 53 | 53 | usage(); |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -65,16 +65,16 @@ discard block |
||
| 65 | 65 | * @param array $options Associative list of given options |
| 66 | 66 | * @return array Multi-dimensional array of configuration settings |
| 67 | 67 | */ |
| 68 | -function getConfig( array $options ) |
|
| 68 | +function getConfig(array $options) |
|
| 69 | 69 | { |
| 70 | 70 | $config = array(); |
| 71 | 71 | |
| 72 | - if( isset( $options['config'] ) ) |
|
| 72 | + if (isset($options['config'])) |
|
| 73 | 73 | { |
| 74 | - foreach( (array) $options['config'] as $path ) |
|
| 74 | + foreach ((array) $options['config'] as $path) |
|
| 75 | 75 | { |
| 76 | - if( is_file( $path ) ) { |
|
| 77 | - $config = array_replace_recursive( $config, require $path ); |
|
| 76 | + if (is_file($path)) { |
|
| 77 | + $config = array_replace_recursive($config, require $path); |
|
| 78 | 78 | } else { |
| 79 | 79 | $confPaths[] = $path; |
| 80 | 80 | } |
@@ -91,25 +91,25 @@ discard block |
||
| 91 | 91 | * @param \Interop\Container\ContainerInterface $container Dependency injection container |
| 92 | 92 | * @return \Aimeos\MShop\Context\Item\Standard Context object |
| 93 | 93 | */ |
| 94 | -function getContext( \Interop\Container\ContainerInterface $container ) |
|
| 94 | +function getContext(\Interop\Container\ContainerInterface $container) |
|
| 95 | 95 | { |
| 96 | - $aimeos = $container->get( 'aimeos' ); |
|
| 97 | - $context = $container->get( 'aimeos_context' )->get( false ); |
|
| 96 | + $aimeos = $container->get('aimeos'); |
|
| 97 | + $context = $container->get('aimeos_context')->get(false); |
|
| 98 | 98 | |
| 99 | 99 | $env = \Slim\Http\Environment::mock(); |
| 100 | - $request = \Slim\Http\Request::createFromEnvironment( $env ); |
|
| 100 | + $request = \Slim\Http\Request::createFromEnvironment($env); |
|
| 101 | 101 | $response = new \Slim\Http\Response(); |
| 102 | 102 | |
| 103 | - $tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' ); |
|
| 104 | - $view = $container->get( 'aimeos_view' )->create( $request, $response, array(), $tmplPaths ); |
|
| 103 | + $tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates'); |
|
| 104 | + $view = $container->get('aimeos_view')->create($request, $response, array(), $tmplPaths); |
|
| 105 | 105 | |
| 106 | - $langManager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' ); |
|
| 107 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
| 108 | - $i18n = $container->get( 'aimeos_i18n' )->get( $langids ); |
|
| 106 | + $langManager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); |
|
| 107 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
| 108 | + $i18n = $container->get('aimeos_i18n')->get($langids); |
|
| 109 | 109 | |
| 110 | - $context->setEditor( 'aimeos:jobs' ); |
|
| 111 | - $context->setView( $view ); |
|
| 112 | - $context->setI18n( $i18n ); |
|
| 110 | + $context->setEditor('aimeos:jobs'); |
|
| 111 | + $context->setView($view); |
|
| 112 | + $context->setI18n($i18n); |
|
| 113 | 113 | |
| 114 | 114 | return $context; |
| 115 | 115 | } |
@@ -121,21 +121,21 @@ discard block |
||
| 121 | 121 | * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object |
| 122 | 122 | * @param string|null $sites List of site codes separated by a space |
| 123 | 123 | */ |
| 124 | -function getSiteItems( \Aimeos\MShop\Context\Item\Iface $ctx, $sites ) |
|
| 124 | +function getSiteItems(\Aimeos\MShop\Context\Item\Iface $ctx, $sites) |
|
| 125 | 125 | { |
| 126 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
| 127 | - $manager = $localeManager->getSubManager( 'site' ); |
|
| 126 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
| 127 | + $manager = $localeManager->getSubManager('site'); |
|
| 128 | 128 | $search = $manager->createSearch(); |
| 129 | 129 | |
| 130 | - if( is_scalar( $sites ) && $sites != '' ) { |
|
| 131 | - $sites = explode( ' ', $sites ); |
|
| 130 | + if (is_scalar($sites) && $sites != '') { |
|
| 131 | + $sites = explode(' ', $sites); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if( !empty( $sites ) ) { |
|
| 135 | - $search->setConditions( $search->compare( '==', 'locale.site.code', $sites ) ); |
|
| 134 | + if (!empty($sites)) { |
|
| 135 | + $search->setConditions($search->compare('==', 'locale.site.code', $sites)); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - return $manager->searchItems( $search ); |
|
| 138 | + return $manager->searchItems($search); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | |
@@ -146,19 +146,19 @@ discard block |
||
| 146 | 146 | * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object |
| 147 | 147 | * @param array $siteItems List of site items implementing \Aimeos\MShop\Locale\Site\Iface |
| 148 | 148 | */ |
| 149 | -function execute( \Aimeos\Bootstrap $aimeos, \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems, $jobs ) |
|
| 149 | +function execute(\Aimeos\Bootstrap $aimeos, \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems, $jobs) |
|
| 150 | 150 | { |
| 151 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
| 151 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
| 152 | 152 | |
| 153 | - foreach( $siteItems as $siteItem ) |
|
| 153 | + foreach ($siteItems as $siteItem) |
|
| 154 | 154 | { |
| 155 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), 'en', '', false ); |
|
| 156 | - $ctx->setLocale( $localeItem ); |
|
| 155 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false); |
|
| 156 | + $ctx->setLocale($localeItem); |
|
| 157 | 157 | |
| 158 | - printf( "Executing the Aimeos jobs for \"%s\"\n", $siteItem->getCode() ); |
|
| 158 | + printf("Executing the Aimeos jobs for \"%s\"\n", $siteItem->getCode()); |
|
| 159 | 159 | |
| 160 | - foreach( (array) explode( ' ', $jobs ) as $jobname ) { |
|
| 161 | - \Aimeos\Controller\Jobs\Factory::createController( $ctx, $aimeos, $jobname )->run(); |
|
| 160 | + foreach ((array) explode(' ', $jobs) as $jobname) { |
|
| 161 | + \Aimeos\Controller\Jobs\Factory::createController($ctx, $aimeos, $jobname)->run(); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | } |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | function usage() |
| 171 | 171 | { |
| 172 | - printf( "Usage: php job.php [--extdir=<path>]* [--config=<path>|<file>]* \"job1 [job2]*\" [\"sitecode1 [sitecode2]*\"]\n" ); |
|
| 173 | - exit( 1 ); |
|
| 172 | + printf("Usage: php job.php [--extdir=<path>]* [--config=<path>|<file>]* \"job1 [job2]*\" [\"sitecode1 [sitecode2]*\"]\n"); |
|
| 173 | + exit(1); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | |
@@ -178,30 +178,30 @@ discard block |
||
| 178 | 178 | try |
| 179 | 179 | { |
| 180 | 180 | $params = $_SERVER['argv']; |
| 181 | - array_shift( $params ); |
|
| 181 | + array_shift($params); |
|
| 182 | 182 | |
| 183 | - $options = getOptions( $params ); |
|
| 183 | + $options = getOptions($params); |
|
| 184 | 184 | |
| 185 | - if( ( $jobs = array_shift( $params ) ) === null ) { |
|
| 185 | + if (($jobs = array_shift($params)) === null) { |
|
| 186 | 186 | usage(); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - $sites = array_shift( $params ); |
|
| 190 | - $config = getConfig( $options ); |
|
| 189 | + $sites = array_shift($params); |
|
| 190 | + $config = getConfig($options); |
|
| 191 | 191 | |
| 192 | 192 | require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; |
| 193 | 193 | |
| 194 | - $app = new \Slim\App( $config ); |
|
| 195 | - $aimeos = new \Aimeos\Slim\Bootstrap( $app, $config ); |
|
| 196 | - $aimeos->setup( ( isset( $options['extdir'] ) ? $options['extdir'] : './ext' ) ); |
|
| 194 | + $app = new \Slim\App($config); |
|
| 195 | + $aimeos = new \Aimeos\Slim\Bootstrap($app, $config); |
|
| 196 | + $aimeos->setup((isset($options['extdir']) ? $options['extdir'] : './ext')); |
|
| 197 | 197 | |
| 198 | 198 | $container = $app->getContainer(); |
| 199 | - $context = getContext( $container ); |
|
| 199 | + $context = getContext($container); |
|
| 200 | 200 | |
| 201 | - $siteItems = getSiteItems( $context, $sites ); |
|
| 202 | - execute( $container->get( 'aimeos' ), $context, $siteItems, $jobs ); |
|
| 201 | + $siteItems = getSiteItems($context, $sites); |
|
| 202 | + execute($container->get('aimeos'), $context, $siteItems, $jobs); |
|
| 203 | 203 | } |
| 204 | -catch( \Throwable $t ) |
|
| 204 | +catch (\Throwable $t) |
|
| 205 | 205 | { |
| 206 | 206 | echo "\n\nCaught PHP error while processing setup"; |
| 207 | 207 | echo "\n\nMessage:\n"; |
@@ -209,9 +209,9 @@ discard block |
||
| 209 | 209 | echo "\n\nStack trace:\n"; |
| 210 | 210 | echo $t->getTraceAsString(); |
| 211 | 211 | echo "\n\n"; |
| 212 | - exit( 1 ); |
|
| 212 | + exit(1); |
|
| 213 | 213 | } |
| 214 | -catch( \Exception $e ) |
|
| 214 | +catch (\Exception $e) |
|
| 215 | 215 | { |
| 216 | 216 | echo "\n\nCaught exception while processing setup"; |
| 217 | 217 | echo "\n\nMessage:\n"; |
@@ -219,5 +219,5 @@ discard block |
||
| 219 | 219 | echo "\n\nStack trace:\n"; |
| 220 | 220 | echo $e->getTraceAsString(); |
| 221 | 221 | echo "\n\n"; |
| 222 | - exit( 1 ); |
|
| 222 | + exit(1); |
|
| 223 | 223 | } |
@@ -39,15 +39,13 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | $options[$name] = (array) $options[$name]; |
| 41 | 41 | $options[$name][] = substr( $option, $pos + 1 ); |
| 42 | - } |
|
| 43 | - else |
|
| 42 | + } else |
|
| 44 | 43 | { |
| 45 | 44 | $options[$name] = substr( $option, $pos + 1 ); |
| 46 | 45 | } |
| 47 | 46 | |
| 48 | 47 | unset( $params[$key] ); |
| 49 | - } |
|
| 50 | - else |
|
| 48 | + } else |
|
| 51 | 49 | { |
| 52 | 50 | printf( "Invalid option \"%1\$s\"\n", $option ); |
| 53 | 51 | usage(); |
@@ -200,8 +198,7 @@ discard block |
||
| 200 | 198 | |
| 201 | 199 | $siteItems = getSiteItems( $context, $sites ); |
| 202 | 200 | execute( $container->get( 'aimeos' ), $context, $siteItems, $jobs ); |
| 203 | -} |
|
| 204 | -catch( \Throwable $t ) |
|
| 201 | +} catch( \Throwable $t ) |
|
| 205 | 202 | { |
| 206 | 203 | echo "\n\nCaught PHP error while processing setup"; |
| 207 | 204 | echo "\n\nMessage:\n"; |
@@ -210,8 +207,7 @@ discard block |
||
| 210 | 207 | echo $t->getTraceAsString(); |
| 211 | 208 | echo "\n\n"; |
| 212 | 209 | exit( 1 ); |
| 213 | -} |
|
| 214 | -catch( \Exception $e ) |
|
| 210 | +} catch( \Exception $e ) |
|
| 215 | 211 | { |
| 216 | 212 | echo "\n\nCaught exception while processing setup"; |
| 217 | 213 | echo "\n\nMessage:\n"; |