Seb35 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/299399

Change subject: Added a sample LocalSettings.php for monoversion installations 
; removed all isset, replaced by array_key_exists when applicable
......................................................................

Added a sample LocalSettings.php for monoversion installations ; removed all 
isset, replaced by array_key_exists when applicable
---
A docs/config/LocalSettings.php
M src/MediaWikiFarm.php
2 files changed, 21 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MediaWikiFarm 
refs/changes/99/299399/1

diff --git a/docs/config/LocalSettings.php b/docs/config/LocalSettings.php
new file mode 100644
index 0000000..5681f46
--- /dev/null
+++ b/docs/config/LocalSettings.php
@@ -0,0 +1,18 @@
+<?php
+
+/**
+ * Configuration managed by MediaWikiFarm.
+ * 
+ * Just change the configuration directory, preferably in a directory not 
exposed on the Web.
+ * Then add the sample file farms.yml inside and start customising it.
+ */
+
+# Configuration directory.
+# There must be a file 'farms.yml' or 'farms.php' or 'farms.json' inside.
+$wgMediaWikiFarmConfigDir = '/etc/mediawiki';
+
+# Include the code.
+require_once "$IP/extensions/MediaWikiFarm/MediaWikiFarm.php";
+
+# Do not add other configuration here, but instead in the config files
+# read by MediaWikiFarm -- even for global settings.
diff --git a/src/MediaWikiFarm.php b/src/MediaWikiFarm.php
index 69e94cb..b43fa0f 100644
--- a/src/MediaWikiFarm.php
+++ b/src/MediaWikiFarm.php
@@ -364,7 +364,7 @@
                                if( !array_key_exists( $value, $choices ) )
                                        return false;
                                
-                               if( isset( $this->codeDir ) && is_dir( 
$this->codeDir . '/' . ((string) $choices[$value]) ) && is_file( $this->codeDir 
. '/' . ((string) $choices[$value]) . '/includes/DefaultSettings.php' ) )
+                               if( is_string( $this->codeDir ) && is_dir( 
$this->codeDir . '/' . ((string) $choices[$value]) ) && is_file( $this->codeDir 
. '/' . ((string) $choices[$value]) . '/includes/DefaultSettings.php' ) )
                                        $version = (string) $choices[$value];
                        }
                }
@@ -956,9 +956,9 @@
                $argsCount = func_num_args();
                for ( $i = 1; $i < $argsCount; $i++ ) {
                        foreach ( func_get_arg( $i ) as $key => $value ) {
-                               if( isset( $out[$key] ) && is_array( $out[$key] 
) && is_array( $value ) ) {
+                               if( array_key_exists( $key, $out ) && is_array( 
$out[$key] ) && is_array( $value ) ) {
                                        $out[$key] = self::arrayMerge( 
$out[$key], $value );
-                               } elseif( !isset( $out[$key] ) && !is_numeric( 
$key ) ) {
+                               } elseif( !array_key_exists( $key, $out ) && 
!is_numeric( $key ) ) {
                                        // Values that evaluate to true given 
precedence, for the
                                        // primary purpose of merging 
permissions arrays.
                                        $out[$key] = $value;

-- 
To view, visit https://gerrit.wikimedia.org/r/299399
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If5adcb58e5d13d5fdbc53048065354354630e009
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

Reply via email to