1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license MIT, http://opensource.org/licenses/MIT |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2015-2016 |
6
|
|
|
* @package laravel |
7
|
|
|
* @subpackage Command |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
namespace Aimeos\Shop\Command; |
12
|
|
|
|
13
|
|
|
use Illuminate\Console\Command; |
14
|
|
|
|
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Common base class for all commands |
18
|
|
|
* @package laravel |
19
|
|
|
* @subpackage Command |
20
|
|
|
*/ |
21
|
|
|
abstract class AbstractCommand extends Command |
22
|
|
|
{ |
23
|
|
|
protected function exec( \Aimeos\MShop\Context\Item\Iface $context, \Closure $fcn, ?string $sites ) |
24
|
|
|
{ |
25
|
|
|
$process = $context->getProcess(); |
26
|
|
|
$aimeos = $this->getLaravel()->make( 'aimeos' )->get(); |
27
|
|
|
|
28
|
|
|
$siteManager = \Aimeos\MShop::create( $context, 'locale/site' ); |
29
|
|
|
$localeManager = \Aimeos\MShop::create( $context, 'locale' ); |
30
|
|
|
$filter = $siteManager->filter(); |
31
|
|
|
$start = 0; |
32
|
|
|
|
33
|
|
|
if( $sites ) { |
34
|
|
|
$filter->add( ['locale.site.code' => explode( ' ', $sites )] ); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
do |
38
|
|
|
{ |
39
|
|
|
$siteItems = $siteManager->search( $filter->slice( $start ) ); |
|
|
|
|
40
|
|
|
|
41
|
|
|
foreach( $siteItems as $siteItem ) |
42
|
|
|
{ |
43
|
|
|
\Aimeos\MShop::cache( true ); |
44
|
|
|
\Aimeos\MAdmin::cache( true ); |
45
|
|
|
|
46
|
|
|
$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
|
|
|
47
|
|
|
$localeItem->setLanguageId( null ); |
48
|
|
|
$localeItem->setCurrencyId( null ); |
49
|
|
|
|
50
|
|
|
$lcontext = clone $context; |
51
|
|
|
$lcontext->setLocale( $localeItem ); |
52
|
|
|
$config = $lcontext->getConfig(); |
53
|
|
|
|
54
|
|
|
foreach( $siteItem->getConfig() as $key => $value ) { |
55
|
|
|
$config->set( $key, $value ); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
$process->start( $fcn, [$lcontext, $aimeos], false ); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
$count = count( $siteItems ); |
62
|
|
|
$start += $count; |
63
|
|
|
} |
64
|
|
|
while( $count === $filter->getLimit() ); |
65
|
|
|
|
66
|
|
|
$process->wait(); |
67
|
|
|
} |
68
|
|
|
} |
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.