@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | use Wikibase\Repo\WikibaseRepo; |
10 | 10 | |
11 | 11 | // @codeCoverageIgnoreStart |
12 | -$basePath = getenv( "MW_INSTALL_PATH" ) !== false |
|
13 | - ? getenv( "MW_INSTALL_PATH" ) : __DIR__ . "/../../.."; |
|
12 | +$basePath = getenv("MW_INSTALL_PATH") !== false |
|
13 | + ? getenv("MW_INSTALL_PATH") : __DIR__."/../../.."; |
|
14 | 14 | |
15 | -require_once $basePath . "/maintenance/Maintenance.php"; |
|
15 | +require_once $basePath."/maintenance/Maintenance.php"; |
|
16 | 16 | // @codeCoverageIgnoreEnd |
17 | 17 | |
18 | 18 | /** |
@@ -38,39 +38,39 @@ discard block |
||
38 | 38 | |
39 | 39 | public function __construct() { |
40 | 40 | parent::__construct(); |
41 | - $this->newUpdateConstraintsTableJob = function ( $propertyIdSerialization ) { |
|
41 | + $this->newUpdateConstraintsTableJob = function($propertyIdSerialization) { |
|
42 | 42 | return UpdateConstraintsTableJob::newFromGlobalState( |
43 | 43 | Title::newMainPage(), |
44 | - [ 'propertyId' => $propertyIdSerialization ] |
|
44 | + ['propertyId' => $propertyIdSerialization] |
|
45 | 45 | ); |
46 | 46 | }; |
47 | 47 | |
48 | - $this->addDescription( 'Imports property constraints from statements on properties' ); |
|
49 | - $this->requireExtension( 'WikibaseQualityConstraints' ); |
|
48 | + $this->addDescription('Imports property constraints from statements on properties'); |
|
49 | + $this->requireExtension('WikibaseQualityConstraints'); |
|
50 | 50 | |
51 | 51 | // Wikibase classes are not yet loaded, so setup services in a callback run in execute |
52 | 52 | // that can be overridden in tests. |
53 | - $this->setupServices = function () { |
|
53 | + $this->setupServices = function() { |
|
54 | 54 | $repo = WikibaseRepo::getDefaultInstance(); |
55 | 55 | $this->propertyInfoLookup = $repo->getStore()->getPropertyInfoLookup(); |
56 | 56 | }; |
57 | 57 | } |
58 | 58 | |
59 | 59 | public function execute() { |
60 | - ( $this->setupServices )(); |
|
61 | - if ( !$this->getConfig()->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) ) { |
|
62 | - $this->error( 'Constraint statements are not enabled. Aborting.' ); |
|
60 | + ($this->setupServices)(); |
|
61 | + if (!$this->getConfig()->get('WBQualityConstraintsEnableConstraintsImportFromStatements')) { |
|
62 | + $this->error('Constraint statements are not enabled. Aborting.'); |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | |
66 | - foreach ( $this->propertyInfoLookup->getAllPropertyInfo() as $propertyIdSerialization => $info ) { |
|
67 | - $this->output( sprintf( 'Importing constraint statements for % 6s... ', $propertyIdSerialization ), $propertyIdSerialization ); |
|
68 | - $startTime = microtime( true ); |
|
69 | - $job = call_user_func( $this->newUpdateConstraintsTableJob, $propertyIdSerialization ); |
|
66 | + foreach ($this->propertyInfoLookup->getAllPropertyInfo() as $propertyIdSerialization => $info) { |
|
67 | + $this->output(sprintf('Importing constraint statements for % 6s... ', $propertyIdSerialization), $propertyIdSerialization); |
|
68 | + $startTime = microtime(true); |
|
69 | + $job = call_user_func($this->newUpdateConstraintsTableJob, $propertyIdSerialization); |
|
70 | 70 | $job->run(); |
71 | - $endTime = microtime( true ); |
|
72 | - $millis = ( $endTime - $startTime ) * 1000; |
|
73 | - $this->output( sprintf( 'done in % 6.2f ms.', $millis ), $propertyIdSerialization ); |
|
71 | + $endTime = microtime(true); |
|
72 | + $millis = ($endTime - $startTime) * 1000; |
|
73 | + $this->output(sprintf('done in % 6.2f ms.', $millis), $propertyIdSerialization); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 |