Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/224414

Change subject: Rename UpdateTable maintenance script
......................................................................

Rename UpdateTable maintenance script

* also used error method of superclass

Conflicts:
        tests/phpunit/Maintenance/UpdateTableTest.php

Change-Id: I3e815de38b2be79a7f8a2b3a0ff661ec49416171
---
M README.md
M composer.json
R maintenance/UpdateConstraintsTable.php
R tests/phpunit/Maintenance/UpdateConstraintsTableTest.php
4 files changed, 10 insertions(+), 11 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints
 refs/changes/14/224414/1

diff --git a/README.md b/README.md
index 87729be..abbc8bf 100644
--- a/README.md
+++ b/README.md
@@ -53,4 +53,4 @@
 * Last but not least, you need to fill the constraints table - for that you 
need the
 [constraints from templates 
script](https://github.com/WikidataQuality/ConstraintsFromTemplates).  
 Follow the instruction in the README to create a csv file.  
-Run `php maintenance/runScript.php 
extensions/Constraints/maintenance/UpdateTable.php --csv-file 
<path_to_csv_file>`.
\ No newline at end of file
+Run `php maintenance/runScript.php 
extensions/Constraints/maintenance/UpdateConstraintsTable.php --csv-file 
<path_to_csv_file>`.
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 8fcede4..c6e5381 100644
--- a/composer.json
+++ b/composer.json
@@ -31,7 +31,7 @@
                },
                "classmap": [
                        "WikibaseQualityConstraintsHooks.php",
-                       "maintenance/UpdateTable.php"
+                       "maintenance/UpdateConstraintsTable.php"
                ]
        }
 }
\ No newline at end of file
diff --git a/maintenance/UpdateTable.php 
b/maintenance/UpdateConstraintsTable.php
similarity index 93%
rename from maintenance/UpdateTable.php
rename to maintenance/UpdateConstraintsTable.php
index d234411..6d43759 100644
--- a/maintenance/UpdateTable.php
+++ b/maintenance/UpdateConstraintsTable.php
@@ -13,7 +13,7 @@
 
 
 /**
- * Class UpdateTable
+ * Class UpdateConstraintsTable
  *
  * @package WikibaseQuality\ConstraintReport\Maintenance
  *
@@ -21,7 +21,7 @@
  * Should be done once a week to keep constraint table up to date.
  * csv-file is generated by 
https://github.com/WikidataQuality/ConstraintsFromTemplates/blob/master/csvScriptBuilder.py
  */
-class UpdateTable extends \Maintenance {
+class UpdateConstraintsTable extends \Maintenance {
 
        public function __construct() {
                parent::__construct();
@@ -34,7 +34,7 @@
        public function execute(){
                $csvFile = fopen( $this->getOption( 'csv-file' ), 'rb' );
                if( !$csvFile ) {
-                       exit( "Error while opening csv-file" );
+                       $this->error( "Error while opening csv-file", 1 );
                }
 
                $constraintRepo = 
ConstraintReportFactory::getDefaultInstance()->getConstraintRepository();
@@ -77,6 +77,6 @@
 }
 
 // @codeCoverageIgnoreStart
-$maintClass = 'WikibaseQuality\ConstraintReport\Maintenance\UpdateTable';
+$maintClass = 
'WikibaseQuality\ConstraintReport\Maintenance\UpdateConstraintsTable';
 require_once RUN_MAINTENANCE_IF_MAIN;
 // @codeCoverageIgnoreEnd
\ No newline at end of file
diff --git a/tests/phpunit/Maintenance/UpdateTableTest.php 
b/tests/phpunit/Maintenance/UpdateConstraintsTableTest.php
similarity index 88%
rename from tests/phpunit/Maintenance/UpdateTableTest.php
rename to tests/phpunit/Maintenance/UpdateConstraintsTableTest.php
index 7661b29..7232faa 100755
--- a/tests/phpunit/Maintenance/UpdateTableTest.php
+++ b/tests/phpunit/Maintenance/UpdateConstraintsTableTest.php
@@ -2,12 +2,11 @@
 
 namespace WikibaseQuality\ConstraintReport\Tests\Maintenance;
 
-
-use WikibaseQuality\ConstraintReport\Maintenance\UpdateTable;
+use WikibaseQuality\ConstraintReport\Maintenance\UpdateConstraintsTable;
 
 
 /**
- * @covers WikibaseQuality\ConstraintReport\Maintenance\UpdateTable
+ * @covers WikibaseQuality\ConstraintReport\Maintenance\UpdateConstraintsTable
  *
  * @group WikibaseQualityConstraints
  * @group Database
@@ -16,7 +15,7 @@
  * @author BP2014N1
  * @license GNU GPL v2+
  */
-class UpdateTableTest extends \MediaWikiTestCase {
+class UpdateConstraintsTableTest extends \MediaWikiTestCase {
 
     protected function setup() {
         parent::setup();
@@ -44,7 +43,7 @@
     }
 
     public function testExecute() {
-        $maintenanceScript = new UpdateTable();
+        $maintenanceScript = new UpdateConstraintsTable();
         $args = array(
             'csv-file' => __DIR__ . '/constraints.csv',
             'batch-size' => 2,

-- 
To view, visit https://gerrit.wikimedia.org/r/224414
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e815de38b2be79a7f8a2b3a0ff661ec49416171
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Andreasburmeister <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to