Merge "Apply $wgMaxArticleSize more exactly"
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderModule.php
index 13f13e6..59f9a63 100644 (file)
@@ -35,6 +35,12 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
        const TYPE_STYLES = 'styles';
        const TYPE_COMBINED = 'combined';
 
+       # Desired load type
+       // Module only has styles (loaded via <style> or <link rel=stylesheet>)
+       const LOAD_STYLES = 'styles';
+       // Module may have other resources (loaded via mw.loader from a script)
+       const LOAD_GENERAL = 'general';
+
        # sitewide core module like a skin file or jQuery component
        const ORIGIN_CORE_SITEWIDE = 1;
 
@@ -114,16 +120,6 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                return $this->origin;
        }
 
-       /**
-        * Set this module's origin. This is called by ResourceLoader::register()
-        * when registering the module. Other code should not call this.
-        *
-        * @param int $origin Origin
-        */
-       public function setOrigin( $origin ) {
-               $this->origin = $origin;
-       }
-
        /**
         * @param ResourceLoaderContext $context
         * @return bool
@@ -353,6 +349,16 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                return $this->targets;
        }
 
+       /**
+        * Get the module's load type.
+        *
+        * @since 1.28
+        * @return string ResourceLoaderModule LOAD_* constant
+        */
+       public function getType() {
+               return self::LOAD_GENERAL;
+       }
+
        /**
         * Get the skip function.
         *
@@ -453,7 +459,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                                        ]
                                );
 
-                               $dbw->onTransactionIdle( function () use ( &$scopeLock ) {
+                               $dbw->onTransactionResolution( function () use ( &$scopeLock ) {
                                        ScopedCallback::consume( $scopeLock ); // release after commit
                                } );
                        }