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

Change subject: Check if the article exists first before actually displaying it.
......................................................................


Check if the article exists first before actually displaying it.

This commit adds a check on whether the article actually exists
before displaying the last modified text in the header. Before this
patch, articles that do not exist will display an incorrect "Last
modified x seconds ago".

Bug: T43417
Change-Id: If333c8f57de00ff8ffbfe9ccebced22083675041
---
M LastModified.php
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Alex Monk: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/LastModified.php b/LastModified.php
index 61a35c8..8841e87 100644
--- a/LastModified.php
+++ b/LastModified.php
@@ -101,7 +101,7 @@
        $title = $context->getTitle();
        $article = Article::newFromTitle( $title, $context );
 
-       if ( $article && ( ( $title instanceof Title ) && 
$title->getNamespace() == 0 ) ) {
+       if ( $article && $title instanceof Title && $title->getNamespace() == 0 
&& $title->exists() ) {
                $timestamp = wfTimestamp ( TS_UNIX, $article->getTimestamp() );
                $out->addMeta( 'http:last-modified', date( 'r', $timestamp ) );
                $out->addMeta( 'last-modified-timestamp', $timestamp );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If333c8f57de00ff8ffbfe9ccebced22083675041
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/LastModified
Gerrit-Branch: master
Gerrit-Owner: Hydriz <ad...@alphacorp.tk>
Gerrit-Reviewer: Aklapper <aklap...@wikimedia.org>
Gerrit-Reviewer: Alex Monk <kren...@gmail.com>
Gerrit-Reviewer: Hydriz <ad...@alphacorp.tk>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
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