]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - includes/SiteConfiguration.php
MediaWiki 1.17.0
[autoinstallsdev/mediawiki.git] / includes / SiteConfiguration.php
index 2ed2813956d3fbec733c3a5bf5d6813e5a4ffb2c..f4a4576a5accb087771a8fceb2be87f862ecaefb 100644 (file)
@@ -36,6 +36,14 @@ class SiteConfiguration {
         * Array of domains that are local and can be handled by the same server
         */
        public $localVHosts = array();
+       
+       /**
+        * Optional callback to load full configuration data.
+        */
+       public $fullLoadCallback = null;
+       
+       /** Whether or not all data has been loaded */
+       public $fullLoadDone = false;
 
        /**
         * A callback function that returns an array with the following keys (all
@@ -186,10 +194,9 @@ class SiteConfiguration {
 
        /**
         * Retrieves a configuration setting for a given wiki, forced to a boolean.
-        * @param $settingName String ID of the setting name to retrieve
+        * @param $setting String ID of the setting name to retrieve
         * @param $wiki String Wiki ID of the wiki in question.
         * @param $suffix String The suffix of the wiki in question.
-        * @param $params Array List of parameters. $.'key' is replaced by $value in all returned data.
         * @param $wikiTags Array The tags assigned to the wiki.
         * @return bool The value of the setting requested.
         */
@@ -208,7 +215,7 @@ class SiteConfiguration {
 
        /**
         * Retrieves the value of a given setting, and places it in a variable passed by reference.
-        * @param $settingName String ID of the setting name to retrieve
+        * @param $setting String ID of the setting name to retrieve
         * @param $wiki String Wiki ID of the wiki in question.
         * @param $suffix String The suffix of the wiki in question.
         * @param $var Reference The variable to insert the value into.
@@ -224,7 +231,7 @@ class SiteConfiguration {
 
        /**
         * Retrieves the value of a given setting, and places it in its corresponding global variable.
-        * @param $settingName String ID of the setting name to retrieve
+        * @param $setting String ID of the setting name to retrieve
         * @param $wiki String Wiki ID of the wiki in question.
         * @param $suffix String The suffix of the wiki in question.
         * @param $params Array List of parameters. $.'key' is replaced by $value in all returned data.
@@ -286,8 +293,9 @@ class SiteConfiguration {
 
                $ret = call_user_func_array( $this->siteParamsCallback, array( $this, $wiki ) );
                # Validate the returned value
-               if( !is_array( $ret ) )
+               if( !is_array( $ret ) ) {
                        return $default;
+               }
 
                foreach( $default as $name => $def ){
                        if( !isset( $ret[$name] ) || ( is_array( $default[$name] ) && !is_array( $ret[$name] ) ) )
@@ -387,5 +395,12 @@ class SiteConfiguration {
 
                return $out;
        }
+       
+       public function loadFullData() {
+               if ($this->fullLoadCallback && !$this->fullLoadDone) {
+                       call_user_func( $this->fullLoadCallback, $this );
+                       $this->fullLoadDone = true;
+               }
+       }
 }
-}
+} // End of multiple inclusion guard