Merge "misc style issues"
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderWikiModule.php
index 28c3426..4ea9f4e 100644 (file)
@@ -42,7 +42,20 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule {
        /* Abstract Protected Methods */
 
        /**
+        * Subclasses should return an associative array of resources in the module.
+        * Keys should be the title of a page in the MediaWiki or User namespace.
+        *
+        * Values should be a nested array of options.  The supported keys are 'type' and
+        * (CSS only) 'media'.
+        *
+        * For scripts, 'type' should be 'script'.
+        *
+        * For stylesheets, 'type' should be 'style'.
+        * There is an optional media key, the value of which can be the
+        * medium ('screen', 'print', etc.) of the stylesheet.
+        *
         * @param $context ResourceLoaderContext
+        * @return array
         */
        abstract protected function getPages( ResourceLoaderContext $context );
 
@@ -77,10 +90,16 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule {
                }
 
                $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;
                }
 
@@ -128,7 +147,7 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule {
                                continue;
                        }
                        $title = Title::newFromText( $titleText );
-                       if ( !$title || $title->isRedirect()  ) {
+                       if ( !$title || $title->isRedirect() ) {
                                continue;
                        }
                        $media = isset( $options['media'] ) ? $options['media'] : 'all';