* @return null|string
*/
protected function getContent( $title ) {
- if ( $title->getNamespace() === NS_MEDIAWIKI ) {
- // The first "true" is to use the database, the second is to use the content langue
- // and the last one is to specify the message key already contains the language in it ("/de", etc.)
- $text = MessageCache::singleton()->get( $title->getDBkey(), true, true, true );
- return $text === false ? '' : $text;
- }
if ( !$title->isCssJsSubpage() && !$title->isCssOrJsPage() ) {
return null;
}
- $revision = Revision::newFromTitle( $title );
+ $revision = Revision::newFromTitle( $title, false, Revision::READ_NORMAL );
if ( !$revision ) {
return null;
}
$content = $revision->getContent( Revision::RAW );
+
+ if ( !$content ) {
+ wfDebug( __METHOD__ . "failed to load content of JS/CSS page!\n" );
+ return null;
+ }
+
$model = $content->getModel();
if ( $model !== CONTENT_MODEL_CSS && $model !== CONTENT_MODEL_JAVASCRIPT ) {
- wfDebug( __METHOD__ . "bad content model #$model for JS/CSS page!\n" );
+ wfDebug( __METHOD__ . "bad content model $model for JS/CSS page!\n" );
return null;
}
}
$style = CSSMin::remap( $style, false, $wgScriptPath, true );
if ( !isset( $styles[$media] ) ) {
- $styles[$media] = '';
+ $styles[$media] = array();
}
if ( strpos( $titleText, '*/' ) === false ) {
- $styles[$media] .= "/* $titleText */\n";
+ $style = "/* $titleText */\n" . $style;
}
- $styles[$media] .= $style . "\n";
+ $styles[$media][] = $style;
}
return $styles;
}
// We're dealing with a subclass that doesn't have a DB
return array();
}
-
+
$hash = $context->getHash();
if ( isset( $this->titleMtimes[$hash] ) ) {
return $this->titleMtimes[$hash];