Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364120 )

Change subject: Break long lines
......................................................................

Break long lines

Change-Id: Id9505936148fc99f72f5d7ea4c6285ba8bd91037
---
M PageAssessments.hooks.php
M api/ApiQueryPageAssessments.php
M api/ApiQueryProjectPages.php
M maintenance/purgeUnusedProjects.php
M phpcs.xml
5 files changed, 41 insertions(+), 21 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageAssessments 
refs/changes/20/364120/1

diff --git a/PageAssessments.hooks.php b/PageAssessments.hooks.php
index 908f335..584d4e8 100644
--- a/PageAssessments.hooks.php
+++ b/PageAssessments.hooks.php
@@ -36,7 +36,9 @@
         * @param mixed $ticket
         */
        public static function onLinksUpdateComplete( &$linksUpdate, $ticket = 
null ) {
-               $assessmentsOnTalkPages = 
RequestContext::getMain()->getConfig()->get( 'PageAssessmentsOnTalkPages' );
+               $assessmentsOnTalkPages = 
RequestContext::getMain()->getConfig()->get(
+                       'PageAssessmentsOnTalkPages'
+               );
                $title = $linksUpdate->getTitle();
                // Only check for assessment data where assessments are 
actually made.
                if ( ( $assessmentsOnTalkPages && $title->isTalkPage() ) ||
@@ -65,15 +67,20 @@
         */
        public static function onLoadExtensionSchemaUpdates( DatabaseUpdater 
$updater = null ) {
                $dbDir = __DIR__ . '/db';
-               $updater->addExtensionTable( 'page_assessments_projects', 
"$dbDir/addProjectsTable.sql", true );
-               $updater->addExtensionTable( 'page_assessments', 
"$dbDir/addReviewsTable.sql", true );
-               $updater->addExtensionField( 'page_assessments_projects', 
'pap_parent_id', "$dbDir/patch-subprojects.sql", true );
+               $updater->addExtensionTable( 'page_assessments_projects',
+                       "$dbDir/addProjectsTable.sql", true );
+               $updater->addExtensionTable( 'page_assessments',
+                       "$dbDir/addReviewsTable.sql", true );
+               $updater->addExtensionField( 'page_assessments_projects',
+                       'pap_parent_id', "$dbDir/patch-subprojects.sql", true );
        }
 
        /**
         * Delete assessment records when page is deleted
         */
-       public static function onArticleDeleteComplete( &$article, &$user, 
$reason, $id, $content = null, $logEntry ) {
+       public static function onArticleDeleteComplete(
+               &$article, &$user, $reason, $id, $content = null, $logEntry
+       ) {
                PageAssessmentsBody::deleteRecordsForPage( $id );
        }
 
diff --git a/api/ApiQueryPageAssessments.php b/api/ApiQueryPageAssessments.php
index 7257d6b..a61452c 100644
--- a/api/ApiQueryPageAssessments.php
+++ b/api/ApiQueryPageAssessments.php
@@ -44,7 +44,9 @@
                        }
 
                        $fit = $result->addValue(
-                               [ 'query', 'pages', $row->page_id, 
$this->getModuleName() ], $projectName, $projectValues
+                               [ 'query', 'pages', $row->page_id, 
$this->getModuleName() ],
+                               $projectName,
+                               $projectValues
                        );
 
                        if ( !$fit ) {
@@ -53,8 +55,12 @@
                        }
 
                        // Make it easier to parse XML-formatted results
-                       $result->addArrayType( [ 'query', 'pages', 
$row->page_id, $this->getModuleName() ], 'kvp', 'project' );
-                       $result->addIndexedTagName( [ 'query', 'pages', 
$row->page_id, $this->getModuleName() ], 'p' );
+                       $result->addArrayType(
+                               [ 'query', 'pages', $row->page_id, 
$this->getModuleName() ], 'kvp', 'project'
+                       );
+                       $result->addIndexedTagName(
+                               [ 'query', 'pages', $row->page_id, 
$this->getModuleName() ], 'p'
+                       );
                }
        }
 
@@ -89,7 +95,8 @@
                        $this->handleQueryContinuation( $params['continue'] );
                }
 
