jenkins-bot has submitted this change and it was merged.

Change subject: Cleanup annotations/signatures in CirrusSearch\\Sanity
......................................................................


Cleanup annotations/signatures in CirrusSearch\\Sanity

Bug: T132625
Change-Id: I07bcd4cf7a4dbed9a667c9a581a5988e0d1b4d1f
---
M includes/Sanity/QueueingRemediator.php
M includes/Sanity/Remediator.php
2 files changed, 65 insertions(+), 24 deletions(-)

Approvals:
  MaxSem: Looks good to me, approved
  DCausse: Looks good to me, but someone else must approve
  jenkins-bot: Verified

Objections:
  Cindy-the-browser-test-bot: There's a problem with this change, please improve



diff --git a/includes/Sanity/QueueingRemediator.php 
b/includes/Sanity/QueueingRemediator.php
index 2c125f4..50d018f 100644
--- a/includes/Sanity/QueueingRemediator.php
+++ b/includes/Sanity/QueueingRemediator.php
@@ -1,10 +1,11 @@
 <?php
 
 namespace CirrusSearch\Sanity;
-use \CirrusSearch\Job\DeletePages;
-use \CirrusSearch\Job\LinksUpdate;
-use \JobQueueGroup;
-use \WikiPage;
+use CirrusSearch\Job\DeletePages;
+use CirrusSearch\Job\LinksUpdate;
+use JobQueueGroup;
+use Title;
+use WikiPage;
 
 /**
  * Remediator implementation that queues jobs to fix the index.
@@ -35,13 +36,18 @@
        public function __construct( $cluster ) {
                $this->cluster = $cluster;
        }
-       public function redirectInIndex( $page ) {
+       public function redirectInIndex( WikiPage $page ) {
                $this->pushLinksUpdateJob( $page );
        }
-       public function pageNotInIndex( $page ) {
+       public function pageNotInIndex( WikiPage $page ) {
                $this->pushLinksUpdateJob( $page );
        }
-       public function ghostPageInIndex( $pageId, $title ) {
+
+       /**
+        * @param int $pageId
+        * @param Title $title
+        */
+       public function ghostPageInIndex( $pageId, Title $title ) {
                JobQueueGroup::singleton()->push(
                        new DeletePages( $title, array(
                                'id' => $pageId,
@@ -49,7 +55,12 @@
                        ) )
                );
        }
-       public function pageInWrongIndex( $page, $wrongIndex ) {
+
+       /**
+        * @param WikiPage $page
+        * @param string $wrongIndex
+        */
+       public function pageInWrongIndex( WikiPage $page, $wrongIndex ) {
                JobQueueGroup::singleton()->push(
                        new DeletePages( $page->getTitle(), array(
                                'indexType' => $wrongIndex,
@@ -60,7 +71,7 @@
                $this->pushLinksUpdateJob( $page );
        }
 
-       private function pushLinksUpdateJob( $page ) {
+       private function pushLinksUpdateJob( WikiPage $page ) {
                JobQueueGroup::singleton()->push(
                        new LinksUpdate( $page->getTitle(), array(
                                'addedLinks' => array(),
diff --git a/includes/Sanity/Remediator.php b/includes/Sanity/Remediator.php
index b4a3321..695caa4 100644
--- a/includes/Sanity/Remediator.php
+++ b/includes/Sanity/Remediator.php
@@ -1,8 +1,8 @@
 <?php
 
 namespace CirrusSearch\Sanity;
-use \Title;
-use \WikiPage;
+use Title;
+use WikiPage;
 
 /**
  * Remediation actions for insanity in the search index.
@@ -28,34 +28,47 @@
         * There is a redirect in the index.
         * @param WikiPage $page the page in the index
         */
-       public function redirectInIndex( $page );
+       public function redirectInIndex( WikiPage $page );
+
        /**
         * A page isn't in the index.
         * @param WikiPage $page not in the index
         */
-       public function pageNotInIndex( $page );
+       public function pageNotInIndex( WikiPage $page );
+
        /**
         * A non-existent page is in the index.  Odds are good it was deleted.
         * @param int $pageId id of the deleted page
         * @param Title $title title of the page read from the ghost
         */
-       public function ghostPageInIndex( $pageId, $title );
+       public function ghostPageInIndex( $pageId, Title $title );
+
        /**
         * An existent page is in more then one index.
         * @param WikiPage $page page in too many indexes
         * @param string $indexType index type that the page is in but 
shouldn't be in
         */
-       public function pageInWrongIndex( $page, $indexType );
+       public function pageInWrongIndex( WikiPage $page, $indexType );
 }
 
 /**
  * Remediator that takes no actions.
  */
 class NoopRemediator implements Remediator {
-       public function redirectInIndex( $page ) {}
-       public function pageNotInIndex( $page ) {}
-       public function ghostPageInIndex( $pageId, $title ) {}
-       public function pageInWrongIndex( $page, $indexType ) {}
+       public function redirectInIndex( WikiPage $page ) {}
+       public function pageNotInIndex( WikiPage $page ) {}
+
+       /**
+        * @param int $pageId
+        * @param Title $title
+        */
+       public function ghostPageInIndex( $pageId, Title $title ) {}
+
+       /**
+        * @param WikiPage $page
+        * @param string $indexType
+        */
+       public function pageInWrongIndex( WikiPage $page, $indexType ) {}
 }
 
 /**
@@ -68,26 +81,43 @@
         * Build the remediator.
         * @param Remediator $next the rememediator that this one decorates
         */
-       public function __construct( $next ) {
+       public function __construct( Remediator $next ) {
                $this->next = $next;
        }
 
-       public function redirectInIndex( $page ) {
+       public function redirectInIndex( WikiPage $page ) {
                $this->log( $page->getId(), $page->getTitle(), 'Redirect in 
index' );
                $this->next->redirectInIndex( $page );
        }
-       public function pageNotInIndex( $page ) {
+
+       public function pageNotInIndex( WikiPage $page ) {
                $this->log( $page->getId(), $page->getTitle(), 'Page not in 
index' );
                $this->next->pageNotInIndex( $page );
        }
-       public function ghostPageInIndex( $pageId, $title ) {
+
+       /**
+        * @param int $pageId
+        * @param Title $title
+        */
+       public function ghostPageInIndex( $pageId, Title $title ) {
                $this->log( $pageId, $title, 'Deleted page in index' );
                $this->next->ghostPageInIndex( $pageId, $title );
        }
-       public function pageInWrongIndex( $page, $indexType ) {
+
+       /**
+        * @param WikiPage $page
+        * @param string $indexType
+        */
+       public function pageInWrongIndex( WikiPage $page, $indexType ) {
                $this->log( $page->getId(), $page->getTitle(), "Page in wrong 
index: $indexType" );
                $this->next->pageInWrongIndex( $page, $indexType );
        }
+
+       /**
+        * @param int $pageId
+        * @param Title $title
+        * @param string $message
+        */
        private function log( $pageId, $title, $message ) {
                printf("%30s %10d %s\n", $message, $pageId, $title );
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I07bcd4cf7a4dbed9a667c9a581a5988e0d1b4d1f
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>
Gerrit-Reviewer: Cindy-the-browser-test-bot <bernhardsone...@gmail.com>
Gerrit-Reviewer: DCausse <dcau...@wikimedia.org>
Gerrit-Reviewer: Gehel <gleder...@wikimedia.org>
Gerrit-Reviewer: Manybubbles <never...@wikimedia.org>
Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com>
Gerrit-Reviewer: Smalyshev <smalys...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to