X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSiteConfiguration.php;h=bd5e4d8c328f7c25db96a62bc921edb487cb9de9;hb=8263743db1106db6792e0a8f889db1b5f1432e6f;hp=db2910d29fddffeea19f9bf8a63299346449ed01;hpb=289ee10df615390384acbc9fa3bf4b476a44af62;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SiteConfiguration.php b/includes/SiteConfiguration.php index db2910d29f..bd5e4d8c32 100644 --- a/includes/SiteConfiguration.php +++ b/includes/SiteConfiguration.php @@ -1,17 +1,4 @@ get( $setting, $wiki, $suffix, array(), $wikiTags ) ); } - /** Retrieves an array of local databases */ + /** + * Retrieves an array of local databases + * + * @return array + */ function &getLocalDatabases() { return $this->wikis; } - /** A no-op */ - function initialise() { - } - /** * Retrieves the value of a given setting, and places it in a variable passed by reference. * @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. + * @param $var array Reference The variable to insert the value into. * @param $params Array List of parameters. $.'key' is replaced by $value in all returned data. * @param $wikiTags Array The tags assigned to the wiki. */ @@ -242,6 +234,11 @@ class SiteConfiguration { $this->extractGlobalSetting( $setting, $wiki, $params ); } + /** + * @param $setting string + * @param $wiki string + * @param $params array + */ public function extractGlobalSetting( $setting, $wiki, $params ) { $value = $this->getSetting( $setting, $wiki, $params ); if ( !is_null( $value ) ) { @@ -288,13 +285,15 @@ class SiteConfiguration { 'params' => array(), ); - if( !is_callable( $this->siteParamsCallback ) ) + if( !is_callable( $this->siteParamsCallback ) ) { return $default; + } $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] ) ) ) @@ -305,7 +304,7 @@ class SiteConfiguration { } /** - * Merge params beetween the ones passed to the function and the ones given + * Merge params between the ones passed to the function and the ones given * by self::$siteParamsCallback for backward compatibility * Values returned by self::getWikiParams() have the priority. * @@ -338,6 +337,8 @@ class SiteConfiguration { /** * Work out the site and language name from a database name * @param $db + * + * @return array */ public function siteFromDB( $db ) { // Allow override @@ -376,10 +377,14 @@ class SiteConfiguration { * On encountering duplicate keys, merge the two, but ONLY if they're arrays. * PHP's array_merge_recursive() merges ANY duplicate values into arrays, * which is not fun + * + * @param $array1 array + * + * @return array */ static function arrayMerge( $array1/* ... */ ) { $out = $array1; - for( $i=1; $i < func_num_args(); $i++ ) { + for( $i = 1; $i < func_num_args(); $i++ ) { foreach( func_get_arg( $i ) as $key => $value ) { if ( isset($out[$key]) && is_array($out[$key]) && is_array($value) ) { $out[$key] = self::arrayMerge( $out[$key], $value ); @@ -394,7 +399,7 @@ class SiteConfiguration { return $out; } - + public function loadFullData() { if ($this->fullLoadCallback && !$this->fullLoadDone) { call_user_func( $this->fullLoadCallback, $this ); @@ -402,4 +407,3 @@ class SiteConfiguration { } } } -} // End of multiple inclusion guard