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