Mobrovac has submitted this change and it was merged. Change subject: Removed updates that's been moved to change-prop ......................................................................
Removed updates that's been moved to change-prop We're moving RESTBase updates to change-propagation system, so we need to remove them from this extension. NOTE: This must be merged and deployed only after https://github.com/wikimedia/change-propagation/pull/37 is deployed and tested. Change-Id: Ic752c3353fcfb2de20ba0806f3a96fa3bf106202 --- M RestbaseUpdate.hooks.php M RestbaseUpdate.php M RestbaseUpdateJob.php 3 files changed, 1 insertion(+), 189 deletions(-) Approvals: Mobrovac: Looks good to me, approved jenkins-bot: Verified diff --git a/RestbaseUpdate.hooks.php b/RestbaseUpdate.hooks.php index 05f3dc4..b3e62e5 100644 --- a/RestbaseUpdate.hooks.php +++ b/RestbaseUpdate.hooks.php @@ -87,61 +87,6 @@ } - - /** - * Callback for article deletions - * - * @param $article WikiPage the modified wiki page object - * @param $user User the deleting user - * @param string $reason - * @param int $id the page id - * @return bool - */ - public static function onArticleDeleteComplete( $article, $user, $reason, $id ) { - - self::schedule( $article->getTitle(), 'delete' ); - return true; - - } - - - /** - * Callback for article undeletion. See specials/SpecialUndelete.php. - */ - public static function onArticleUndelete( Title $title, $created, $comment ) { - - self::schedule( $title, 'edit' ); - return true; - - } - - - /** - * Callback for article revision changes. See - * revisiondelete/RevDelRevisionList.php. - */ - public static function onArticleRevisionVisibilitySet( $title, $revs ) { - - // TODO complete here with more info / the hidden fields perhaps ? - self::schedule( $title, 'rev_visibility', array( 'revs' => $revs ) ); - return true; - - } - - - /** - * Title move callback. See Title.php. - */ - public static function onTitleMoveComplete( $title, Title $newtitle, $user, $oldid, $newid ) { - - # Simply update both old and new title. - self::schedule( $title, 'delete', array( 'rev' => $oldid ) ); - self::schedule( $newtitle, 'edit', array( 'rev' => $newid ) ); - return true; - - } - - /** * File upload hook. See filerepo/file/LocalFile.php. * @@ -157,16 +102,6 @@ self::schedule( $file->getTitle(), 'file' ); return true; - - } - - /** - * Callback for article purge - */ - public static function onArticlePurge( $wikiPage ) { - - self::schedule( $wikiPage->getTitle(), 'edit' ); - return true; } } diff --git a/RestbaseUpdate.php b/RestbaseUpdate.php index f1b5b51..1a09bea 100644 --- a/RestbaseUpdate.php +++ b/RestbaseUpdate.php @@ -102,18 +102,8 @@ # Article edit/create $wgHooks['ArticleEditUpdates'][] = 'RestbaseUpdateHooks::onArticleEditUpdates'; - # Article delete/restore - $wgHooks['ArticleDeleteComplete'][] = 'RestbaseUpdateHooks::onArticleDeleteComplete'; - $wgHooks['ArticleUndelete'][] = 'RestbaseUpdateHooks::onArticleUndelete'; - # Revision delete/restore - $wgHooks['ArticleRevisionVisibilitySet'][] = 'RestbaseUpdateHooks::onArticleRevisionVisibilitySet'; - # Article move - $wgHooks['TitleMoveComplete'][] = 'RestbaseUpdateHooks::onTitleMoveComplete'; # File upload $wgHooks['FileUpload'][] = 'RestbaseUpdateHooks::onFileUpload'; - # Article purge - $wgHooks['ArticlePurge'][] = 'RestbaseUpdateHooks::onArticlePurge'; - } diff --git a/RestbaseUpdateJob.php b/RestbaseUpdateJob.php index 5204055..351224c 100644 --- a/RestbaseUpdateJob.php +++ b/RestbaseUpdateJob.php @@ -67,21 +67,6 @@ /** - * Construct a revision ID invalidation URL - * - * @param $revid integer the revision ID to invalidate - * @return string an absolute URL for the revision - */ - private static function getRevisionURL( $revid ) { - - // construct the URL - return implode( '/', array( self::getRestbasePrefix(), - 'page', 'revision', $revid ) ); - - } - - - /** * Construct a page title invalidation URL * * @param $title Title @@ -94,17 +79,6 @@ return implode( '/', array( self::getRestbasePrefix(), 'page', 'html', urlencode( $title->getPrefixedDBkey() ), $revid ) ); - } - - /** - * Construct a last title revision URL - * - * @param Title $title a page title - * @return string an absolute URL of a last revision of a title - */ - private static function getTitleLatestRevisionURL(Title $title) { - return implode( '/', array( self::getRestbasePrefix(), 'page', - 'title', urlencode( $title->getPrefixedDBkey() ) ) ); } /** @@ -140,18 +114,7 @@ return true; } - if ( $this->params['type'] === 'OnEdit' ) { - // there are two cases here: - // a) this is a rev_visibility action - // b) this is some type of a page edit - if ( $this->params['mode'] === 'rev_visibility' ) { - $this->signalRevChange(); - } elseif ( $this->params['mode'] === 'delete' ) { - $this->signalDeletedChange(); - } else { - $this->invalidateTitle(); - } - } elseif ( $this->params['type'] === 'OnDependencyChange' ) { + if ( $this->params['type'] === 'OnDependencyChange' ) { // recursive update of linked pages static $expected = array( 'recursive', 'pages' ); // new jobs have one of these if ( !array_intersect( array_keys( $this->params ), $expected ) ) { @@ -229,82 +192,6 @@ // ok, all good return true; - } - - - /** - * Signals to RESTBase a change has happened in the - * visibility of a revision - */ - protected function signalRevChange() { - - // construct the requests - $requests = array(); - foreach( $this->params['revs'] as $revid ) { - $requests[] = array( - 'method' => 'GET', - 'url' => self::getRevisionURL( $revid ), - 'headers' => array( - 'Cache-control' => 'no-cache' - ) - ); - } - - // dispatch the requests - ///wfDebug( "RestbaseUpdateJob::signalRevChange: " . json_encode( $requests ) . "\n" ); - $this->dispatchRequests( $requests ); - - return $this->getLastError() == null; - - } - - - /** - * Invalidate a single title object after an edit. Send headers that let - * RESTBase/Parsoid reuse transclusion and extension expansions. - */ - protected function invalidateTitle() { - - $title = $this->title; - $latest = $title->getLatestRevID(); - $previous = $title->getPreviousRevisionID( $latest ); - - $requests = array( array( - 'method' => 'GET', - 'url' => self::getPageTitleURL( $title, $latest ), - 'headers' => array( - 'X-Restbase-ParentRevision' => $previous, - 'If-Unmodified-Since' => date( 'r', intval( $this->params['ts'] ) ), - 'Cache-control' => 'no-cache' - ) - ) ); - ///wfDebug( "RestbaseUpdateJob::invalidateTitle: " . json_encode( $requests ) . "\n" ); - $this->dispatchRequests( $requests ); - - return $this->getLastError() == null; - - } - - /** - * Signals to RESTBase a page was deleted - */ - protected function signalDeletedChange() { - $title = $this->title; - - // construct the requests - $requests = array( array( - 'method' => 'GET', - 'url' => self::getTitleLatestRevisionURL( $title ), - 'headers' => array( - 'Cache-control' => 'no-cache' - ) - ) ); - - // dispatch the requests - //wfDebug( "RestbaseUpdateJob::signalRevChange: " . json_encode( $requests ) . "\n" ); - $this->dispatchRequests( $requests ); - - return $this->getLastError() == null; } /** -- To view, visit https://gerrit.wikimedia.org/r/290908 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic752c3353fcfb2de20ba0806f3a96fa3bf106202 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/RestBaseUpdateJobs Gerrit-Branch: master Gerrit-Owner: Ppchelko <[email protected]> Gerrit-Reviewer: Mobrovac <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
