Ori.livneh has uploaded a new change for review.

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


Change subject: init.d-style loading of configs from ./settings
......................................................................

init.d-style loading of configs from ./settings

See settings/README (included in commit) for explanation and rationale.

Change-Id: I7d7e402d547f9e47b98b97d2c1793754db801ed4
---
M LocalSettings.php
A settings/.gitignore
A settings/10-VisualEditor.php-sample
A settings/README
4 files changed, 65 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant 
refs/changes/62/57762/1

diff --git a/LocalSettings.php b/LocalSettings.php
index e4a37e1..2558480 100644
--- a/LocalSettings.php
+++ b/LocalSettings.php
@@ -39,3 +39,10 @@
                $wgProfiler['class'] = $cls;
        }
 }
+
+// Load configuration snippets from ./settings. See settings/README.
+foreach( glob( __DIR__ . '/settings/*.php' ) as $snippet ) {
+       if ( !include_once( $snippet ) ) {
+               echo "Failed to load \"$snippet\".\n";
+       }
+}
diff --git a/settings/.gitignore b/settings/.gitignore
new file mode 100644
index 0000000..078b995
--- /dev/null
+++ b/settings/.gitignore
@@ -0,0 +1,4 @@
+*
+!.gitignore
+!README
+!10-VisualEditor.php-sample
diff --git a/settings/10-VisualEditor.php-sample 
b/settings/10-VisualEditor.php-sample
new file mode 100644
index 0000000..570442d
--- /dev/null
+++ b/settings/10-VisualEditor.php-sample
@@ -0,0 +1,27 @@
+<?php
+
+// Configuration for VisualEditor extension.
+// Instructions from <http://www.mediawiki.org/wiki/Extension:VisualEditor>.
+
+require_once("$IP/extensions/VisualEditor/VisualEditor.php");
+
+// Create VisualEditor namespace
+define( 'NS_VISUALEDITOR', 2500 );
+define( 'NS_VISUALEDITOR_TALK', 2501 );
+$wgExtraNamespaces[NS_VISUALEDITOR] = 'VisualEditor';
+$wgExtraNamespaces[NS_VISUALEDITOR_TALK] = 'VisualEditor_talk';
+
+// Allow using VisualEditor in the main namespace only (default)
+$wgVisualEditorNamespaces = array( NS_MAIN );
+
+// Restrict VisualEditor to the VisualEditor namespace
+$wgVisualEditorNamespaces = array();
+$wgVisualEditorNamespaces[] = NS_VISUALEDITOR;
+
+// Enable by default for everybody
+$wgDefaultUserOptions['visualeditor-enable'] = 1;
+
+// Don't allow users to disable it
+$wgHiddenPrefs[] = 'visualeditor-enable';
+
+// vim: set ft=php:
diff --git a/settings/README b/settings/README
new file mode 100644
index 0000000..885480f
--- /dev/null
+++ b/settings/README
@@ -0,0 +1,27 @@
+                      _
+                     //
+       .-""""-.    ;(_\
+      /        \   /\_/
+     |    .---./  /  /
+      \ C'  '>'| /  /   PHP files placed in this directory will be
+       ';   - / /  /    automatically loaded, in alphabetical order, by
+       __)---;/`  /     LocalSettings.php.
+   _.-' \`"""`|  /
+ .'    _/      \/       Rather than clutter LocalSettings.php with the
+ \  -;'|       |        configuration variables and require statements for 
every
+  '-._/-.      |        extension you wish to load, collect all the 
configurations
+      \(-\     |        in a single file and place it in this directory. This
+       |-------|        makes it quite easy to keep your settings organized, to
+       |    J  |        remove or temporarily disable the additional settings, 
and
+       |    |  |        to share settings with others.
+       |    ;  |
+       |   /|  \        This directory is accessible as
+       | _/ T  /        '/vagrant/settings' in the guest environment.
+       |  | |  |
+       |  | |__|_       Because the files load alphabeticallly, you can use a
+       |__| '-.__)      two-digit prefix to tweak the load order -- e.g.:
+  jgs  \__)
+                            settings/
+                            ├── 10-RunFirst.php
+                            ├── 20-SomeExtension.php
+                            └── 99-RunLast.php

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7d7e402d547f9e47b98b97d2c1793754db801ed4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>

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

Reply via email to