Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/196982
Change subject: [WIP] Don't check content model in Title::isCssSubpage() and
Title::isJsSubpage()
......................................................................
[WIP] Don't check content model in Title::isCssSubpage() and
Title::isJsSubpage()
Change-Id: I0938012ed7ccce15952364dce6d2d631a8c1fc6a
---
M includes/Title.php
1 file changed, 8 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/82/196982/1
diff --git a/includes/Title.php b/includes/Title.php
index f47300c..e6a0dc1 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -1247,8 +1247,8 @@
*/
public function isCssJsSubpage() {
return ( NS_USER == $this->mNamespace && $this->isSubpage()
- && ( $this->hasContentModel( CONTENT_MODEL_CSS )
- || $this->hasContentModel(
CONTENT_MODEL_JAVASCRIPT ) ) );
+ && ( $this->isCssSubpage()
+ || $this->isJsSubpage() ) );
}
/**
@@ -1268,22 +1268,26 @@
/**
* Is this a .css subpage of a user page?
+ * This does not check if the page content is actually CSS,
+ * just that the title ends with ".css"
*
* @return bool
*/
public function isCssSubpage() {
return ( NS_USER == $this->mNamespace && $this->isSubpage()
- && $this->hasContentModel( CONTENT_MODEL_CSS ) );
+ && preg_match( "/\\/.*\\.css$/", $this->getText() ) );
}
/**
* Is this a .js subpage of a user page?
+ * This does not check if the page content is actually JavaScript,
+ * just that the title ends with ".js"
*
* @return bool
*/
public function isJsSubpage() {
return ( NS_USER == $this->mNamespace && $this->isSubpage()
- && $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT ) );
+ && preg_match( "/\\/.*\\.js$/", $this->getText() ) );
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/196982
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0938012ed7ccce15952364dce6d2d631a8c1fc6a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits