r3670 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r3669‎ | r3670 | r3671 >
Date:15:00, 23 May 2004
Author:timstarling
Status:old
Tags:
Comment:
configuration of the live site
Modified paths:
  • /trunk/phase3/includes/SiteConfiguration.php (added) (history)

Diff [purge]

Index: trunk/phase3/includes/SiteConfiguration.php
@@ -0,0 +1,64 @@
 2+<?php
 3+
 4+# This file is used to configure the live Wikimedia wikis. The file that includes
 5+# it contains passwords and other sensitive data, and there's currently no public
 6+# equivalent.
 7+
 8+class SiteConfiguration {
 9+ var $suffixes, $wikis, $settings;
 10+ var $localDatabases;
 11+
 12+ function get( $setting, $wiki, $suffix, $params = array() ) {
 13+ if ( array_key_exists( $this->settings[$setting], $wiki ) ) {
 14+ $retval = $this->settings[$setting][$wiki];
 15+ } elseif ( array_key_exists( $this->settings[$setting], $suffix ) ) {
 16+ $retval = $this->settings[$setting][$suffix];
 17+ } elseif ( array_key_exists( $this->settings[$setting], "default" ) ) {
 18+ $retval = $this->settings[$setting]['default'];
 19+ } else {
 20+ $retval = NULL;
 21+ }
 22+ if ( !is_null( $retval ) && count( $params ) ) {
 23+ foreach ( $params as $key => $value ) {
 24+ str_replace( "\${$key}", $value, $retval );
 25+ }
 26+ }
 27+ }
 28+
 29+ function getBool( $setting, $wiki, $suffix ) {
 30+ return (bool)($this->get( $setting, $wiki, $suffix ));
 31+ }
 32+
 33+ function &getLocalDatabases() {
 34+ return $this->localDatabases();
 35+ }
 36+
 37+ function initialise() {
 38+ foreach ( $this->wikis as $db ) {
 39+ $this->localDatabases[$db] = $db;
 40+ }
 41+ }
 42+
 43+ function extractVar( $setting, $wiki, $suffix, &$var, &$params ) {
 44+ $value = $this->get( $settings, $wiki, $suffix, $params );
 45+ if ( !is_null( $value ) ) {
 46+ $var = $value;
 47+ }
 48+ }
 49+
 50+ function extractGlobal( $setting, $wiki, $suffix, &$params ) {
 51+ $value = $this->get( $settings, $wiki, $suffix, $params );
 52+ if ( !is_null( $value ) ) {
 53+ $GLOBALS[$setting] = $value;
 54+ }
 55+ }
 56+
 57+ function extractAllGlobals( $wiki, $suffix, &$params ) {
 58+ foreach ( $settings as $varName => $setting ) {
 59+ $this->extractGlobal( $varName, $wiki, $suffix, $params );
 60+ }
 61+ }
 62+}
 63+
 64+
 65+?>
Property changes on: trunk/phase3/includes/SiteConfiguration.php
___________________________________________________________________
Name: svn:eol-style
166 + native
Name: svn:keywords
267 + Author Date Id Revision

Status & tagging log