Liangent has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/148965

Change subject: Send 404 in various special pages when there're no results
......................................................................

Send 404 in various special pages when there're no results

Bug: 67182
Change-Id: I442645d8b98731282768e6cc19a8f426b1d0b519
---
M includes/specialpage/ChangesListSpecialPage.php
M includes/specials/SpecialContributions.php
M includes/specials/SpecialRecentchanges.php
M includes/specials/SpecialWhatlinkshere.php
4 files changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/65/148965/1

diff --git a/includes/specialpage/ChangesListSpecialPage.php 
b/includes/specialpage/ChangesListSpecialPage.php
index 008200d..80c612f 100644
--- a/includes/specialpage/ChangesListSpecialPage.php
+++ b/includes/specialpage/ChangesListSpecialPage.php
@@ -54,6 +54,7 @@
                if ( $rows === false ) {
                        if ( !$this->including() ) {
                                $this->doHeader( $opts );
+                               $this->getOutput()->setStatusCode( 404 );
                        }
 
                        return;
diff --git a/includes/specials/SpecialContributions.php 
b/includes/specials/SpecialContributions.php
index 251ac51..a884a39 100644
--- a/includes/specials/SpecialContributions.php
+++ b/includes/specials/SpecialContributions.php
@@ -255,6 +255,9 @@
                                                wfEscapeWikiText( 
$userObj->getName() ),
                                        )
                                );
+                               if ( !$this->including() ) {
+                                       $this->getOutput()->setStatusCode( 404 
);
+                               }
                        }
                        $user = htmlspecialchars( $userObj->getName() );
                } else {
diff --git a/includes/specials/SpecialRecentchanges.php 
b/includes/specials/SpecialRecentchanges.php
index aa8ed82..c3d9d3e 100644
--- a/includes/specials/SpecialRecentchanges.php
+++ b/includes/specials/SpecialRecentchanges.php
@@ -344,6 +344,9 @@
                                $this->msg( 'recentchanges-noresult' )->parse() 
.
                                '</div>'
                        );
+                       if ( !$this->including() ) {
+                               $this->getOutput()->setStatusCode( 404 );
+                       }
                } else {
                        $this->getOutput()->addHTML( $rclistOutput );
                }
diff --git a/includes/specials/SpecialWhatlinkshere.php 
b/includes/specials/SpecialWhatlinkshere.php
index 694bc83..a3f71d1 100644
--- a/includes/specials/SpecialWhatlinkshere.php
+++ b/includes/specials/SpecialWhatlinkshere.php
@@ -208,6 +208,7 @@
                                        }
                                        $errMsg = is_int( $namespace ) ? 
'nolinkshere-ns' : 'nolinkshere';
                                        $out->addWikiMsg( $errMsg, 
$this->target->getPrefixedText() );
+                                       $out->setStatusCode( 404 );
                                }
                        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I442645d8b98731282768e6cc19a8f426b1d0b519
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Liangent <liang...@gmail.com>

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

Reply via email to