dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "ResourceLoaderOOUIImageModule: Actually load non-default themes' images"
[lhc/web/wiklou.git]
/
includes
/
resourceloader
/
ResourceLoaderWikiModule.php
diff --git
a/includes/resourceloader/ResourceLoaderWikiModule.php
b/includes/resourceloader/ResourceLoaderWikiModule.php
index
14d6e05
..
f6f14b3
100644
(file)
--- a/
includes/resourceloader/ResourceLoaderWikiModule.php
+++ b/
includes/resourceloader/ResourceLoaderWikiModule.php
@@
-149,6
+149,15
@@
class ResourceLoaderWikiModule extends ResourceLoaderModule {
return null;
}
return null;
}
+ // If the page is a redirect, follow the redirect.
+ if ( $title->isRedirect() ) {
+ $content = $this->getContentObj( $title );
+ $title = $content ? $content->getUltimateRedirectTarget() : null;
+ if ( !$title ) {
+ return null;
+ }
+ }
+
$handler = ContentHandler::getForTitle( $title );
if ( $handler->isSupportedFormat( CONTENT_FORMAT_CSS ) ) {
$format = CONTENT_FORMAT_CSS;
$handler = ContentHandler::getForTitle( $title );
if ( $handler->isSupportedFormat( CONTENT_FORMAT_CSS ) ) {
$format = CONTENT_FORMAT_CSS;
@@
-158,6
+167,19
@@
class ResourceLoaderWikiModule extends ResourceLoaderModule {
return null;
}
return null;
}
+ $content = $this->getContentObj( $title );
+ if ( !$content ) {
+ return null;
+ }
+
+ return $content->serialize( $format );
+ }
+
+ /**
+ * @param Title $title
+ * @return Content|null
+ */
+ protected function getContentObj( Title $title ) {
$revision = Revision::newKnownCurrent( wfGetDB( DB_REPLICA ), $title->getArticleID(),
$title->getLatestRevID() );
if ( !$revision ) {
$revision = Revision::newKnownCurrent( wfGetDB( DB_REPLICA ), $title->getArticleID(),
$title->getLatestRevID() );
if ( !$revision ) {
@@
-165,13
+187,11
@@
class ResourceLoaderWikiModule extends ResourceLoaderModule {
}
$revision->setTitle( $title );
$content = $revision->getContent( Revision::RAW );
}
$revision->setTitle( $title );
$content = $revision->getContent( Revision::RAW );
-
if ( !$content ) {
wfDebugLog( 'resourceloader', __METHOD__ . ': failed to load content of JS/CSS page!' );
return null;
}
if ( !$content ) {
wfDebugLog( 'resourceloader', __METHOD__ . ': failed to load content of JS/CSS page!' );
return null;
}
-
- return $content->serialize( $format );
+ return $content;
}
/**
}
/**
@@
-268,7
+288,7
@@
class ResourceLoaderWikiModule extends ResourceLoaderModule {
return true;
}
return true;
}
- //
Bug 68
488: For other modules (i.e. ones that are called in cached html output) only check
+ //
T70
488: For other modules (i.e. ones that are called in cached html output) only check
// page existance. This ensures that, if some pages in a module are temporarily blanked,
// we don't end omit the module's script or link tag on some pages.
return count( $revisions ) === 0;
// page existance. This ensures that, if some pages in a module are temporarily blanked,
// we don't end omit the module's script or link tag on some pages.
return count( $revisions ) === 0;
@@
-357,6
+377,11
@@
class ResourceLoaderWikiModule extends ResourceLoaderModule {
}
}
}
}
+ if ( !$wikiModules ) {
+ // Nothing to preload
+ return;
+ }
+
$pageNames = array_keys( $allPages );
sort( $pageNames );
$hash = sha1( implode( '|', $pageNames ) );
$pageNames = array_keys( $allPages );
sort( $pageNames );
$hash = sha1( implode( '|', $pageNames ) );