-               // assure strict ordering, but mysql gets cranky if you order 
by a field when there's only one to sort
+               // assure strict ordering, but mysql gets cranky if you order 
by a field
+               // when there's only one to sort
                if ( count( $pages ) > 1 ) {
                        $this->addOption( 'ORDER BY', 'pa_page_id, 
pa_project_id' );
                } else {
@@ -103,10 +110,12 @@
 
                $continuePage = (int)$continues[0];
                $continueProject = (int)$continues[1];
-               $this->dieContinueUsageIf( $continues[0] !== 
(string)$continuePage ); // die if PHP has made unhelpful falsy conversions
-               $this->dieContinueUsageIf( $continues[1] !== 
(string)$continueProject ); // die if PHP has made unhelpful falsy conversions
+               // die if PHP has made unhelpful falsy conversions
+               $this->dieContinueUsageIf( $continues[0] !== 
(string)$continuePage );
+               $this->dieContinueUsageIf( $continues[1] !== 
(string)$continueProject );
 
-               $this->addWhere( "pa_page_id > $continuePage OR (pa_page_id = 
$continuePage AND pa_project_id >= $continueProject)" );
+               $this->addWhere( "pa_page_id > $continuePage OR " .
+                       "(pa_page_id = $continuePage AND pa_project_id >= 
$continueProject)" );
        }
 
        public function getAllowedParams() {
@@ -141,7 +150,7 @@
                                => 
'apihelp-query+pageassessments-example-simple',
                ];
                if ( $wgPageAssessmentsSubprojects ) {
-                       $exampleMessages[ 
'action=query&prop=pageassessments&titles=Apple&pasubprojects=true' ] =
+                       
$exampleMessages['action=query&prop=pageassessments&titles=Apple&pasubprojects=true']
 =
                                
'apihelp-query+pageassessments-example-subprojects';
                }
                return $exampleMessages;
diff --git a/api/ApiQueryProjectPages.php b/api/ApiQueryProjectPages.php
index 3286275..b903cb4 100644
--- a/api/ApiQueryProjectPages.php
+++ b/api/ApiQueryProjectPages.php
@@ -35,7 +35,8 @@
                        if ( is_callable( [ $this, 'addWarning' ] ) ) {
                                $this->addWarning( 
'apiwarn-pageassessments-nogeneratorassessments' );
                        } else {
-                               $this->setWarning( 'It is not possible to 
retrieve page assessment results from generator=projectpages.' );
+                               $this->setWarning( 'It is not possible to 
retrieve page assessment results from ' .
+                                       'generator=projectpages.' );
                        }
                }
 
@@ -139,7 +140,8 @@
                                        $this->projectIds[] = $id;
                                } else {
                                        if ( is_callable( [ $this, 'addWarning' 
] ) ) {
-                                               $this->addWarning( [ 
'apiwarn-pageassessments-badproject', wfEscapeWikiText( $project ) ] );
+                                               $this->addWarning( [ 
'apiwarn-pageassessments-badproject',
+                                                       wfEscapeWikiText( 
$project ) ] );
                                        } else {
                                                $this->setWarning( 'Project 
name not recognized: ' . $project );
                                        }
@@ -169,10 +171,12 @@
 
                $continueProject = (int)$continues[0];
                $continuePage = (int)$continues[1];
-               $this->dieContinueUsageIf( $continues[0] !== 
(string)$continueProject ); // die if PHP has made unhelpful falsy conversions
-               $this->dieContinueUsageIf( $continues[1] !== 
(string)$continuePage ); // die if PHP has made unhelpful falsy conversions
+               // die if PHP has made unhelpful falsy conversions
+               $this->dieContinueUsageIf( $continues[0] !== 
(string)$continueProject );
+               $this->dieContinueUsageIf( $continues[1] !== 
(string)$continuePage );
 
-               $this->addWhere( "pa_project_id > $continueProject OR 
(pa_project_id = $continueProject AND pa_page_id >= $continuePage)" );
+               $this->addWhere( "pa_project_id > $continueProject OR " .
+                       "(pa_project_id = $continueProject AND pa_page_id >= 
$continuePage)" );
        }
 
        private function generateResultVals( $row ) {
diff --git a/maintenance/purgeUnusedProjects.php 
b/maintenance/purgeUnusedProjects.php
index fb1010c..d304e24 100644
--- a/maintenance/purgeUnusedProjects.php
+++ b/maintenance/purgeUnusedProjects.php
@@ -17,7 +17,8 @@
                parent::__construct();
                $this->requireExtension( 'PageAssessments' );
                $this->addDescription( "Purge unused projects from the 
page_assessments_projects table" );
-               $this->addOption( 'dry-run', "Show how many projects would be 
deleted, but don't actually purge them." );
+               $this->addOption( 'dry-run',
+                       "Show how many projects would be deleted, but don't 
actually purge them." );
        }
 
        public function execute() {
diff --git a/phpcs.xml b/phpcs.xml
index c04fa07..b35e5af 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -8,10 +8,9 @@
                <exclude name="MediaWiki.Commenting.FunctionComment.WrongStyle" 
/>
                <exclude 
name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
                <exclude 
name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
-               <exclude name="Generic.Files.LineLength" />
        </rule>
        <file>.</file>
        <arg name="extensions" value="php,php5,inc" />
-       <arg name="encoding" value="utf8" />
+       <arg name="encoding" value="UTF-8" />
        <exclude-pattern>vendor</exclude-pattern>
 </ruleset>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9505936148fc99f72f5d7ea4c6285ba8bd91037
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PageAssessments
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>

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

Reply via email to