@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { |
|
| 4 | - require_once __DIR__ . '/vendor/autoload.php'; |
|
| 3 | +if (is_readable(__DIR__.'/vendor/autoload.php')) { |
|
| 4 | + require_once __DIR__.'/vendor/autoload.php'; |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -call_user_func( function () { |
|
| 7 | +call_user_func(function() { |
|
| 8 | 8 | // Set credits |
| 9 | 9 | $GLOBALS['wgExtensionCredits']['wikibase'][] = array( |
| 10 | 10 | 'path' => __FILE__, |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | ); |
| 18 | 18 | |
| 19 | 19 | // Initialize localization and aliases |
| 20 | - $GLOBALS['wgMessagesDirs']['WikibaseQualityExternalValidation'] = __DIR__ . '/i18n'; |
|
| 21 | - $GLOBALS['wgExtensionMessagesFiles']['WikibaseQualityExternalValidationAlias'] = __DIR__ . '/WikibaseQualityExternalValidation.alias.php'; |
|
| 20 | + $GLOBALS['wgMessagesDirs']['WikibaseQualityExternalValidation'] = __DIR__.'/i18n'; |
|
| 21 | + $GLOBALS['wgExtensionMessagesFiles']['WikibaseQualityExternalValidationAlias'] = __DIR__.'/WikibaseQualityExternalValidation.alias.php'; |
|
| 22 | 22 | |
| 23 | 23 | // Initalize hooks for creating database tables |
| 24 | 24 | $GLOBALS['wgHooks']['LoadExtensionSchemaUpdates'][] = 'WikibaseQuality\ExternalValidation\WikibaseQualityExternalValidationHooks::onCreateSchema'; |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | // Define API modules |
| 34 | 34 | $GLOBALS['wgAPIModules']['wbqevcrosscheck'] = array( |
| 35 | 35 | 'class' => 'WikibaseQuality\ExternalValidation\Api\RunCrossCheck', |
| 36 | - 'factory' => function( ApiMain $main, $action ) { |
|
| 37 | - return \WikibaseQuality\ExternalValidation\Api\RunCrossCheck::newFromGlobalState( $main, $action ); |
|
| 36 | + 'factory' => function(ApiMain $main, $action) { |
|
| 37 | + return \WikibaseQuality\ExternalValidation\Api\RunCrossCheck::newFromGlobalState($main, $action); |
|
| 38 | 38 | } |
| 39 | 39 | ); |
| 40 | 40 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @return bool |
| 53 | 53 | */ |
| 54 | - public function isSerializerFor( $object ) { |
|
| 54 | + public function isSerializerFor($object) { |
|
| 55 | 55 | return $object instanceof CrossCheckResult; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -63,25 +63,25 @@ discard block |
||
| 63 | 63 | * @return array |
| 64 | 64 | * @throws UnsupportedObjectException |
| 65 | 65 | */ |
| 66 | - public function serialize( $object ) { |
|
| 67 | - if ( !$this->isSerializerFor( $object ) ) { |
|
| 66 | + public function serialize($object) { |
|
| 67 | + if (!$this->isSerializerFor($object)) { |
|
| 68 | 68 | throw new UnsupportedObjectException( |
| 69 | 69 | $object, |
| 70 | 70 | 'CrossCheckResultSerializer can only serialize CrossCheckResult objects.' |
| 71 | 71 | ); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - return $this->getSerialized( $object ); |
|
| 74 | + return $this->getSerialized($object); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - private function getSerialized( CrossCheckResult $crossCheckResult ) { |
|
| 77 | + private function getSerialized(CrossCheckResult $crossCheckResult) { |
|
| 78 | 78 | return array( |
| 79 | 79 | 'propertyId' => $crossCheckResult->getPropertyId()->getSerialization(), |
| 80 | 80 | 'claimGuid' => $crossCheckResult->getClaimGuid(), |
| 81 | 81 | 'externalId' => $crossCheckResult->getExternalId(), |
| 82 | - 'dataSource' => $this->dumpMetaInformationSerializer->serialize( $crossCheckResult->getDumpMetaInformation() ), |
|
| 83 | - 'comparisonResult' => $this->comparisonResultSerializer->serialize( $crossCheckResult->getComparisonResult() ), |
|
| 84 | - 'referenceResult' => $this->referenceResultSerializer->serialize( $crossCheckResult->getReferenceResult() ) |
|
| 82 | + 'dataSource' => $this->dumpMetaInformationSerializer->serialize($crossCheckResult->getDumpMetaInformation()), |
|
| 83 | + 'comparisonResult' => $this->comparisonResultSerializer->serialize($crossCheckResult->getComparisonResult()), |
|
| 84 | + 'referenceResult' => $this->referenceResultSerializer->serialize($crossCheckResult->getReferenceResult()) |
|
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -7,10 +7,10 @@ discard block |
||
| 7 | 7 | use WikibaseQuality\ExternalValidation\UpdateExternalData\CsvImportSettings; |
| 8 | 8 | use WikibaseQuality\ExternalValidation\UpdateExternalData\ExternalDataImporter; |
| 9 | 9 | |
| 10 | -$basePath = getenv( 'MW_INSTALL_PATH' ) !== false |
|
| 11 | - ? getenv( 'MW_INSTALL_PATH' ) |
|
| 12 | - : __DIR__ . '/../../..'; |
|
| 13 | -require_once $basePath . '/maintenance/Maintenance.php'; |
|
| 10 | +$basePath = getenv('MW_INSTALL_PATH') !== false |
|
| 11 | + ? getenv('MW_INSTALL_PATH') |
|
| 12 | + : __DIR__.'/../../..'; |
|
| 13 | +require_once $basePath.'/maintenance/Maintenance.php'; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Maintenance script that evokes updates of wbqev_external_data, wbqev_dump_information, wbqev_identifier_properties |
@@ -25,17 +25,17 @@ discard block |
||
| 25 | 25 | public function __construct() { |
| 26 | 26 | parent::__construct(); |
| 27 | 27 | |
| 28 | - $this->addDescription( 'Imports external entities from given CSV files into the local ' |
|
| 29 | - . 'database. CSV files can be generated using the DumpConverter.' ); |
|
| 30 | - $this->addOption( 'external-values-file', 'CSV file containing external values for import.', true, true ); |
|
| 31 | - $this->addOption( 'dump-information-file', 'CSV file containing dump meta information for import.', true, true ); |
|
| 32 | - $this->setBatchSize( 1000 ); |
|
| 28 | + $this->addDescription('Imports external entities from given CSV files into the local ' |
|
| 29 | + . 'database. CSV files can be generated using the DumpConverter.'); |
|
| 30 | + $this->addOption('external-values-file', 'CSV file containing external values for import.', true, true); |
|
| 31 | + $this->addOption('dump-information-file', 'CSV file containing dump meta information for import.', true, true); |
|
| 32 | + $this->setBatchSize(1000); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function execute() { |
| 36 | 36 | $context = new CsvImportSettings( |
| 37 | - $this->getOption( 'external-values-file' ), |
|
| 38 | - $this->getOption( 'dump-information-file' ), |
|
| 37 | + $this->getOption('external-values-file'), |
|
| 38 | + $this->getOption('dump-information-file'), |
|
| 39 | 39 | $this->mBatchSize, |
| 40 | 40 | $this->isQuiet() |
| 41 | 41 | ); |