@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Cache cleanup' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Cache cleanup'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Removes the expired entries from the cache' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Removes the expired entries from the cache'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,6 +51,6 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function run() |
53 | 53 | { |
54 | - \Aimeos\MAdmin\Cache\Manager\Factory::create( $this->getContext() )->getCache()->cleanup(); |
|
54 | + \Aimeos\MAdmin\Cache\Manager\Factory::create($this->getContext())->getCache()->cleanup(); |
|
55 | 55 | } |
56 | 56 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Log cleanup' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Log cleanup'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Removes the old log entries from the database and archives them (optional)' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Removes the old log entries from the database and archives them (optional)'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | * @see controller/jobs/admin/log/standard/container/format |
72 | 72 | * @see controller/jobs/admin/log/standard/container/options |
73 | 73 | */ |
74 | - $limit = $config->get( 'controller/jobs/admin/log/standard/limit-days', 30 ); |
|
75 | - $limitDate = date( 'Y-m-d H:i:s', time() - $limit * 86400 ); |
|
74 | + $limit = $config->get('controller/jobs/admin/log/standard/limit-days', 30); |
|
75 | + $limitDate = date('Y-m-d H:i:s', time() - $limit * 86400); |
|
76 | 76 | |
77 | 77 | /** controller/jobs/admin/log/standard/path |
78 | 78 | * Path to a writable directory where the log archive files should be stored |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @see controller/jobs/admin/log/standard/container/options |
102 | 102 | * @see controller/jobs/admin/log/standard/limit-days |
103 | 103 | */ |
104 | - if( ( $path = $config->get( 'controller/jobs/admin/log/standard/path', null ) ) !== null ) |
|
104 | + if (($path = $config->get('controller/jobs/admin/log/standard/path', null)) !== null) |
|
105 | 105 | { |
106 | 106 | /** controller/jobs/admin/log/standard/container/type |
107 | 107 | * Container file type storing all coupon code files to import |
@@ -175,19 +175,19 @@ discard block |
||
175 | 175 | * @see controller/jobs/admin/log/standard/limit-days |
176 | 176 | */ |
177 | 177 | |
178 | - $type = $config->get( 'controller/jobs/admin/log/standard/container/type', 'Zip' ); |
|
179 | - $format = $config->get( 'controller/jobs/admin/log/standard/container/format', 'CSV' ); |
|
180 | - $options = $config->get( 'controller/jobs/admin/log/standard/container/options', [] ); |
|
178 | + $type = $config->get('controller/jobs/admin/log/standard/container/type', 'Zip'); |
|
179 | + $format = $config->get('controller/jobs/admin/log/standard/container/format', 'CSV'); |
|
180 | + $options = $config->get('controller/jobs/admin/log/standard/container/options', []); |
|
181 | 181 | |
182 | - $path .= DIRECTORY_SEPARATOR . str_replace( ' ', '_', $limitDate ); |
|
183 | - $container = \Aimeos\MW\Container\Factory::getContainer( $path, $type, $format, $options ); |
|
182 | + $path .= DIRECTORY_SEPARATOR . str_replace(' ', '_', $limitDate); |
|
183 | + $container = \Aimeos\MW\Container\Factory::getContainer($path, $type, $format, $options); |
|
184 | 184 | } |
185 | 185 | |
186 | - $manager = \Aimeos\MAdmin::create( $context, 'log' ); |
|
186 | + $manager = \Aimeos\MAdmin::create($context, 'log'); |
|
187 | 187 | |
188 | 188 | $search = $manager->createSearch(); |
189 | - $search->setConditions( $search->compare( '<=', 'log.timestamp', $limitDate ) ); |
|
190 | - $search->setSortations( array( $search->sort( '+', 'log.timestamp' ) ) ); |
|
189 | + $search->setConditions($search->compare('<=', 'log.timestamp', $limitDate)); |
|
190 | + $search->setSortations(array($search->sort('+', 'log.timestamp'))); |
|
191 | 191 | |
192 | 192 | $start = 0; |
193 | 193 | $contents = []; |
@@ -195,37 +195,37 @@ discard block |
||
195 | 195 | do |
196 | 196 | { |
197 | 197 | $ids = []; |
198 | - $items = $manager->searchItems( $search ); |
|
198 | + $items = $manager->searchItems($search); |
|
199 | 199 | |
200 | - foreach( $items as $id => $item ) |
|
200 | + foreach ($items as $id => $item) |
|
201 | 201 | { |
202 | - if( $container !== null ) |
|
202 | + if ($container !== null) |
|
203 | 203 | { |
204 | 204 | $facility = $item->getFacility(); |
205 | 205 | |
206 | - if( !isset( $contents[$facility] ) ) { |
|
207 | - $contents[$facility] = $container->create( $facility ); |
|
206 | + if (!isset($contents[$facility])) { |
|
207 | + $contents[$facility] = $container->create($facility); |
|
208 | 208 | } |
209 | 209 | |
210 | - $contents[$facility]->add( $item->toArray() ); |
|
210 | + $contents[$facility]->add($item->toArray()); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | $ids[] = $id; |
214 | 214 | } |
215 | 215 | |
216 | - $manager->deleteItems( $ids ); |
|
216 | + $manager->deleteItems($ids); |
|
217 | 217 | |
218 | - $count = count( $items ); |
|
218 | + $count = count($items); |
|
219 | 219 | $start += $count; |
220 | - $search->setSlice( $start ); |
|
220 | + $search->setSlice($start); |
|
221 | 221 | } |
222 | - while( $count >= $search->getSliceSize() ); |
|
222 | + while ($count >= $search->getSliceSize()); |
|
223 | 223 | |
224 | 224 | |
225 | - if( $container !== null && !empty( $contents ) ) |
|
225 | + if ($container !== null && !empty($contents)) |
|
226 | 226 | { |
227 | - foreach( $contents as $content ) { |
|
228 | - $container->add( $content ); |
|
227 | + foreach ($contents as $content) { |
|
228 | + $container->add($content); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | $container->close(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Coupon code import CSV' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Coupon code import CSV'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getDescription() |
41 | 41 | { |
42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Imports new and updates existing coupon code from CSV files' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Imports new and updates existing coupon code from CSV files'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @see controller/jobs/coupon/import/csv/code/skip-lines |
72 | 72 | * @see controller/jobs/coupon/import/csv/code/max-size |
73 | 73 | */ |
74 | - $mappings = $config->get( 'controller/jobs/coupon/import/csv/code/mapping', $mappings ); |
|
74 | + $mappings = $config->get('controller/jobs/coupon/import/csv/code/mapping', $mappings); |
|
75 | 75 | |
76 | 76 | |
77 | 77 | /** controller/jobs/coupon/import/csv/code/max-size |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @see controller/jobs/coupon/import/csv/code/skip-lines |
91 | 91 | * @see controller/jobs/coupon/import/csv/code/mapping |
92 | 92 | */ |
93 | - $maxcnt = (int) $config->get( 'controller/jobs/coupon/import/csv/code/max-size', 1000 ); |
|
93 | + $maxcnt = (int) $config->get('controller/jobs/coupon/import/csv/code/max-size', 1000); |
|
94 | 94 | |
95 | 95 | |
96 | 96 | /** controller/jobs/coupon/import/csv/code/skip-lines |
@@ -108,64 +108,64 @@ discard block |
||
108 | 108 | * @see controller/jobs/coupon/import/csv/code/mapping |
109 | 109 | * @see controller/jobs/coupon/import/csv/code/max-size |
110 | 110 | */ |
111 | - $skiplines = (int) $config->get( 'controller/jobs/coupon/import/csv/code/skip-lines', 0 ); |
|
111 | + $skiplines = (int) $config->get('controller/jobs/coupon/import/csv/code/skip-lines', 0); |
|
112 | 112 | |
113 | 113 | |
114 | 114 | try |
115 | 115 | { |
116 | - $processor = $this->getProcessors( $mappings ); |
|
117 | - $codePos = $this->getCodePosition( $mappings['code'] ); |
|
118 | - $fs = $context->getFileSystemManager()->get( 'fs-import' ); |
|
116 | + $processor = $this->getProcessors($mappings); |
|
117 | + $codePos = $this->getCodePosition($mappings['code']); |
|
118 | + $fs = $context->getFileSystemManager()->get('fs-import'); |
|
119 | 119 | $dir = 'couponcode/' . $context->getLocale()->getSite()->getCode(); |
120 | 120 | |
121 | - if( $fs->isDir( $dir ) === false ) { |
|
121 | + if ($fs->isDir($dir) === false) { |
|
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
125 | - foreach( $fs->scan( $dir ) as $filename ) |
|
125 | + foreach ($fs->scan($dir) as $filename) |
|
126 | 126 | { |
127 | - if( $filename == '.' || $filename == '..' ) { |
|
127 | + if ($filename == '.' || $filename == '..') { |
|
128 | 128 | continue; |
129 | 129 | } |
130 | 130 | |
131 | - list( $couponId, ) = explode( '.', $filename ); |
|
132 | - $container = $this->getContainer( $fs->readf( $dir . '/' . $filename ) ); |
|
131 | + list($couponId,) = explode('.', $filename); |
|
132 | + $container = $this->getContainer($fs->readf($dir . '/' . $filename)); |
|
133 | 133 | |
134 | - $msg = sprintf( 'Started coupon import from "%1$s" (%2$s)', $filename, __CLASS__ ); |
|
135 | - $logger->log( $msg, \Aimeos\MW\Logger\Base::NOTICE ); |
|
134 | + $msg = sprintf('Started coupon import from "%1$s" (%2$s)', $filename, __CLASS__); |
|
135 | + $logger->log($msg, \Aimeos\MW\Logger\Base::NOTICE); |
|
136 | 136 | |
137 | - foreach( $container as $content ) |
|
137 | + foreach ($container as $content) |
|
138 | 138 | { |
139 | - for( $i = 0; $i < $skiplines; $i++ ) { |
|
139 | + for ($i = 0; $i < $skiplines; $i++) { |
|
140 | 140 | $content->next(); |
141 | 141 | } |
142 | 142 | |
143 | - while( ( $data = $this->getData( $content, $maxcnt, $codePos ) ) !== [] ) |
|
143 | + while (($data = $this->getData($content, $maxcnt, $codePos)) !== []) |
|
144 | 144 | { |
145 | - $items = $this->getCouponCodeItems( array_keys( $data ) ); |
|
146 | - $errcnt = $this->import( $items, $data, $couponId, $processor ); |
|
147 | - $chunkcnt = count( $data ); |
|
145 | + $items = $this->getCouponCodeItems(array_keys($data)); |
|
146 | + $errcnt = $this->import($items, $data, $couponId, $processor); |
|
147 | + $chunkcnt = count($data); |
|
148 | 148 | |
149 | 149 | $msg = 'Imported coupon lines from "%1$s": %2$d/%3$d (%4$s)'; |
150 | - $logger->log( sprintf( $msg, $filename, $chunkcnt - $errcnt, $chunkcnt, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE ); |
|
150 | + $logger->log(sprintf($msg, $filename, $chunkcnt - $errcnt, $chunkcnt, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE); |
|
151 | 151 | |
152 | 152 | $errors += $errcnt; |
153 | 153 | $total += $chunkcnt; |
154 | - unset( $items, $data ); |
|
154 | + unset($items, $data); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | 158 | $container->close(); |
159 | - $fs->rm( $dir . '/' . $filename ); |
|
159 | + $fs->rm($dir . '/' . $filename); |
|
160 | 160 | |
161 | 161 | $msg = 'Finished coupon import: %1$d successful, %2$s errors, %3$s total (%4$s)'; |
162 | - $logger->log( sprintf( $msg, $total - $errors, $errors, $total, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE ); |
|
162 | + $logger->log(sprintf($msg, $total - $errors, $errors, $total, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE); |
|
163 | 163 | } |
164 | 164 | } |
165 | - catch( \Exception $e ) |
|
165 | + catch (\Exception $e) |
|
166 | 166 | { |
167 | - $logger->log( 'Coupon import error: ' . $e->getMessage() ); |
|
168 | - $logger->log( $e->getTraceAsString() ); |
|
167 | + $logger->log('Coupon import error: ' . $e->getMessage()); |
|
168 | + $logger->log($e->getTraceAsString()); |
|
169 | 169 | |
170 | 170 | throw $e; |
171 | 171 | } |
@@ -179,16 +179,16 @@ discard block |
||
179 | 179 | * @return integer Position of the "coupon.code" column |
180 | 180 | * @throws \Aimeos\Controller\Jobs\Exception If no mapping for "coupon.code.code" is found |
181 | 181 | */ |
182 | - protected function getCodePosition( array $mapping ) |
|
182 | + protected function getCodePosition(array $mapping) |
|
183 | 183 | { |
184 | - foreach( $mapping as $pos => $key ) |
|
184 | + foreach ($mapping as $pos => $key) |
|
185 | 185 | { |
186 | - if( $key === 'coupon.code.code' ) { |
|
186 | + if ($key === 'coupon.code.code') { |
|
187 | 187 | return $pos; |
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No "coupon.code.code" column in CSV mapping found' ) ); |
|
191 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('No "coupon.code.code" column in CSV mapping found')); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param string $filepath Path to the container file |
199 | 199 | * @return \Aimeos\MW\Container\Iface Container object |
200 | 200 | */ |
201 | - protected function getContainer( $filepath ) |
|
201 | + protected function getContainer($filepath) |
|
202 | 202 | { |
203 | 203 | $config = $this->getContext()->getConfig(); |
204 | 204 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @see controller/jobs/coupon/import/csv/code/container/content |
223 | 223 | * @see controller/jobs/coupon/import/csv/code/container/options |
224 | 224 | */ |
225 | - $container = $config->get( 'controller/jobs/coupon/import/csv/code/container/type', 'File' ); |
|
225 | + $container = $config->get('controller/jobs/coupon/import/csv/code/container/type', 'File'); |
|
226 | 226 | |
227 | 227 | /** controller/jobs/coupon/import/csv/code/container/content |
228 | 228 | * Name of the content type inside the container to read the data from |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @see controller/jobs/coupon/import/csv/code/container/type |
243 | 243 | * @see controller/jobs/coupon/import/csv/code/container/options |
244 | 244 | */ |
245 | - $content = $config->get( 'controller/jobs/coupon/import/csv/code/container/content', 'CSV' ); |
|
245 | + $content = $config->get('controller/jobs/coupon/import/csv/code/container/content', 'CSV'); |
|
246 | 246 | |
247 | 247 | /** controller/jobs/coupon/import/csv/code/container/options |
248 | 248 | * List of file container options for the coupon import files |
@@ -259,9 +259,9 @@ discard block |
||
259 | 259 | * @see controller/jobs/coupon/import/csv/code/container/content |
260 | 260 | * @see controller/jobs/coupon/import/csv/code/container/type |
261 | 261 | */ |
262 | - $options = $config->get( 'controller/jobs/coupon/import/csv/code/container/options', [] ); |
|
262 | + $options = $config->get('controller/jobs/coupon/import/csv/code/container/options', []); |
|
263 | 263 | |
264 | - return \Aimeos\MW\Container\Factory::getContainer( $filepath, $container, $content, $options ); |
|
264 | + return \Aimeos\MW\Container\Factory::getContainer($filepath, $container, $content, $options); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
@@ -275,36 +275,36 @@ discard block |
||
275 | 275 | * @return integer Number of coupons that couldn't be imported |
276 | 276 | * @throws \Aimeos\Controller\Jobs\Exception |
277 | 277 | */ |
278 | - protected function import( array $items, array $data, $couponId, |
|
279 | - \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $processor ) |
|
278 | + protected function import(array $items, array $data, $couponId, |
|
279 | + \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $processor) |
|
280 | 280 | { |
281 | 281 | $errors = 0; |
282 | 282 | $context = $this->getContext(); |
283 | - $manager = \Aimeos\MShop::create( $context, 'coupon/code' ); |
|
283 | + $manager = \Aimeos\MShop::create($context, 'coupon/code'); |
|
284 | 284 | |
285 | - foreach( $data as $code => $list ) |
|
285 | + foreach ($data as $code => $list) |
|
286 | 286 | { |
287 | 287 | $manager->begin(); |
288 | 288 | |
289 | 289 | try |
290 | 290 | { |
291 | - if( isset( $items[$code] ) ) { |
|
291 | + if (isset($items[$code])) { |
|
292 | 292 | $item = $items[$code]; |
293 | 293 | } else { |
294 | 294 | $item = $manager->createItem(); |
295 | 295 | } |
296 | 296 | |
297 | - $item->setParentId( $couponId ); |
|
298 | - $list = $processor->process( $item, $list ); |
|
297 | + $item->setParentId($couponId); |
|
298 | + $list = $processor->process($item, $list); |
|
299 | 299 | |
300 | 300 | $manager->commit(); |
301 | 301 | } |
302 | - catch( \Exception $e ) |
|
302 | + catch (\Exception $e) |
|
303 | 303 | { |
304 | 304 | $manager->rollback(); |
305 | 305 | |
306 | - $msg = sprintf( 'Unable to import coupon with code "%1$s": %2$s', $code, $e->getMessage() ); |
|
307 | - $context->getLogger()->log( $msg ); |
|
306 | + $msg = sprintf('Unable to import coupon with code "%1$s": %2$s', $code, $e->getMessage()); |
|
307 | + $context->getLogger()->log($msg); |
|
308 | 308 | |
309 | 309 | $errors++; |
310 | 310 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Catalog import CSV' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Catalog import CSV'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getDescription() |
41 | 41 | { |
42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Imports new and updates existing categories from CSV files' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Imports new and updates existing categories from CSV files'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $context = $this->getContext(); |
55 | 55 | $config = $context->getConfig(); |
56 | 56 | $logger = $context->getLogger(); |
57 | - $domains = array( 'media', 'text' ); |
|
57 | + $domains = array('media', 'text'); |
|
58 | 58 | $mappings = $this->getDefaultMapping(); |
59 | 59 | |
60 | 60 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @see controller/common/catalog/import/csv/converter |
75 | 75 | * @see controller/common/catalog/import/csv/max-size |
76 | 76 | */ |
77 | - $domains = $config->get( 'controller/common/catalog/import/csv/domains', $domains ); |
|
77 | + $domains = $config->get('controller/common/catalog/import/csv/domains', $domains); |
|
78 | 78 | |
79 | 79 | /** controller/jobs/catalog/import/csv/domains |
80 | 80 | * List of item domain names that should be retrieved along with the catalog items |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @see controller/jobs/catalog/import/csv/backup |
95 | 95 | * @see controller/common/catalog/import/csv/max-size |
96 | 96 | */ |
97 | - $domains = $config->get( 'controller/jobs/catalog/import/csv/domains', $domains ); |
|
97 | + $domains = $config->get('controller/jobs/catalog/import/csv/domains', $domains); |
|
98 | 98 | |
99 | 99 | |
100 | 100 | /** controller/common/catalog/import/csv/mapping |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @see controller/common/catalog/import/csv/converter |
120 | 120 | * @see controller/common/catalog/import/csv/max-size |
121 | 121 | */ |
122 | - $mappings = $config->get( 'controller/common/catalog/import/csv/mapping', $mappings ); |
|
122 | + $mappings = $config->get('controller/common/catalog/import/csv/mapping', $mappings); |
|
123 | 123 | |
124 | 124 | /** controller/jobs/catalog/import/csv/mapping |
125 | 125 | * List of mappings between the position in the CSV file and item keys |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @see controller/jobs/catalog/import/csv/backup |
140 | 140 | * @see controller/common/catalog/import/csv/max-size |
141 | 141 | */ |
142 | - $mappings = $config->get( 'controller/jobs/catalog/import/csv/mapping', $mappings ); |
|
142 | + $mappings = $config->get('controller/jobs/catalog/import/csv/mapping', $mappings); |
|
143 | 143 | |
144 | 144 | |
145 | 145 | /** controller/common/catalog/import/csv/converter |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @see controller/common/catalog/import/csv/mapping |
182 | 182 | * @see controller/common/catalog/import/csv/max-size |
183 | 183 | */ |
184 | - $converters = $config->get( 'controller/common/catalog/import/csv/converter', [] ); |
|
184 | + $converters = $config->get('controller/common/catalog/import/csv/converter', []); |
|
185 | 185 | |
186 | 186 | /** controller/jobs/catalog/import/csv/converter |
187 | 187 | * List of converter names for the values at the position in the CSV file |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @see controller/jobs/catalog/import/csv/backup |
202 | 202 | * @see controller/common/catalog/import/csv/max-size |
203 | 203 | */ |
204 | - $converters = $config->get( 'controller/jobs/catalog/import/csv/converter', $converters ); |
|
204 | + $converters = $config->get('controller/jobs/catalog/import/csv/converter', $converters); |
|
205 | 205 | |
206 | 206 | |
207 | 207 | /** controller/common/catalog/import/csv/max-size |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @see controller/common/catalog/import/csv/mapping |
222 | 222 | * @see controller/common/catalog/import/csv/converter |
223 | 223 | */ |
224 | - $maxcnt = (int) $config->get( 'controller/common/catalog/import/csv/max-size', 1000 ); |
|
224 | + $maxcnt = (int) $config->get('controller/common/catalog/import/csv/max-size', 1000); |
|
225 | 225 | |
226 | 226 | |
227 | 227 | /** controller/jobs/catalog/import/csv/skip-lines |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @see controller/jobs/catalog/import/csv/backup |
244 | 244 | * @see controller/common/catalog/import/csv/max-size |
245 | 245 | */ |
246 | - $skiplines = (int) $config->get( 'controller/jobs/catalog/import/csv/skip-lines', 0 ); |
|
246 | + $skiplines = (int) $config->get('controller/jobs/catalog/import/csv/skip-lines', 0); |
|
247 | 247 | |
248 | 248 | |
249 | 249 | /** controller/jobs/catalog/import/csv/strict |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @see controller/jobs/catalog/import/csv/backup |
268 | 268 | * @see controller/common/catalog/import/csv/max-size |
269 | 269 | */ |
270 | - $strict = (bool) $config->get( 'controller/jobs/catalog/import/csv/strict', true ); |
|
270 | + $strict = (bool) $config->get('controller/jobs/catalog/import/csv/strict', true); |
|
271 | 271 | |
272 | 272 | |
273 | 273 | /** controller/jobs/catalog/import/csv/backup |
@@ -300,75 +300,75 @@ discard block |
||
300 | 300 | * @see controller/jobs/catalog/import/csv/strict |
301 | 301 | * @see controller/common/catalog/import/csv/max-size |
302 | 302 | */ |
303 | - $backup = $config->get( 'controller/jobs/catalog/import/csv/backup' ); |
|
303 | + $backup = $config->get('controller/jobs/catalog/import/csv/backup'); |
|
304 | 304 | |
305 | 305 | |
306 | - if( !isset( $mappings['item'] ) || !is_array( $mappings['item'] ) ) |
|
306 | + if (!isset($mappings['item']) || !is_array($mappings['item'])) |
|
307 | 307 | { |
308 | - $msg = sprintf( 'Required mapping key "%1$s" is missing or contains no array', 'item' ); |
|
309 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
308 | + $msg = sprintf('Required mapping key "%1$s" is missing or contains no array', 'item'); |
|
309 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | try |
313 | 313 | { |
314 | 314 | $procMappings = $mappings; |
315 | - unset( $procMappings['item'] ); |
|
315 | + unset($procMappings['item']); |
|
316 | 316 | |
317 | - $codePos = $this->getCodePosition( $mappings['item'] ); |
|
318 | - $convlist = $this->getConverterList( $converters ); |
|
319 | - $processor = $this->getProcessors( $procMappings ); |
|
320 | - $catalogMap = $this->getCatalogMap( $domains ); |
|
317 | + $codePos = $this->getCodePosition($mappings['item']); |
|
318 | + $convlist = $this->getConverterList($converters); |
|
319 | + $processor = $this->getProcessors($procMappings); |
|
320 | + $catalogMap = $this->getCatalogMap($domains); |
|
321 | 321 | $container = $this->getContainer(); |
322 | 322 | $path = $container->getName(); |
323 | 323 | |
324 | 324 | |
325 | - $msg = sprintf( 'Started catalog import from "%1$s" (%2$s)', $path, __CLASS__ ); |
|
326 | - $logger->log( $msg, \Aimeos\MW\Logger\Base::NOTICE ); |
|
325 | + $msg = sprintf('Started catalog import from "%1$s" (%2$s)', $path, __CLASS__); |
|
326 | + $logger->log($msg, \Aimeos\MW\Logger\Base::NOTICE); |
|
327 | 327 | |
328 | - foreach( $container as $content ) |
|
328 | + foreach ($container as $content) |
|
329 | 329 | { |
330 | 330 | $name = $content->getName(); |
331 | 331 | |
332 | - for( $i = 0; $i < $skiplines; $i++ ) { |
|
332 | + for ($i = 0; $i < $skiplines; $i++) { |
|
333 | 333 | $content->next(); |
334 | 334 | } |
335 | 335 | |
336 | - while( ( $data = $this->getData( $content, $maxcnt, $codePos ) ) !== [] ) |
|
336 | + while (($data = $this->getData($content, $maxcnt, $codePos)) !== []) |
|
337 | 337 | { |
338 | - $data = $this->convertData( $convlist, $data ); |
|
339 | - $errcnt = $this->import( $catalogMap, $data, $mappings['item'], $processor, $strict ); |
|
340 | - $chunkcnt = count( $data ); |
|
338 | + $data = $this->convertData($convlist, $data); |
|
339 | + $errcnt = $this->import($catalogMap, $data, $mappings['item'], $processor, $strict); |
|
340 | + $chunkcnt = count($data); |
|
341 | 341 | |
342 | 342 | $msg = 'Imported catalog lines from "%1$s": %2$d/%3$d (%4$s)'; |
343 | - $logger->log( sprintf( $msg, $name, $chunkcnt - $errcnt, $chunkcnt, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE ); |
|
343 | + $logger->log(sprintf($msg, $name, $chunkcnt - $errcnt, $chunkcnt, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE); |
|
344 | 344 | |
345 | 345 | $errors += $errcnt; |
346 | 346 | $total += $chunkcnt; |
347 | - unset( $data ); |
|
347 | + unset($data); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | 351 | $container->close(); |
352 | 352 | } |
353 | - catch( \Exception $e ) |
|
353 | + catch (\Exception $e) |
|
354 | 354 | { |
355 | - $logger->log( 'Catalog import error: ' . $e->getMessage() ); |
|
356 | - $logger->log( $e->getTraceAsString() ); |
|
355 | + $logger->log('Catalog import error: ' . $e->getMessage()); |
|
356 | + $logger->log($e->getTraceAsString()); |
|
357 | 357 | |
358 | - throw new \Aimeos\Controller\Jobs\Exception( $e->getMessage() ); |
|
358 | + throw new \Aimeos\Controller\Jobs\Exception($e->getMessage()); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | $msg = 'Finished catalog import from "%1$s": %2$d successful, %3$s errors, %4$s total (%5$s)'; |
362 | - $logger->log( sprintf( $msg, $path, $total - $errors, $errors, $total, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE ); |
|
362 | + $logger->log(sprintf($msg, $path, $total - $errors, $errors, $total, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE); |
|
363 | 363 | |
364 | - if( $errors > 0 ) |
|
364 | + if ($errors > 0) |
|
365 | 365 | { |
366 | - $msg = sprintf( 'Invalid catalog lines in "%1$s": %2$d/%3$d', $path, $errors, $total ); |
|
367 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
366 | + $msg = sprintf('Invalid catalog lines in "%1$s": %2$d/%3$d', $path, $errors, $total); |
|
367 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
368 | 368 | } |
369 | 369 | |
370 | - if( !empty( $backup ) && @rename( $path, strftime( $backup ) ) === false ) { |
|
371 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Unable to move imported file' ) ); |
|
370 | + if (!empty($backup) && @rename($path, strftime($backup)) === false) { |
|
371 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Unable to move imported file')); |
|
372 | 372 | } |
373 | 373 | } |
374 | 374 | |
@@ -380,16 +380,16 @@ discard block |
||
380 | 380 | * @return integer Position of the "catalog.code" column |
381 | 381 | * @throws \Aimeos\Controller\Jobs\Exception If no mapping for "catalog.code" is found |
382 | 382 | */ |
383 | - protected function getCodePosition( array $mapping ) |
|
383 | + protected function getCodePosition(array $mapping) |
|
384 | 384 | { |
385 | - foreach( $mapping as $pos => $key ) |
|
385 | + foreach ($mapping as $pos => $key) |
|
386 | 386 | { |
387 | - if( $key === 'catalog.code' ) { |
|
387 | + if ($key === 'catalog.code') { |
|
388 | 388 | return $pos; |
389 | 389 | } |
390 | 390 | } |
391 | 391 | |
392 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No "catalog.code" column in CSV mapping found' ) ); |
|
392 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('No "catalog.code" column in CSV mapping found')); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @see controller/jobs/catalog/import/csv/container/content |
425 | 425 | * @see controller/jobs/catalog/import/csv/container/options |
426 | 426 | */ |
427 | - $location = $config->get( 'controller/jobs/catalog/import/csv/location' ); |
|
427 | + $location = $config->get('controller/jobs/catalog/import/csv/location'); |
|
428 | 428 | |
429 | 429 | /** controller/jobs/catalog/import/csv/container/type |
430 | 430 | * Nave of the container type to read the data from |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * @see controller/jobs/catalog/import/csv/container/content |
448 | 448 | * @see controller/jobs/catalog/import/csv/container/options |
449 | 449 | */ |
450 | - $container = $config->get( 'controller/jobs/catalog/import/csv/container/type', 'Directory' ); |
|
450 | + $container = $config->get('controller/jobs/catalog/import/csv/container/type', 'Directory'); |
|
451 | 451 | |
452 | 452 | /** controller/jobs/catalog/import/csv/container/content |
453 | 453 | * Name of the content type inside the container to read the data from |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | * @see controller/jobs/catalog/import/csv/container/type |
469 | 469 | * @see controller/jobs/catalog/import/csv/container/options |
470 | 470 | */ |
471 | - $content = $config->get( 'controller/jobs/catalog/import/csv/container/content', 'CSV' ); |
|
471 | + $content = $config->get('controller/jobs/catalog/import/csv/container/content', 'CSV'); |
|
472 | 472 | |
473 | 473 | /** controller/jobs/catalog/import/csv/container/options |
474 | 474 | * List of file container options for the catalog import files |
@@ -486,15 +486,15 @@ discard block |
||
486 | 486 | * @see controller/jobs/catalog/import/csv/container/content |
487 | 487 | * @see controller/jobs/catalog/import/csv/container/type |
488 | 488 | */ |
489 | - $options = $config->get( 'controller/jobs/catalog/import/csv/container/options', [] ); |
|
489 | + $options = $config->get('controller/jobs/catalog/import/csv/container/options', []); |
|
490 | 490 | |
491 | - if( $location === null ) |
|
491 | + if ($location === null) |
|
492 | 492 | { |
493 | - $msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/catalog/import/csv/location' ); |
|
494 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
493 | + $msg = sprintf('Required configuration for "%1$s" is missing', 'controller/jobs/catalog/import/csv/location'); |
|
494 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
495 | 495 | } |
496 | 496 | |
497 | - return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options ); |
|
497 | + return \Aimeos\MW\Container\Factory::getContainer($location, $container, $content, $options); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | |
@@ -504,13 +504,13 @@ discard block |
||
504 | 504 | * @param array $domains List of domain names whose items should be fetched too |
505 | 505 | * @return array Associative list of catalog codes as keys and items implementing \Aimeos\MShop\Catalog\Item\Iface as values |
506 | 506 | */ |
507 | - protected function getCatalogMap( array $domains ) |
|
507 | + protected function getCatalogMap(array $domains) |
|
508 | 508 | { |
509 | 509 | $map = []; |
510 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'catalog' ); |
|
511 | - $search = $manager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
510 | + $manager = \Aimeos\MShop::create($this->getContext(), 'catalog'); |
|
511 | + $search = $manager->createSearch()->setSlice(0, 0x7fffffff); |
|
512 | 512 | |
513 | - foreach( $manager->searchItems( $search, $domains ) as $item ) { |
|
513 | + foreach ($manager->searchItems($search, $domains) as $item) { |
|
514 | 514 | $map[$item->getCode()] = $item; |
515 | 515 | } |
516 | 516 | |
@@ -526,23 +526,23 @@ discard block |
||
526 | 526 | * @param string $code Catalog item code of the parent category |
527 | 527 | * @return string|null ID of the parent category or null for top level nodes |
528 | 528 | */ |
529 | - protected function getParentId( array $catalogMap, array $map, $code ) |
|
529 | + protected function getParentId(array $catalogMap, array $map, $code) |
|
530 | 530 | { |
531 | - if( !isset( $map['catalog.parent'] ) ) |
|
531 | + if (!isset($map['catalog.parent'])) |
|
532 | 532 | { |
533 | - $msg = sprintf( 'Required column "%1$s" not found for code "%2$s"', 'catalog.parent', $code ); |
|
534 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
533 | + $msg = sprintf('Required column "%1$s" not found for code "%2$s"', 'catalog.parent', $code); |
|
534 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
535 | 535 | } |
536 | 536 | |
537 | - $parent = trim( $map['catalog.parent'] ); |
|
537 | + $parent = trim($map['catalog.parent']); |
|
538 | 538 | |
539 | - if( $parent != '' && !isset( $catalogMap[$parent] ) ) |
|
539 | + if ($parent != '' && !isset($catalogMap[$parent])) |
|
540 | 540 | { |
541 | - $msg = sprintf( 'Parent node for code "%1$s" not found', $parent ); |
|
542 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
541 | + $msg = sprintf('Parent node for code "%1$s" not found', $parent); |
|
542 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
543 | 543 | } |
544 | 544 | |
545 | - return ( $parent != '' ? $catalogMap[$parent]->getId() : null ); |
|
545 | + return ($parent != '' ? $catalogMap[$parent]->getId() : null); |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | |
@@ -557,65 +557,65 @@ discard block |
||
557 | 557 | * @return integer Number of catalogs that couldn't be imported |
558 | 558 | * @throws \Aimeos\Controller\Jobs\Exception |
559 | 559 | */ |
560 | - protected function import( array &$catalogMap, array $data, array $mapping, |
|
561 | - \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor, $strict ) |
|
560 | + protected function import(array &$catalogMap, array $data, array $mapping, |
|
561 | + \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor, $strict) |
|
562 | 562 | { |
563 | 563 | $errors = 0; |
564 | 564 | $context = $this->getContext(); |
565 | - $manager = \Aimeos\MShop::create( $context, 'catalog' ); |
|
565 | + $manager = \Aimeos\MShop::create($context, 'catalog'); |
|
566 | 566 | |
567 | - foreach( $data as $code => $list ) |
|
567 | + foreach ($data as $code => $list) |
|
568 | 568 | { |
569 | 569 | $manager->begin(); |
570 | 570 | |
571 | 571 | try |
572 | 572 | { |
573 | - $code = trim( $code ); |
|
573 | + $code = trim($code); |
|
574 | 574 | |
575 | - if( isset( $catalogMap[$code] ) ) { |
|
575 | + if (isset($catalogMap[$code])) { |
|
576 | 576 | $item = $catalogMap[$code]; |
577 | 577 | } else { |
578 | 578 | $item = $manager->createItem(); |
579 | 579 | } |
580 | 580 | |
581 | - $map = $this->getMappedChunk( $list, $mapping ); |
|
581 | + $map = $this->getMappedChunk($list, $mapping); |
|
582 | 582 | |
583 | - if( isset( $map[0] ) ) |
|
583 | + if (isset($map[0])) |
|
584 | 584 | { |
585 | 585 | $map = $map[0]; // there can only be one chunk for the base catalog data |
586 | - $parentid = $this->getParentId( $catalogMap, $map, $code ); |
|
587 | - $item->fromArray( $map ); |
|
586 | + $parentid = $this->getParentId($catalogMap, $map, $code); |
|
587 | + $item->fromArray($map); |
|
588 | 588 | |
589 | - if( isset( $catalogMap[$code] ) ) |
|
589 | + if (isset($catalogMap[$code])) |
|
590 | 590 | { |
591 | - $manager->moveItem( $item->getId(), $item->getParentId(), $parentid ); |
|
592 | - $item = $manager->saveItem( $item ); |
|
591 | + $manager->moveItem($item->getId(), $item->getParentId(), $parentid); |
|
592 | + $item = $manager->saveItem($item); |
|
593 | 593 | } |
594 | 594 | else |
595 | 595 | { |
596 | - $item = $manager->insertItem( $item, $parentid ); |
|
596 | + $item = $manager->insertItem($item, $parentid); |
|
597 | 597 | } |
598 | 598 | |
599 | - $list = $processor->process( $item, $list ); |
|
599 | + $list = $processor->process($item, $list); |
|
600 | 600 | $catalogMap[$code] = $item; |
601 | 601 | |
602 | - $manager->saveItem( $item ); |
|
602 | + $manager->saveItem($item); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | $manager->commit(); |
606 | 606 | } |
607 | - catch( \Exception $e ) |
|
607 | + catch (\Exception $e) |
|
608 | 608 | { |
609 | 609 | $manager->rollback(); |
610 | 610 | |
611 | - $msg = sprintf( 'Unable to import catalog with code "%1$s": %2$s', $code, $e->getMessage() ); |
|
612 | - $context->getLogger()->log( $msg ); |
|
611 | + $msg = sprintf('Unable to import catalog with code "%1$s": %2$s', $code, $e->getMessage()); |
|
612 | + $context->getLogger()->log($msg); |
|
613 | 613 | |
614 | 614 | $errors++; |
615 | 615 | } |
616 | 616 | |
617 | - if( $strict && !empty( $list ) ) { |
|
618 | - $context->getLogger()->log( 'Not imported: ' . print_r( $list, true ) ); |
|
617 | + if ($strict && !empty($list)) { |
|
618 | + $context->getLogger()->log('Not imported: ' . print_r($list, true)); |
|
619 | 619 | } |
620 | 620 | } |
621 | 621 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Rescale product images' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Rescale product images'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getDescription() |
41 | 41 | { |
42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Rescales product images to the new sizes' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Rescales product images to the new sizes'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -51,41 +51,41 @@ discard block |
||
51 | 51 | public function run() |
52 | 52 | { |
53 | 53 | $context = $this->getContext(); |
54 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
55 | - $manager = \Aimeos\MShop::create( $context, 'media' ); |
|
54 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context); |
|
55 | + $manager = \Aimeos\MShop::create($context, 'media'); |
|
56 | 56 | |
57 | 57 | $search = $manager->createSearch(); |
58 | 58 | $expr = array( |
59 | - $search->compare( '==', 'media.domain', 'product' ), |
|
60 | - $search->compare( '=~', 'media.mimetype', 'image/' ), |
|
59 | + $search->compare('==', 'media.domain', 'product'), |
|
60 | + $search->compare('=~', 'media.mimetype', 'image/'), |
|
61 | 61 | ); |
62 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
63 | - $search->setSortations( array( $search->sort( '+', 'media.id' ) ) ); |
|
62 | + $search->setConditions($search->combine('&&', $expr)); |
|
63 | + $search->setSortations(array($search->sort('+', 'media.id'))); |
|
64 | 64 | |
65 | 65 | $start = 0; |
66 | 66 | |
67 | 67 | do |
68 | 68 | { |
69 | - $search->setSlice( $start ); |
|
70 | - $items = $manager->searchItems( $search ); |
|
69 | + $search->setSlice($start); |
|
70 | + $items = $manager->searchItems($search); |
|
71 | 71 | |
72 | - foreach( $items as $item ) |
|
72 | + foreach ($items as $item) |
|
73 | 73 | { |
74 | 74 | try |
75 | 75 | { |
76 | - $cntl->scale( $item, 'fs-media' ); |
|
77 | - $manager->saveItem( $item ); |
|
76 | + $cntl->scale($item, 'fs-media'); |
|
77 | + $manager->saveItem($item); |
|
78 | 78 | } |
79 | - catch( \Exception $e ) |
|
79 | + catch (\Exception $e) |
|
80 | 80 | { |
81 | - $msg = sprintf( 'Scaling media item "%1$s" failed: %2$s', $item->getId(), $e->getMessage() ); |
|
82 | - $context->getLogger()->log( $msg ); |
|
81 | + $msg = sprintf('Scaling media item "%1$s" failed: %2$s', $item->getId(), $e->getMessage()); |
|
82 | + $context->getLogger()->log($msg); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - $count = count( $items ); |
|
86 | + $count = count($items); |
|
87 | 87 | $start += $count; |
88 | 88 | } |
89 | - while( $count === $search->getSliceSize() ); |
|
89 | + while ($count === $search->getSliceSize()); |
|
90 | 90 | } |
91 | 91 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Index optimization' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Index optimization'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Optimizes the index for searching products faster' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Optimizes the index for searching products faster'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,6 +51,6 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function run() |
53 | 53 | { |
54 | - \Aimeos\MShop\Index\Manager\Factory::create( $this->getContext() )->optimize(); |
|
54 | + \Aimeos\MShop\Index\Manager\Factory::create($this->getContext())->optimize(); |
|
55 | 55 | } |
56 | 56 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Index rebuild' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Index rebuild'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Rebuilds the index for searching products' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Rebuilds the index for searching products'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function run() |
53 | 53 | { |
54 | - $timestamp = date( 'Y-m-d H:i:s' ); |
|
54 | + $timestamp = date('Y-m-d H:i:s'); |
|
55 | 55 | $context = clone $this->getContext(); |
56 | 56 | |
57 | - $context->getLocale()->setLanguageId( null ); |
|
58 | - $context->getLocale()->setCurrencyId( null ); |
|
57 | + $context->getLocale()->setLanguageId(null); |
|
58 | + $context->getLocale()->setCurrencyId(null); |
|
59 | 59 | |
60 | - $manager = \Aimeos\MShop\Index\Manager\Factory::create( $context ); |
|
60 | + $manager = \Aimeos\MShop\Index\Manager\Factory::create($context); |
|
61 | 61 | |
62 | 62 | $manager->rebuildIndex(); |
63 | - $manager->cleanupIndex( $timestamp ); |
|
63 | + $manager->cleanupIndex($timestamp); |
|
64 | 64 | } |
65 | 65 | } |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | public static function bootstrap() |
16 | 16 | { |
17 | 17 | self::getAimeos(); |
18 | - \Aimeos\MShop::cache( false ); |
|
18 | + \Aimeos\MShop::cache(false); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
22 | - public static function getContext( $site = 'unittest' ) |
|
22 | + public static function getContext($site = 'unittest') |
|
23 | 23 | { |
24 | - if( !isset( self::$context[$site] ) ) { |
|
25 | - self::$context[$site] = self::createContext( $site ); |
|
24 | + if (!isset(self::$context[$site])) { |
|
25 | + self::$context[$site] = self::createContext($site); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | return clone self::$context[$site]; |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | |
32 | 32 | public static function getAimeos() |
33 | 33 | { |
34 | - if( !isset( self::$aimeos ) ) |
|
34 | + if (!isset(self::$aimeos)) |
|
35 | 35 | { |
36 | 36 | require_once 'Bootstrap.php'; |
37 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
37 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
38 | 38 | |
39 | - $extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); |
|
40 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
39 | + $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); |
|
40 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return self::$aimeos; |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | |
47 | 47 | public static function getControllerPaths() |
48 | 48 | { |
49 | - return self::getAimeos()->getCustomPaths( 'controller/jobs' ); |
|
49 | + return self::getAimeos()->getCustomPaths('controller/jobs'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @param string $site |
55 | 55 | */ |
56 | - private static function createContext( $site ) |
|
56 | + private static function createContext($site) |
|
57 | 57 | { |
58 | 58 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
59 | 59 | $aimeos = self::getAimeos(); |
@@ -63,80 +63,80 @@ discard block |
||
63 | 63 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
64 | 64 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
65 | 65 | |
66 | - $conf = new \Aimeos\MW\Config\PHPArray( [], $paths ); |
|
67 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
68 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
69 | - $ctx->setConfig( $conf ); |
|
66 | + $conf = new \Aimeos\MW\Config\PHPArray([], $paths); |
|
67 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
68 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
69 | + $ctx->setConfig($conf); |
|
70 | 70 | |
71 | 71 | |
72 | - $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
73 | - $ctx->setLogger( $logger ); |
|
72 | + $logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
73 | + $ctx->setLogger($logger); |
|
74 | 74 | |
75 | 75 | |
76 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
77 | - $ctx->setDatabaseManager( $dbm ); |
|
76 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
77 | + $ctx->setDatabaseManager($dbm); |
|
78 | 78 | |
79 | 79 | |
80 | - $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $conf ); |
|
81 | - $ctx->setFilesystemManager( $fs ); |
|
80 | + $fs = new \Aimeos\MW\Filesystem\Manager\Standard($conf); |
|
81 | + $ctx->setFilesystemManager($fs); |
|
82 | 82 | |
83 | 83 | |
84 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf ); |
|
85 | - $ctx->setMessageQueueManager( $mq ); |
|
84 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($conf); |
|
85 | + $ctx->setMessageQueueManager($mq); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | $cache = new \Aimeos\MW\Cache\None(); |
89 | - $ctx->setCache( $cache ); |
|
89 | + $ctx->setCache($cache); |
|
90 | 90 | |
91 | 91 | |
92 | 92 | $session = new \Aimeos\MW\Session\None(); |
93 | - $ctx->setSession( $session ); |
|
93 | + $ctx->setSession($session); |
|
94 | 94 | |
95 | 95 | |
96 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
97 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
96 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
97 | + $ctx->setI18n(array('de' => $i18n)); |
|
98 | 98 | |
99 | 99 | |
100 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create( $ctx ); |
|
101 | - $locale = $localeManager->bootstrap( $site, 'de', '', false ); |
|
102 | - $ctx->setLocale( $locale ); |
|
100 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create($ctx); |
|
101 | + $locale = $localeManager->bootstrap($site, 'de', '', false); |
|
102 | + $ctx->setLocale($locale); |
|
103 | 103 | |
104 | 104 | |
105 | - $view = self::createView( $conf ); |
|
106 | - $ctx->setView( $view ); |
|
105 | + $view = self::createView($conf); |
|
106 | + $ctx->setView($view); |
|
107 | 107 | |
108 | 108 | |
109 | - $ctx->setEditor( 'core:controller/jobs' ); |
|
109 | + $ctx->setEditor('core:controller/jobs'); |
|
110 | 110 | |
111 | 111 | return $ctx; |
112 | 112 | } |
113 | 113 | |
114 | 114 | |
115 | - protected static function createView( \Aimeos\MW\Config\Iface $config ) |
|
115 | + protected static function createView(\Aimeos\MW\Config\Iface $config) |
|
116 | 116 | { |
117 | 117 | $tmplpaths = array_merge_recursive( |
118 | - self::getAimeos()->getCustomPaths( 'client/html/templates' ), |
|
119 | - self::getAimeos()->getCustomPaths( 'controller/jobs/templates' ) |
|
118 | + self::getAimeos()->getCustomPaths('client/html/templates'), |
|
119 | + self::getAimeos()->getCustomPaths('controller/jobs/templates') |
|
120 | 120 | ); |
121 | 121 | |
122 | - $view = new \Aimeos\MW\View\Standard( $tmplpaths ); |
|
122 | + $view = new \Aimeos\MW\View\Standard($tmplpaths); |
|
123 | 123 | |
124 | - $trans = new \Aimeos\MW\Translation\None( 'de_DE' ); |
|
125 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans ); |
|
126 | - $view->addHelper( 'translate', $helper ); |
|
124 | + $trans = new \Aimeos\MW\Translation\None('de_DE'); |
|
125 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans); |
|
126 | + $view->addHelper('translate', $helper); |
|
127 | 127 | |
128 | - $helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' ); |
|
129 | - $view->addHelper( 'url', $helper ); |
|
128 | + $helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl'); |
|
129 | + $view->addHelper('url', $helper); |
|
130 | 130 | |
131 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' ); |
|
132 | - $view->addHelper( 'number', $helper ); |
|
131 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', ''); |
|
132 | + $view->addHelper('number', $helper); |
|
133 | 133 | |
134 | - $helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' ); |
|
135 | - $view->addHelper( 'date', $helper ); |
|
134 | + $helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d'); |
|
135 | + $view->addHelper('date', $helper); |
|
136 | 136 | |
137 | - $config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'controller/jobs', 'client/html' ) ); |
|
138 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
139 | - $view->addHelper( 'config', $helper ); |
|
137 | + $config = new \Aimeos\MW\Config\Decorator\Protect($config, array('controller/jobs', 'client/html')); |
|
138 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
139 | + $view->addHelper('config', $helper); |
|
140 | 140 | |
141 | 141 | return $view; |
142 | 142 | } |
@@ -17,31 +17,31 @@ discard block |
||
17 | 17 | $this->context = \TestHelperJobs::getContext('unitperf'); |
18 | 18 | |
19 | 19 | $config = $this->context->getConfig(); |
20 | - $config->set( 'controller/jobs/product/import/csv/location', 'tmp/product-import.zip' ); |
|
21 | - $config->set( 'controller/jobs/product/import/csv/container/type', 'Zip' ); |
|
22 | - $config->set( 'controller/jobs/product/import/csv/container/content', 'CSV' ); |
|
23 | - $config->set( 'controller/jobs/product/import/csv/mapping', $this->getMapping() ); |
|
20 | + $config->set('controller/jobs/product/import/csv/location', 'tmp/product-import.zip'); |
|
21 | + $config->set('controller/jobs/product/import/csv/container/type', 'Zip'); |
|
22 | + $config->set('controller/jobs/product/import/csv/container/content', 'CSV'); |
|
23 | + $config->set('controller/jobs/product/import/csv/mapping', $this->getMapping()); |
|
24 | 24 | |
25 | - $container = \Aimeos\MW\Container\Factory::getContainer( 'tmp/product-import.zip', 'Zip', 'CSV', [] ); |
|
25 | + $container = \Aimeos\MW\Container\Factory::getContainer('tmp/product-import.zip', 'Zip', 'CSV', []); |
|
26 | 26 | |
27 | - $content = $container->create( 'product.csv' ); |
|
27 | + $content = $container->create('product.csv'); |
|
28 | 28 | |
29 | - for( $i = 0; $i < 1000; $i++ ) |
|
29 | + for ($i = 0; $i < 1000; $i++) |
|
30 | 30 | { |
31 | 31 | $data = []; |
32 | 32 | |
33 | - $data = $this->addProduct( $data, $i ); |
|
34 | - $data = $this->addText( $data, $i ); |
|
35 | - $data = $this->addMedia( $data, $i ); |
|
36 | - $data = $this->addPrice( $data, $i ); |
|
37 | - $data = $this->addAttribute( $data, $i ); |
|
38 | - $data = $this->addProductRef( $data, $i ); |
|
39 | - $data = $this->addProperty( $data, $i ); |
|
33 | + $data = $this->addProduct($data, $i); |
|
34 | + $data = $this->addText($data, $i); |
|
35 | + $data = $this->addMedia($data, $i); |
|
36 | + $data = $this->addPrice($data, $i); |
|
37 | + $data = $this->addAttribute($data, $i); |
|
38 | + $data = $this->addProductRef($data, $i); |
|
39 | + $data = $this->addProperty($data, $i); |
|
40 | 40 | |
41 | - $content->add( $data ); |
|
41 | + $content->add($data); |
|
42 | 42 | } |
43 | 43 | |
44 | - $container->add( $content ); |
|
44 | + $container->add($content); |
|
45 | 45 | |
46 | 46 | $container->close(); |
47 | 47 | } |
@@ -55,25 +55,25 @@ discard block |
||
55 | 55 | $this->cleanupPrice(); |
56 | 56 | $this->cleanupProduct(); |
57 | 57 | |
58 | - unlink( 'tmp/product-import.zip' ); |
|
58 | + unlink('tmp/product-import.zip'); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testImport() |
63 | 63 | { |
64 | 64 | $aimeos = \TestHelperJobs::getAimeos(); |
65 | - $cntl = \Aimeos\Controller\Jobs\Product\Import\Csv\Factory::createController( $this->context, $aimeos, 'Standard' ); |
|
65 | + $cntl = \Aimeos\Controller\Jobs\Product\Import\Csv\Factory::createController($this->context, $aimeos, 'Standard'); |
|
66 | 66 | |
67 | - $start = microtime( true ); |
|
67 | + $start = microtime(true); |
|
68 | 68 | |
69 | 69 | $cntl->run(); |
70 | 70 | |
71 | - $stop = microtime( true ); |
|
72 | - echo "\n product import CSV: " . ( ( $stop - $start ) ) . " sec\n"; |
|
71 | + $stop = microtime(true); |
|
72 | + echo "\n product import CSV: " . (($stop - $start)) . " sec\n"; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | - protected function addAttribute( array $data, $cnt ) |
|
76 | + protected function addAttribute(array $data, $cnt) |
|
77 | 77 | { |
78 | 78 | $data[] = 'length'; // type |
79 | 79 | $data[] = 'import-' . ($cnt % 30); // code |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | - protected function addMedia( array $data, $cnt ) |
|
89 | + protected function addMedia(array $data, $cnt) |
|
90 | 90 | { |
91 | 91 | $data[] = "/path/to/image-$cnt.jpg"; // url |
92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | |
97 | - protected function addPrice( array $data, $cnt ) |
|
97 | + protected function addPrice(array $data, $cnt) |
|
98 | 98 | { |
99 | 99 | $data[] = 1; // quantity |
100 | 100 | $data[] = 'import-' . $cnt; // label |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | - protected function addProduct( array $data, $cnt ) |
|
108 | + protected function addProduct(array $data, $cnt) |
|
109 | 109 | { |
110 | 110 | $data[] = 'import-' . $cnt; // code |
111 | 111 | $data[] = 'import-' . $cnt; // label |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | |
119 | - protected function addProductRef( array $data, $cnt ) |
|
119 | + protected function addProductRef(array $data, $cnt) |
|
120 | 120 | { |
121 | 121 | $data[] = 'import-' . ($cnt % 100); // code |
122 | 122 | $data[] = 'suggestion'; // type |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | - protected function addProperty( array $data, $cnt ) |
|
128 | + protected function addProperty(array $data, $cnt) |
|
129 | 129 | { |
130 | 130 | $data[] = 'package-weight'; // type |
131 | 131 | $data[] = '0.5'; // value |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | |
137 | - protected function addText( array $data, $cnt ) |
|
137 | + protected function addText(array $data, $cnt) |
|
138 | 138 | { |
139 | 139 | $data[] = 'name'; // type |
140 | 140 | $data[] = 'import-name-' . $cnt; //content |
@@ -149,132 +149,132 @@ discard block |
||
149 | 149 | |
150 | 150 | protected function cleanupAttribute() |
151 | 151 | { |
152 | - $manager = \Aimeos\MShop\Attribute\Manager\Factory::create( $this->context ); |
|
152 | + $manager = \Aimeos\MShop\Attribute\Manager\Factory::create($this->context); |
|
153 | 153 | |
154 | 154 | $search = $manager->createSearch(); |
155 | 155 | $expr = array( |
156 | - $search->compare( '==', 'attribute.domain', 'product' ), |
|
157 | - $search->compare( '==', 'attribute.label', 'import-%' ), |
|
156 | + $search->compare('==', 'attribute.domain', 'product'), |
|
157 | + $search->compare('==', 'attribute.label', 'import-%'), |
|
158 | 158 | ); |
159 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
160 | - $search->setSortations( array( $search->sort( '+', 'attribute.id' ) ) ); |
|
159 | + $search->setConditions($search->combine('&&', $expr)); |
|
160 | + $search->setSortations(array($search->sort('+', 'attribute.id'))); |
|
161 | 161 | |
162 | 162 | $start = 0; |
163 | 163 | |
164 | 164 | do |
165 | 165 | { |
166 | - $result = $manager->searchItems( $search ); |
|
167 | - $manager->deleteItems( array_keys( $result ) ); |
|
166 | + $result = $manager->searchItems($search); |
|
167 | + $manager->deleteItems(array_keys($result)); |
|
168 | 168 | |
169 | - $count = count( $result ); |
|
169 | + $count = count($result); |
|
170 | 170 | $start += $count; |
171 | - $search->setSlice( $start ); |
|
171 | + $search->setSlice($start); |
|
172 | 172 | } |
173 | - while( $count == $search->getSliceSize() ); |
|
173 | + while ($count == $search->getSliceSize()); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
177 | 177 | protected function cleanupMedia() |
178 | 178 | { |
179 | - $manager = \Aimeos\MShop\Media\Manager\Factory::create( $this->context ); |
|
179 | + $manager = \Aimeos\MShop\Media\Manager\Factory::create($this->context); |
|
180 | 180 | |
181 | 181 | $search = $manager->createSearch(); |
182 | 182 | $expr = array( |
183 | - $search->compare( '==', 'media.domain', 'product' ), |
|
184 | - $search->compare( '==', 'media.label', 'import-%' ), |
|
183 | + $search->compare('==', 'media.domain', 'product'), |
|
184 | + $search->compare('==', 'media.label', 'import-%'), |
|
185 | 185 | ); |
186 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
187 | - $search->setSortations( array( $search->sort( '+', 'media.id' ) ) ); |
|
186 | + $search->setConditions($search->combine('&&', $expr)); |
|
187 | + $search->setSortations(array($search->sort('+', 'media.id'))); |
|
188 | 188 | |
189 | 189 | $start = 0; |
190 | 190 | |
191 | 191 | do |
192 | 192 | { |
193 | - $result = $manager->searchItems( $search ); |
|
194 | - $manager->deleteItems( array_keys( $result ) ); |
|
193 | + $result = $manager->searchItems($search); |
|
194 | + $manager->deleteItems(array_keys($result)); |
|
195 | 195 | |
196 | - $count = count( $result ); |
|
196 | + $count = count($result); |
|
197 | 197 | $start += $count; |
198 | - $search->setSlice( $start ); |
|
198 | + $search->setSlice($start); |
|
199 | 199 | } |
200 | - while( $count == $search->getSliceSize() ); |
|
200 | + while ($count == $search->getSliceSize()); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
204 | 204 | protected function cleanupPrice() |
205 | 205 | { |
206 | - $manager = \Aimeos\MShop\Price\Manager\Factory::create( $this->context ); |
|
206 | + $manager = \Aimeos\MShop\Price\Manager\Factory::create($this->context); |
|
207 | 207 | |
208 | 208 | $search = $manager->createSearch(); |
209 | 209 | $expr = array( |
210 | - $search->compare( '==', 'price.domain', 'product' ), |
|
211 | - $search->compare( '==', 'price.label', 'import-%' ), |
|
210 | + $search->compare('==', 'price.domain', 'product'), |
|
211 | + $search->compare('==', 'price.label', 'import-%'), |
|
212 | 212 | ); |
213 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
214 | - $search->setSortations( array( $search->sort( '+', 'price.id' ) ) ); |
|
213 | + $search->setConditions($search->combine('&&', $expr)); |
|
214 | + $search->setSortations(array($search->sort('+', 'price.id'))); |
|
215 | 215 | |
216 | 216 | $start = 0; |
217 | 217 | |
218 | 218 | do |
219 | 219 | { |
220 | - $result = $manager->searchItems( $search ); |
|
221 | - $manager->deleteItems( array_keys( $result ) ); |
|
220 | + $result = $manager->searchItems($search); |
|
221 | + $manager->deleteItems(array_keys($result)); |
|
222 | 222 | |
223 | - $count = count( $result ); |
|
223 | + $count = count($result); |
|
224 | 224 | $start += $count; |
225 | - $search->setSlice( $start ); |
|
225 | + $search->setSlice($start); |
|
226 | 226 | } |
227 | - while( $count == $search->getSliceSize() ); |
|
227 | + while ($count == $search->getSliceSize()); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | |
231 | 231 | protected function cleanupProduct() |
232 | 232 | { |
233 | - $manager = \Aimeos\MShop\Product\Manager\Factory::create( $this->context ); |
|
233 | + $manager = \Aimeos\MShop\Product\Manager\Factory::create($this->context); |
|
234 | 234 | |
235 | 235 | $search = $manager->createSearch(); |
236 | - $search->setConditions( $search->compare( '==', 'product.code', 'import-%' ) ); |
|
237 | - $search->setSortations( array( $search->sort( '+', 'product.id' ) ) ); |
|
236 | + $search->setConditions($search->compare('==', 'product.code', 'import-%')); |
|
237 | + $search->setSortations(array($search->sort('+', 'product.id'))); |
|
238 | 238 | |
239 | 239 | $start = 0; |
240 | 240 | |
241 | 241 | do |
242 | 242 | { |
243 | - $result = $manager->searchItems( $search ); |
|
244 | - $manager->deleteItems( array_keys( $result ) ); |
|
243 | + $result = $manager->searchItems($search); |
|
244 | + $manager->deleteItems(array_keys($result)); |
|
245 | 245 | |
246 | - $count = count( $result ); |
|
246 | + $count = count($result); |
|
247 | 247 | $start += $count; |
248 | - $search->setSlice( $start ); |
|
248 | + $search->setSlice($start); |
|
249 | 249 | } |
250 | - while( $count == $search->getSliceSize() ); |
|
250 | + while ($count == $search->getSliceSize()); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
254 | 254 | protected function cleanupText() |
255 | 255 | { |
256 | - $manager = \Aimeos\MShop\Text\Manager\Factory::create( $this->context ); |
|
256 | + $manager = \Aimeos\MShop\Text\Manager\Factory::create($this->context); |
|
257 | 257 | |
258 | 258 | $search = $manager->createSearch(); |
259 | 259 | $expr = array( |
260 | - $search->compare( '==', 'text.domain', 'product' ), |
|
261 | - $search->compare( '==', 'text.label', 'import-%' ), |
|
260 | + $search->compare('==', 'text.domain', 'product'), |
|
261 | + $search->compare('==', 'text.label', 'import-%'), |
|
262 | 262 | ); |
263 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
264 | - $search->setSortations( array( $search->sort( '+', 'text.id' ) ) ); |
|
263 | + $search->setConditions($search->combine('&&', $expr)); |
|
264 | + $search->setSortations(array($search->sort('+', 'text.id'))); |
|
265 | 265 | |
266 | 266 | $start = 0; |
267 | 267 | |
268 | 268 | do |
269 | 269 | { |
270 | - $result = $manager->searchItems( $search ); |
|
271 | - $manager->deleteItems( array_keys( $result ) ); |
|
270 | + $result = $manager->searchItems($search); |
|
271 | + $manager->deleteItems(array_keys($result)); |
|
272 | 272 | |
273 | - $count = count( $result ); |
|
273 | + $count = count($result); |
|
274 | 274 | $start += $count; |
275 | - $search->setSlice( $start ); |
|
275 | + $search->setSlice($start); |
|
276 | 276 | } |
277 | - while( $count == $search->getSliceSize() ); |
|
277 | + while ($count == $search->getSliceSize()); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 |