Seb35 has uploaded a new change for review. https://gerrit.wikimedia.org/r/299403
Change subject: Added support for external executable config files ...................................................................... Added support for external executable config files --- M src/MediaWikiFarm.php M src/main.php 2 files changed, 33 insertions(+), 30 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MediaWikiFarm refs/changes/03/299403/1 diff --git a/src/MediaWikiFarm.php b/src/MediaWikiFarm.php index 2678076..317a22e 100644 --- a/src/MediaWikiFarm.php +++ b/src/MediaWikiFarm.php @@ -25,26 +25,26 @@ * Properties * ---------- */ - /** @var MediaWikiFarm|null [private] Singleton. */ + /** @var MediaWikiFarm|null Singleton. */ private static $self = null; - /** @var string [private] Farm configuration directory. */ + /** @var string Farm configuration directory. */ private $configDir = ''; - /** @var string|null [private] MediaWiki code directory, where each subdirectory is a MediaWiki installation. */ + /** @var string|null MediaWiki code directory, where each subdirectory is a MediaWiki installation. */ private $codeDir = null; - /** @var string|null [private] MediaWiki cache directory. */ + /** @var string|null MediaWiki cache directory. */ private $cacheDir = null; - /** @var bool [private] This object cannot be used because of an emergency error. */ + /** @var bool This object cannot be used because of an emergency error. */ public $unusable = false; - /** @var array [private] Farm configuration file. */ - public $params = array(); - - /** @var array [private] Variables related to the current request. */ + /** @var array Variables related to the current request. */ public $variables = array(); + + /** @var array Configuration parameters for this wiki. */ + public $params = array(); @@ -154,7 +154,7 @@ function loadMediaWikiConfig() { if( $this->unusable ) - return false; + return; if( !is_array( $this->params['globals'] ) ) $this->getMediaWikiConfig(); @@ -178,7 +178,7 @@ function loadSkinsConfig() { if( $this->unusable ) - return false; + return; // Load skins with the wfLoadSkin mechanism foreach( $this->params['globals']['skins'] as $skin => $value ) { @@ -211,7 +211,7 @@ function loadExtensionsConfig() { if( $this->unusable ) - return false; + return; // Load extensions with the wfLoadExtension mechanism foreach( $this->params['globals']['extensions'] as $extension => $value ) { @@ -553,7 +553,8 @@ $this->params['globals'] = array( 'general' => array(), 'skins' => array(), - 'extensions' => array() + 'extensions' => array(), + 'execFiles' => array(), ); $globals =& $this->params['globals']; @@ -603,7 +604,11 @@ foreach( $this->params['config'] as $configFile ) { # Executable config files - if( array_key_exists( 'exec', $configFile ) ) continue; + if( array_key_exists( 'exec', $configFile ) ) { + + $this->params['globals']['execFiles'][] = $this->configDir . '/' . $configFile['file']; + continue; + } $theseSettings = $this->readFile( $configFile['file'], $this->configDir ); if( $theseSettings === false ) { diff --git a/src/main.php b/src/main.php index 222c1f8..3768f45 100644 --- a/src/main.php +++ b/src/main.php @@ -10,14 +10,15 @@ # Protect against web entry if( !defined( 'MEDIAWIKI' ) ) exit; +# Class where the logic is require_once __DIR__ . '/MediaWikiFarm.php'; - -$wgMediaWikiFarm = MediaWikiFarm::initialise( $GLOBALS['_SERVER']['HTTP_HOST'] ); /* - * Check existence + * Verify existence of the wiki */ + +$wgMediaWikiFarm = MediaWikiFarm::initialise(); if( !$wgMediaWikiFarm->checkExistence() ) { @@ -30,16 +31,8 @@ * MediaWiki */ -// Load general MediaWiki configuration +# Load general MediaWiki configuration $wgMediaWikiFarm->loadMediaWikiConfig(); - - -// Set system parameters -$wvgClient = $wgMediaWikiFarm->variables['client']; -$wvgWiki = $wgMediaWikiFarm->variables['wiki']; - -$wgUploadDirectory = '/srv/www/mediawiki-farm/data/'.$wvgClient.'/'.$wvgWiki.'/images'; -$wgCacheDirectory = '/srv/www/mediawiki-farm/data/'.$wvgClient.'/'.$wvgWiki.'/cache'; /* @@ -71,8 +64,13 @@ # Load extensions with the wfLoadExtension mechanism $wgMediaWikiFarm->loadExtensionsConfig(); -// L’éditeur visuel cherchant toujours à se faire remarquer par les sysadmins, la -// ligne suivante est nécessaire tant qu’il est chargé avec require_once, car -// l’inclusion écrase cette valeur (même si spécifiée dans les fichiers YAML) -$wgDefaultUserOptions['visualeditor-enable'] = 1; + +/* + * Load other parameters + */ + +foreach( $wgMediaWikiFarm->params['globals']['execFiles'] as $execFile ) { + + @include $execFile; +} -- To view, visit https://gerrit.wikimedia.org/r/299403 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I058fca5c8b4916cba73aea8034739fb20afc4140 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MediaWikiFarm Gerrit-Branch: master Gerrit-Owner: Seb35 <seb35wikipe...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits