* Array of wikis, should be the same as $wgLocalDatabases
*/
public $wikis = array();
-
+
/**
* The whole array of settings
*/
* 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
$params = $this->mergeParams( $wiki, $suffix, $params, $wikiTags );
return $this->getSetting( $settingName, $wiki, $params );
}
-
+
/**
* Really retrieves a configuration setting for a given wiki.
*
} elseif( array_key_exists( "+$wiki", $thisSetting ) && is_array( $thisSetting["+$wiki"] ) ) {
$retval = $thisSetting["+$wiki"];
}
-
+
// Do tag settings
foreach( $params['tags'] as $tag ) {
if( array_key_exists( $tag, $thisSetting ) ) {
$retval = self::arrayMerge( $retval, $thisSetting["+$suffix"] );
}
}
-
+
// Fall back to default.
if( array_key_exists( 'default', $thisSetting ) ) {
if( is_array( $retval ) && is_array( $thisSetting['default'] ) ) {
if( !isset( $ret[$name] ) || ( is_array( $default[$name] ) && !is_array( $ret[$name] ) ) )
$ret[$name] = $default[$name];
}
-
+
return $ret;
}
$ret['tags'] = array_unique( array_merge( $ret['tags'], $wikiTags ) );
+ $ret['params'] += $params;
+
// Automatically fill that ones if needed
if( !isset( $ret['params']['lang'] ) && !is_null( $ret['lang'] ) )
$ret['params']['lang'] = $ret['lang'];
if( !isset( $ret['params']['site'] ) && !is_null( $ret['suffix'] ) )
$ret['params']['site'] = $ret['suffix'];
-
- $ret['params'] += $params;
+
return $ret;
}
*/
public function siteFromDB( $db ) {
// Allow override
- $def = $this->getWikiParams( $db );
+ $def = $this->getWikiParams( $db );
if( !is_null( $def['suffix'] ) && !is_null( $def['lang'] ) )
return array( $def['suffix'], $def['lang'] );
public function isLocalVHost( $vhost ) {
return in_array( $vhost, $this->localVHosts );
}
-
+
/**
* Merge multiple arrays together.
* On encountering duplicate keys, merge the two, but ONLY if they're arrays.
}
}
}
-
+
return $out;
}
+
+ public function loadFullData() {
+ if ($this->fullLoadCallback && !$this->fullLoadDone) {
+ call_user_func( $this->fullLoadCallback, $this );
+ $this->fullLoadDone = true;
+ }
+ }
}
-}
+} // End of multiple inclusion guard