Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php |
— | — | @@ -181,7 +181,8 @@ |
182 | 182 | * @returns bool |
183 | 183 | */ |
184 | 184 | protected function isPageView( WebRequest $request ) { |
185 | | - return $this->isPageViewOrDiff( $request ) && !$request->getVal( 'diff' ); |
| 185 | + return $this->isPageViewOrDiff( $request ) |
| 186 | + && $request->getVal( 'diff' ) === null; |
186 | 187 | } |
187 | 188 | |
188 | 189 | /** |
— | — | @@ -195,10 +196,11 @@ |
196 | 197 | ? $mediaWiki->getAction( $request ) |
197 | 198 | : $request->getVal( 'action', 'view' ); // cli |
198 | 199 | 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 | + ); |
203 | 205 | } |
204 | 206 | |
205 | 207 | /** |
— | — | @@ -374,18 +376,23 @@ |
375 | 377 | |
376 | 378 | /** |
377 | 379 | * 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). |
380 | 383 | */ |
381 | 384 | 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 | + } |
387 | 395 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); // don't index this version |
388 | 396 | } |
389 | | - return true; |
390 | 397 | } |
391 | 398 | |
392 | 399 | /** |