jenkins-bot has submitted this change and it was merged.
Change subject: Make if checks in RequestContext.php more concise
......................................................................
Make if checks in RequestContext.php more concise
Change-Id: Ieb1eaeb595fc77ba926ba6ff96140dff44ba840f
---
M includes/context/RequestContext.php
1 file changed, 6 insertions(+), 10 deletions(-)
Approvals:
Krinkle: Looks good to me, but someone else must approve
Parent5446: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/context/RequestContext.php
b/includes/context/RequestContext.php
index efdc6db..2c051ba 100644
--- a/includes/context/RequestContext.php
+++ b/includes/context/RequestContext.php
@@ -154,18 +154,14 @@
* @return bool
*/
public function canUseWikiPage() {
- if ( $this->wikipage !== null ) {
- # If there's a WikiPage object set, we can for sure get
it
+ if ( $this->wikipage ) {
+ // If there's a WikiPage object set, we can for sure
get it
return true;
}
+ // Only pages with legitimate titles can have WikiPages.
+ // That usually means pages in non-virtual namespaces.
$title = $this->getTitle();
- if ( $title === null ) {
- # No Title, no WikiPage
- return false;
- } else {
- # Only namespaces whose pages are stored in the
database can have WikiPage
- return $title->canExist();
- }
+ return $title ? $title->canExist() : false;
}
/**
@@ -261,7 +257,7 @@
$code = strtolower( $code );
# Validate $code
- if ( empty( $code ) || !Language::isValidCode( $code ) || (
$code === 'qqq' ) ) {
+ if ( !$code || !Language::isValidCode( $code ) || $code ===
'qqq' ) {
wfDebug( "Invalid user language code\n" );
$code = $wgLanguageCode;
}
--
To view, visit https://gerrit.wikimedia.org/r/145423
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ieb1eaeb595fc77ba926ba6ff96140dff44ba840f
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Withoutaname <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Withoutaname <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits