r81874 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81873‎ | r81874 | r81875 >
Date:03:00, 10 February 2011
Author:aaron
Status:deferred
Tags:
Comment:
* Removed 'noindex,nofollow' for draft versions that are synced with the stable (bug 27173)
* Follow-up r81810: fixed isPageView()/isDefaultPageView()...type check was too weak
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -181,7 +181,8 @@
182182 * @returns bool
183183 */
184184 protected function isPageView( WebRequest $request ) {
185 - return $this->isPageViewOrDiff( $request ) && !$request->getVal( 'diff' );
 185+ return $this->isPageViewOrDiff( $request )
 186+ && $request->getVal( 'diff' ) === null;
186187 }
187188
188189 /**
@@ -195,10 +196,11 @@
196197 ? $mediaWiki->getAction( $request )
197198 : $request->getVal( 'action', 'view' ); // cli
198199 return ( self::isViewAction( $action )
199 - && !$request->getVal( 'oldid' )
200 - && !$request->getVal( 'stable' )
201 - && !$request->getVal( 'stableid' )
202 - && !$request->getVal( 'diff' ) );
 200+ && $request->getVal( 'oldid' ) === null
 201+ && $request->getVal( 'stable' ) === null
 202+ && $request->getVal( 'stableid' ) === null
 203+ && $request->getVal( 'diff' ) === null
 204+ );
203205 }
204206
205207 /**
@@ -374,18 +376,23 @@
375377
376378 /**
377379 * If the page has a stable version and it shows by default,
378 - * tell bots to index only that version of the page.
379 - * @TODO: what about viewing the draft but when it is synced?
 380+ * tell search crawlers to index only that version of the page.
 381+ * Also index the draft as well if they are synced (bug 27173).
 382+ * However, any URL with ?stableid=x should not be indexed (as with ?oldid=x).
380383 */
381384 public function setRobotPolicy() {
382 - global $wgOut;
383 - if ( !$this->article->getStableRev() ) {
384 - return true; // page has no stable version
385 - }
386 - if ( $this->article->isStableShownByDefault() && !$this->showingStable() ) {
 385+ global $wgRequest, $wgOut;
 386+ if ( $this->article->getStableRev() && $this->article->isStableShownByDefault() ) {
 387+ if ( $this->showingStable() ) {
 388+ return; // stable version - index this
 389+ } elseif ( !$wgRequest->getVal( 'stableid' )
 390+ && $wgOut->getRevisionId() == $this->article->getStable()
 391+ && $this->article->stableVersionIsSynced() )
 392+ {
 393+ return; // draft that is synced with the stable version - index this
 394+ }
387395 $wgOut->setRobotPolicy( 'noindex,nofollow' ); // don't index this version
388396 }
389 - return true;
390397 }
391398
392399 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r81810* Rewrote pageOverride() function into different functions, showingStable() t...aaron08:52, 9 February 2011

Status & tagging log