@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @param \Aimeos\Shop\Base\Context $context Context provider |
| 40 | 40 | * @param \Aimeos\Shop\Base\Locale $locale Locale provider |
| 41 | 41 | */ |
| 42 | - public function __construct( \Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\Locale $locale ) |
|
| 42 | + public function __construct(\Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\Locale $locale) |
|
| 43 | 43 | { |
| 44 | 44 | $this->context = $context; |
| 45 | 45 | $this->locale = $locale; |
@@ -53,45 +53,45 @@ discard block |
||
| 53 | 53 | * @param string|array $groupcodes Unique user/customer group codes that are allowed |
| 54 | 54 | * @return boolean True if user is part of the group, false if not |
| 55 | 55 | */ |
| 56 | - public function checkGroup( $userid, $groupcodes ) |
|
| 56 | + public function checkGroup($userid, $groupcodes) |
|
| 57 | 57 | { |
| 58 | - $site = ( Route::current() ? Route::input( 'site', Input::get( 'site', 'default' ) ) : 'default' ); |
|
| 58 | + $site = (Route::current() ? Route::input('site', Input::get('site', 'default')) : 'default'); |
|
| 59 | 59 | |
| 60 | - $context = $this->context->get( false ); |
|
| 61 | - $context->setLocale( $this->locale->getBackend( $context, $site ) ); |
|
| 60 | + $context = $this->context->get(false); |
|
| 61 | + $context->setLocale($this->locale->getBackend($context, $site)); |
|
| 62 | 62 | |
| 63 | 63 | |
| 64 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' ); |
|
| 64 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group'); |
|
| 65 | 65 | |
| 66 | 66 | $search = $manager->createSearch(); |
| 67 | - $search->setConditions( $search->compare( '==', 'customer.group.code', (array) $groupcodes ) ); |
|
| 68 | - $groupItems = $manager->searchItems( $search ); |
|
| 67 | + $search->setConditions($search->compare('==', 'customer.group.code', (array) $groupcodes)); |
|
| 68 | + $groupItems = $manager->searchItems($search); |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
| 71 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
| 72 | 72 | |
| 73 | 73 | $search = $manager->createSearch(); |
| 74 | 74 | $expr = array( |
| 75 | - $search->compare( '==', 'customer.lists.parentid', $userid ), |
|
| 76 | - $search->compare( '==', 'customer.lists.refid', array_keys( $groupItems ) ), |
|
| 77 | - $search->compare( '==', 'customer.lists.domain', 'customer/group' ), |
|
| 75 | + $search->compare('==', 'customer.lists.parentid', $userid), |
|
| 76 | + $search->compare('==', 'customer.lists.refid', array_keys($groupItems)), |
|
| 77 | + $search->compare('==', 'customer.lists.domain', 'customer/group'), |
|
| 78 | 78 | ); |
| 79 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 80 | - $search->setSlice( 0, 1 ); |
|
| 79 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 80 | + $search->setSlice(0, 1); |
|
| 81 | 81 | |
| 82 | - return (bool) count( $manager->searchItems( $search ) ); |
|
| 82 | + return (bool) count($manager->searchItems($search)); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
| 86 | - public function getGroups( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 86 | + public function getGroups(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 87 | 87 | { |
| 88 | 88 | $list = array(); |
| 89 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' ); |
|
| 89 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group'); |
|
| 90 | 90 | |
| 91 | 91 | $search = $manager->createSearch(); |
| 92 | - $search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) ); |
|
| 92 | + $search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds())); |
|
| 93 | 93 | |
| 94 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
| 94 | + foreach ($manager->searchItems($search) as $item) { |
|
| 95 | 95 | $list[] = $item->getCode(); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -35,19 +35,19 @@ discard block |
||
| 35 | 35 | * @param \Illuminate\Http\Request $request Request object |
| 36 | 36 | * @return \Illuminate\Http\Response Response object containing the generated output |
| 37 | 37 | */ |
| 38 | - public function deleteAction( Request $request ) |
|
| 38 | + public function deleteAction(Request $request) |
|
| 39 | 39 | { |
| 40 | - if( config( 'shop.authorize', true ) ) { |
|
| 41 | - $this->authorize( 'admin', [['admin', 'api']] ); |
|
| 40 | + if (config('shop.authorize', true)) { |
|
| 41 | + $this->authorize('admin', [['admin', 'api']]); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $status = 500; |
| 45 | 45 | $header = $request->headers->all(); |
| 46 | 46 | |
| 47 | 47 | $client = $this->createClient(); |
| 48 | - $result = $client->delete( (string) $request->getContent(), $header, $status ); |
|
| 48 | + $result = $client->delete((string) $request->getContent(), $header, $status); |
|
| 49 | 49 | |
| 50 | - return $this->createResponse( $result, $status, $header ); |
|
| 50 | + return $this->createResponse($result, $status, $header); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -57,19 +57,19 @@ discard block |
||
| 57 | 57 | * @param \Illuminate\Http\Request $request Request object |
| 58 | 58 | * @return \Illuminate\Http\Response Response object containing the generated output |
| 59 | 59 | */ |
| 60 | - public function getAction( Request $request ) |
|
| 60 | + public function getAction(Request $request) |
|
| 61 | 61 | { |
| 62 | - if( config( 'shop.authorize', true ) ) { |
|
| 63 | - $this->authorize( 'admin', [['admin', 'api', 'editor']] ); |
|
| 62 | + if (config('shop.authorize', true)) { |
|
| 63 | + $this->authorize('admin', [['admin', 'api', 'editor']]); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $status = 500; |
| 67 | 67 | $header = $request->headers->all(); |
| 68 | 68 | |
| 69 | 69 | $client = $this->createClient(); |
| 70 | - $result = $client->get( (string) $request->getContent(), $header, $status ); |
|
| 70 | + $result = $client->get((string) $request->getContent(), $header, $status); |
|
| 71 | 71 | |
| 72 | - return $this->createResponse( $result, $status, $header ); |
|
| 72 | + return $this->createResponse($result, $status, $header); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
@@ -79,19 +79,19 @@ discard block |
||
| 79 | 79 | * @param \Illuminate\Http\Request $request Request object |
| 80 | 80 | * @return \Illuminate\Http\Response Response object containing the generated output |
| 81 | 81 | */ |
| 82 | - public function patchAction( Request $request ) |
|
| 82 | + public function patchAction(Request $request) |
|
| 83 | 83 | { |
| 84 | - if( config( 'shop.authorize', true ) ) { |
|
| 85 | - $this->authorize( 'admin', [['admin', 'api']] ); |
|
| 84 | + if (config('shop.authorize', true)) { |
|
| 85 | + $this->authorize('admin', [['admin', 'api']]); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $status = 500; |
| 89 | 89 | $header = $request->headers->all(); |
| 90 | 90 | |
| 91 | 91 | $client = $this->createClient(); |
| 92 | - $result = $client->patch( (string) $request->getContent(), $header, $status ); |
|
| 92 | + $result = $client->patch((string) $request->getContent(), $header, $status); |
|
| 93 | 93 | |
| 94 | - return $this->createResponse( $result, $status, $header ); |
|
| 94 | + return $this->createResponse($result, $status, $header); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | |
@@ -101,19 +101,19 @@ discard block |
||
| 101 | 101 | * @param \Illuminate\Http\Request $request Request object |
| 102 | 102 | * @return \Illuminate\Http\Response Response object containing the generated output |
| 103 | 103 | */ |
| 104 | - public function postAction( Request $request ) |
|
| 104 | + public function postAction(Request $request) |
|
| 105 | 105 | { |
| 106 | - if( config( 'shop.authorize', true ) ) { |
|
| 107 | - $this->authorize( 'admin', [['admin', 'api']] ); |
|
| 106 | + if (config('shop.authorize', true)) { |
|
| 107 | + $this->authorize('admin', [['admin', 'api']]); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $status = 500; |
| 111 | 111 | $header = $request->headers->all(); |
| 112 | 112 | |
| 113 | 113 | $client = $this->createClient(); |
| 114 | - $result = $client->post( (string) $request->getContent(), $header, $status ); |
|
| 114 | + $result = $client->post((string) $request->getContent(), $header, $status); |
|
| 115 | 115 | |
| 116 | - return $this->createResponse( $result, $status, $header ); |
|
| 116 | + return $this->createResponse($result, $status, $header); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
@@ -123,19 +123,19 @@ discard block |
||
| 123 | 123 | * @param \Illuminate\Http\Request $request Request object |
| 124 | 124 | * @return \Illuminate\Http\Response Response object containing the generated output |
| 125 | 125 | */ |
| 126 | - public function putAction( Request $request ) |
|
| 126 | + public function putAction(Request $request) |
|
| 127 | 127 | { |
| 128 | - if( config( 'shop.authorize', true ) ) { |
|
| 129 | - $this->authorize( 'admin', [['admin', 'api']] ); |
|
| 128 | + if (config('shop.authorize', true)) { |
|
| 129 | + $this->authorize('admin', [['admin', 'api']]); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | $status = 500; |
| 133 | 133 | $header = $request->headers->all(); |
| 134 | 134 | |
| 135 | 135 | $client = $this->createClient(); |
| 136 | - $result = $client->put( (string) $request->getContent(), $header, $status ); |
|
| 136 | + $result = $client->put((string) $request->getContent(), $header, $status); |
|
| 137 | 137 | |
| 138 | - return $this->createResponse( $result, $status, $header ); |
|
| 138 | + return $this->createResponse($result, $status, $header); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | |
@@ -145,19 +145,19 @@ discard block |
||
| 145 | 145 | * @param \Illuminate\Http\Request $request Request object |
| 146 | 146 | * @return \Illuminate\Http\Response Response object containing the generated output |
| 147 | 147 | */ |
| 148 | - public function optionsAction( Request $request ) |
|
| 148 | + public function optionsAction(Request $request) |
|
| 149 | 149 | { |
| 150 | - if( config( 'shop.authorize', true ) ) { |
|
| 151 | - $this->authorize( 'admin', [['admin', 'api', 'editor']] ); |
|
| 150 | + if (config('shop.authorize', true)) { |
|
| 151 | + $this->authorize('admin', [['admin', 'api', 'editor']]); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | $status = 500; |
| 155 | 155 | $header = $request->headers->all(); |
| 156 | 156 | |
| 157 | 157 | $client = $this->createClient(); |
| 158 | - $result = $client->options( (string) $request->getContent(), $header, $status ); |
|
| 158 | + $result = $client->options((string) $request->getContent(), $header, $status); |
|
| 159 | 159 | |
| 160 | - return $this->createResponse( $result, $status, $header ); |
|
| 160 | + return $this->createResponse($result, $status, $header); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | |
@@ -168,19 +168,19 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | protected function createClient() |
| 170 | 170 | { |
| 171 | - $site = Route::input( 'site', Input::get( 'site', 'default' ) ); |
|
| 172 | - $lang = Input::get( 'lang', config( 'app.locale', 'en' ) ); |
|
| 173 | - $resource = Route::input( 'resource' ); |
|
| 171 | + $site = Route::input('site', Input::get('site', 'default')); |
|
| 172 | + $lang = Input::get('lang', config('app.locale', 'en')); |
|
| 173 | + $resource = Route::input('resource'); |
|
| 174 | 174 | |
| 175 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
| 176 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jsonadm/templates' ); |
|
| 175 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
| 176 | + $templatePaths = $aimeos->getCustomPaths('admin/jsonadm/templates'); |
|
| 177 | 177 | |
| 178 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false, 'backend' ); |
|
| 179 | - $context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang, 'en' ) ) ); |
|
| 180 | - $context->setLocale( app('\Aimeos\Shop\Base\Locale')->getBackend( $context, $site ) ); |
|
| 181 | - $context->setView( app( '\Aimeos\Shop\Base\View' )->create( $context, $templatePaths, $lang ) ); |
|
| 178 | + $context = app('\Aimeos\Shop\Base\Context')->get(false, 'backend'); |
|
| 179 | + $context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang, 'en'))); |
|
| 180 | + $context->setLocale(app('\Aimeos\Shop\Base\Locale')->getBackend($context, $site)); |
|
| 181 | + $context->setView(app('\Aimeos\Shop\Base\View')->create($context, $templatePaths, $lang)); |
|
| 182 | 182 | |
| 183 | - return \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
| 183 | + return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | * @param array $header List of HTTP headers |
| 193 | 193 | * @return \Illuminate\Http\Response HTTP response object |
| 194 | 194 | */ |
| 195 | - protected function createResponse( $content, $status, array $header ) |
|
| 195 | + protected function createResponse($content, $status, array $header) |
|
| 196 | 196 | { |
| 197 | - $response = Response::make( $content, $status ); |
|
| 197 | + $response = Response::make($content, $status); |
|
| 198 | 198 | |
| 199 | - foreach( $header as $key => $value ) { |
|
| 200 | - $response->header( $key, $value ); |
|
| 199 | + foreach ($header as $key => $value) { |
|
| 200 | + $response->header($key, $value); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return $response; |
@@ -42,24 +42,24 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function fire() |
| 44 | 44 | { |
| 45 | - $context = $this->getLaravel()->make( 'Aimeos\Shop\Base\Context' )->get( false, 'command' ); |
|
| 46 | - $context->setEditor( 'aimeos:cache' ); |
|
| 45 | + $context = $this->getLaravel()->make('Aimeos\Shop\Base\Context')->get(false, 'command'); |
|
| 46 | + $context->setEditor('aimeos:cache'); |
|
| 47 | 47 | |
| 48 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
| 48 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
| 49 | 49 | |
| 50 | - foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem ) |
|
| 50 | + foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem) |
|
| 51 | 51 | { |
| 52 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
| 52 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
| 53 | 53 | |
| 54 | 54 | $lcontext = clone $context; |
| 55 | - $lcontext->setLocale( $localeItem ); |
|
| 55 | + $lcontext->setLocale($localeItem); |
|
| 56 | 56 | |
| 57 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext ); |
|
| 58 | - $lcontext->setCache( $cache ); |
|
| 57 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext); |
|
| 58 | + $lcontext->setCache($cache); |
|
| 59 | 59 | |
| 60 | - $this->info( sprintf( 'Clearing the Aimeos cache for site "%1$s"', $siteItem->getCode() ) ); |
|
| 60 | + $this->info(sprintf('Clearing the Aimeos cache for site "%1$s"', $siteItem->getCode())); |
|
| 61 | 61 | |
| 62 | - \Aimeos\MAdmin\Cache\Manager\Factory::createManager( $lcontext )->getCache()->flush(); |
|
| 62 | + \Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->flush(); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | protected function getArguments() |
| 73 | 73 | { |
| 74 | 74 | return array( |
| 75 | - array( 'site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)' ), |
|
| 75 | + array('site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)'), |
|
| 76 | 76 | ); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -43,24 +43,24 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function fire() |
| 45 | 45 | { |
| 46 | - $aimeos = $this->getLaravel()->make( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
| 46 | + $aimeos = $this->getLaravel()->make('\Aimeos\Shop\Base\Aimeos')->get(); |
|
| 47 | 47 | $context = $this->getContext(); |
| 48 | 48 | |
| 49 | - $jobs = explode( ' ', $this->argument( 'jobs' ) ); |
|
| 50 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
| 49 | + $jobs = explode(' ', $this->argument('jobs')); |
|
| 50 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
| 51 | 51 | |
| 52 | - foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem ) |
|
| 52 | + foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem) |
|
| 53 | 53 | { |
| 54 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
| 55 | - $localeItem->setLanguageId( null ); |
|
| 56 | - $localeItem->setCurrencyId( null ); |
|
| 54 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
| 55 | + $localeItem->setLanguageId(null); |
|
| 56 | + $localeItem->setCurrencyId(null); |
|
| 57 | 57 | |
| 58 | - $context->setLocale( $localeItem ); |
|
| 58 | + $context->setLocale($localeItem); |
|
| 59 | 59 | |
| 60 | - $this->info( sprintf( 'Executing the Aimeos jobs for "%s"', $siteItem->getCode() ) ); |
|
| 60 | + $this->info(sprintf('Executing the Aimeos jobs for "%s"', $siteItem->getCode())); |
|
| 61 | 61 | |
| 62 | - foreach( $jobs as $jobname ) { |
|
| 63 | - \Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run(); |
|
| 62 | + foreach ($jobs as $jobname) { |
|
| 63 | + \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run(); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | protected function getArguments() |
| 75 | 75 | { |
| 76 | 76 | return array( |
| 77 | - array( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' ), |
|
| 78 | - array( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' ), |
|
| 77 | + array('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"'), |
|
| 78 | + array('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)'), |
|
| 79 | 79 | ); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -98,19 +98,19 @@ discard block |
||
| 98 | 98 | protected function getContext() |
| 99 | 99 | { |
| 100 | 100 | $lv = $this->getLaravel(); |
| 101 | - $aimeos = $lv->make( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
| 102 | - $context = $lv->make( '\Aimeos\Shop\Base\Context' )->get( false, 'command' ); |
|
| 101 | + $aimeos = $lv->make('\Aimeos\Shop\Base\Aimeos')->get(); |
|
| 102 | + $context = $lv->make('\Aimeos\Shop\Base\Context')->get(false, 'command'); |
|
| 103 | 103 | |
| 104 | - $tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' ); |
|
| 105 | - $view = $lv->make( '\Aimeos\Shop\Base\View' )->create( $context, $tmplPaths ); |
|
| 104 | + $tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates'); |
|
| 105 | + $view = $lv->make('\Aimeos\Shop\Base\View')->create($context, $tmplPaths); |
|
| 106 | 106 | |
| 107 | - $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' ); |
|
| 108 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
| 109 | - $i18n = $lv->make( '\Aimeos\Shop\Base\I18n' )->get( $langids ); |
|
| 107 | + $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language'); |
|
| 108 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
| 109 | + $i18n = $lv->make('\Aimeos\Shop\Base\I18n')->get($langids); |
|
| 110 | 110 | |
| 111 | - $context->setEditor( 'aimeos:jobs' ); |
|
| 112 | - $context->setView( $view ); |
|
| 113 | - $context->setI18n( $i18n ); |
|
| 111 | + $context->setEditor('aimeos:jobs'); |
|
| 112 | + $context->setView($view); |
|
| 113 | + $context->setI18n($i18n); |
|
| 114 | 114 | |
| 115 | 115 | return $context; |
| 116 | 116 | } |
@@ -43,39 +43,39 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function fire() |
| 45 | 45 | { |
| 46 | - $ctx = $this->getLaravel()->make( '\Aimeos\Shop\Base\Context' )->get( false, 'command' ); |
|
| 47 | - $ctx->setEditor( 'aimeos:setup' ); |
|
| 46 | + $ctx = $this->getLaravel()->make('\Aimeos\Shop\Base\Context')->get(false, 'command'); |
|
| 47 | + $ctx->setEditor('aimeos:setup'); |
|
| 48 | 48 | |
| 49 | 49 | $config = $ctx->getConfig(); |
| 50 | - $site = $this->argument( 'site' ); |
|
| 51 | - $template = $this->argument( 'tplsite' ); |
|
| 50 | + $site = $this->argument('site'); |
|
| 51 | + $template = $this->argument('tplsite'); |
|
| 52 | 52 | |
| 53 | - $config->set( 'setup/site', $site ); |
|
| 54 | - $dbconfig = $this->getDbConfig( $config ); |
|
| 55 | - $this->setOptions( $config ); |
|
| 53 | + $config->set('setup/site', $site); |
|
| 54 | + $dbconfig = $this->getDbConfig($config); |
|
| 55 | + $this->setOptions($config); |
|
| 56 | 56 | |
| 57 | - $taskPaths = $this->getLaravel()->make( '\Aimeos\Shop\Base\Aimeos' )->get()->getSetupPaths( $template ); |
|
| 58 | - $manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx ); |
|
| 57 | + $taskPaths = $this->getLaravel()->make('\Aimeos\Shop\Base\Aimeos')->get()->getSetupPaths($template); |
|
| 58 | + $manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx); |
|
| 59 | 59 | |
| 60 | - $this->info( sprintf( 'Initializing or updating the Aimeos database tables for site "%1$s"', $site ) ); |
|
| 60 | + $this->info(sprintf('Initializing or updating the Aimeos database tables for site "%1$s"', $site)); |
|
| 61 | 61 | |
| 62 | - if( ( $task = $this->option( 'task' ) ) && is_array( $task ) ) { |
|
| 63 | - $task = reset( $task ); |
|
| 62 | + if (($task = $this->option('task')) && is_array($task)) { |
|
| 63 | + $task = reset($task); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - switch( $this->option( 'action' ) ) |
|
| 66 | + switch ($this->option('action')) |
|
| 67 | 67 | { |
| 68 | 68 | case 'migrate': |
| 69 | - $manager->migrate( $task ); |
|
| 69 | + $manager->migrate($task); |
|
| 70 | 70 | break; |
| 71 | 71 | case 'rollback': |
| 72 | - $manager->rollback( $task ); |
|
| 72 | + $manager->rollback($task); |
|
| 73 | 73 | break; |
| 74 | 74 | case 'clean': |
| 75 | - $manager->clean( $task ); |
|
| 75 | + $manager->clean($task); |
|
| 76 | 76 | break; |
| 77 | 77 | default: |
| 78 | - throw new \Exception( sprintf( 'Invalid setup action "%1$s"', $this->option( 'action' ) ) ); |
|
| 78 | + throw new \Exception(sprintf('Invalid setup action "%1$s"', $this->option('action'))); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | protected function getArguments() |
| 89 | 89 | { |
| 90 | 90 | return array( |
| 91 | - array( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' ), |
|
| 92 | - array( 'tplsite', InputArgument::OPTIONAL, 'Site used as template for creating the new one', 'default' ), |
|
| 91 | + array('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default'), |
|
| 92 | + array('tplsite', InputArgument::OPTIONAL, 'Site used as template for creating the new one', 'default'), |
|
| 93 | 93 | ); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | protected function getOptions() |
| 103 | 103 | { |
| 104 | 104 | return array( |
| 105 | - array( 'option', null, InputOption::VALUE_REQUIRED, 'Setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() ), |
|
| 106 | - array( 'action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate' ), |
|
| 107 | - array( 'task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null ), |
|
| 105 | + array('option', null, InputOption::VALUE_REQUIRED, 'Setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array()), |
|
| 106 | + array('action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate'), |
|
| 107 | + array('task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null), |
|
| 108 | 108 | ); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | * @param \Aimeos\MW\Config\Iface $conf Config object |
| 116 | 116 | * @return array Multi-dimensional associative list of database configuration parameters |
| 117 | 117 | */ |
| 118 | - protected function getDbConfig( \Aimeos\MW\Config\Iface $conf ) |
|
| 118 | + protected function getDbConfig(\Aimeos\MW\Config\Iface $conf) |
|
| 119 | 119 | { |
| 120 | - $dbconfig = $conf->get( 'resource', array() ); |
|
| 120 | + $dbconfig = $conf->get('resource', array()); |
|
| 121 | 121 | |
| 122 | - foreach( $dbconfig as $rname => $dbconf ) |
|
| 122 | + foreach ($dbconfig as $rname => $dbconf) |
|
| 123 | 123 | { |
| 124 | - if( strncmp( $rname, 'db', 2 ) !== 0 ) { |
|
| 125 | - unset( $dbconfig[$rname] ); |
|
| 124 | + if (strncmp($rname, 'db', 2) !== 0) { |
|
| 125 | + unset($dbconfig[$rname]); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
@@ -137,12 +137,12 @@ discard block |
||
| 137 | 137 | * @param array Associative list of database configurations |
| 138 | 138 | * @throws \RuntimeException If the format of the options is invalid |
| 139 | 139 | */ |
| 140 | - protected function setOptions( \Aimeos\MW\Config\Iface $conf ) |
|
| 140 | + protected function setOptions(\Aimeos\MW\Config\Iface $conf) |
|
| 141 | 141 | { |
| 142 | - foreach( (array) $this->option( 'option' ) as $option ) |
|
| 142 | + foreach ((array) $this->option('option') as $option) |
|
| 143 | 143 | { |
| 144 | - list( $name, $value ) = explode( ':', $option ); |
|
| 145 | - $conf->set( str_replace( '\\', '/', $name ), $value ); |
|
| 144 | + list($name, $value) = explode(':', $option); |
|
| 145 | + $conf->set(str_replace('\\', '/', $name), $value); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | } |