Legoktm has uploaded a new change for review.

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

Change subject: installer: Reduce some code duplication in 
LocalSettingsGenerator
......................................................................

installer: Reduce some code duplication in LocalSettingsGenerator

Change-Id: Ie3c2e56ac4d20d6d547e89a4d6c6331f4222409b
---
M includes/installer/LocalSettingsGenerator.php
1 file changed, 12 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/37/201137/1

diff --git a/includes/installer/LocalSettingsGenerator.php 
b/includes/installer/LocalSettingsGenerator.php
index 8724e0d..3ba5e37 100644
--- a/includes/installer/LocalSettingsGenerator.php
+++ b/includes/installer/LocalSettingsGenerator.php
@@ -143,8 +143,7 @@
 # The following skins were automatically enabled:\n";
 
                        foreach ( $this->skins as $skinName ) {
-                               $encSkinName = self::escapePhpString( $skinName 
);
-                               $localSettings .= "require_once 
\"\$IP/skins/$encSkinName/$encSkinName.php\";\n";
+                               $localSettings .= 
$this->generateRequireOnceLine( 'skins', $skinName );
                        }
 
                        $localSettings .= "\n";
@@ -157,8 +156,7 @@
 # The following extensions were automatically enabled:\n";
 
                        foreach ( $this->extensions as $extName ) {
-                               $encExtName = self::escapePhpString( $extName );
-                               $localSettings .= "require_once 
\"\$IP/extensions/$encExtName/$encExtName.php\";\n";
+                               $localSettings .= 
$this->generateRequireOnceLine( 'extensions', $extName );
                        }
 
                        $localSettings .= "\n";
@@ -172,6 +170,16 @@
        }
 
        /**
+        * @param string $dir Either "extensions" or "skins"
+        * @param string $name Name of extension/skin
+        * @return string
+        */
+       private function generateRequireOnceLine( $dir, $name ) {
+               $encName = self::escapePhpString( $name );
+               return "require_once \"\$IP/$dir/$encName/$encName.php\";\n";
+       }
+
+       /**
         * Write the generated LocalSettings to a file
         *
         * @param string $fileName Full path to filename to write to

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie3c2e56ac4d20d6d547e89a4d6c6331f4222409b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to