Merge "Use config instead of globals for ImageGallery"
[lhc/web/wiklou.git] / includes / context / RequestContext.php
index 9c8a781..5178189 100644 (file)
@@ -421,6 +421,20 @@ class RequestContext implements IContextSource {
                return self::$instance;
        }
 
+       /**
+        * Get the RequestContext object associated with the main request
+        * and gives a warning to the log, to find places, where a context maybe is missing.
+        *
+        * @return RequestContext
+        * @since 1.24
+        */
+       public static function getMainAndWarn( $func = __METHOD__ ) {
+               wfDebug( $func . ' called without context. ' .
+                       "Using RequestContext::getMain() for sanity\n" );
+
+               return self::getMain();
+       }
+
        /**
         * Resets singleton returned by getMain(). Should be called only from unit tests.
         */