Don't always count CASCADINGSOURCES as expensive
[lhc/web/wiklou.git] / includes / Title.php
index 096a04d..f2de4b8 100644 (file)
@@ -2555,6 +2555,19 @@ class Title {
                return ( $sources > 0 );
        }
 
+       /**
+        * Determines whether cascading protection sources have already been loaded from
+        * the database.
+        *
+        * @param bool $getPages True to check if the pages are loaded, or false to check
+        * if the status is loaded.
+        * @return bool Whether or not the specified information has been loaded
+        * @since 1.23
+        */
+       public function areCascadeProtectionSourcesLoaded( $getPages = true ) {
+               return $getPages ? isset( $this->mCascadeSources ) : isset( $this->mHasCascadingRestrictions );
+       }
+
        /**
         * Cascading protection: Get the source of any cascading restrictions on this page.
         *
@@ -2655,6 +2668,17 @@ class Title {
                return array( $sources, $pagerestrictions );
        }
 
+       /**
+        * Accessor for mRestrictionsLoaded
+        *
+        * @return bool Whether or not the page's restrictions have already been
+        * loaded from the database
+        * @since 1.23
+        */
+       public function areRestrictionsLoaded() {
+               return $this->mRestrictionsLoaded;
+       }
+
        /**
         * Accessor/initialisation for mRestrictions
         *
@@ -2670,6 +2694,21 @@ class Title {
                                : array();
        }
 
+       /**
+        * Accessor/initialisation for mRestrictions
+        *
+        * @return Array of Arrays of Strings the first level indexed by
+        * action, the second level containing the names of the groups
+        * allowed to perform each action
+        * @since 1.23
+        */
+       public function getAllRestrictions() {
+               if ( !$this->mRestrictionsLoaded ) {
+                       $this->loadRestrictions();
+               }
+               return $this->mRestrictions;
+       }
+
        /**
         * Get the expiry time for the restriction against a given action
         *