r48847 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48846‎ | r48847 | r48848 >
Date:01:16, 26 March 2009
Author:kim
Status:deferred
Tags:
Comment:
duplicate command, step 1
(isolate all unique elements in the LocalSettings file,
so that we can generate from scratch)
Modified paths:
  • /trunk/wikiation/installer/LocalSettings.php (added) (history)
  • /trunk/wikiation/installer/LocalSettings.php.template (deleted) (history)
  • /trunk/wikiation/installer/mediawiki_installer.py (modified) (history)

Diff [purge]

Index: trunk/wikiation/installer/LocalSettings.php.template
@@ -1,145 +0,0 @@
2 -<?php
3 -
4 -# This file was automatically generated by the MediaWiki installer.
5 -# If you make manual changes, please keep track in case you need to
6 -# recreate them later.
7 -#
8 -# See includes/DefaultSettings.php for all configurable settings
9 -# and their default values, but don't forget to make changes in _this_
10 -# file, not there.
11 -
12 -error_reporting( E_ALL | E_STRICT);
13 -
14 -# If you customize your file layout, set $IP to the directory that contains
15 -# the other MediaWiki files. It will be used as a base to locate files.
16 -if( defined( 'MW_INSTALL_PATH' ) ) {
17 - $IP = MW_INSTALL_PATH;
18 -} else {
19 - $IP = dirname( __FILE__ );
20 -}
21 -
22 -$path = array( $IP, "$IP/includes", "$IP/languages" );
23 -set_include_path( implode( PATH_SEPARATOR, $path ) . PATH_SEPARATOR . get_include_path() );
24 -
25 -require_once( "$IP/includes/DefaultSettings.php" );
26 -
27 -# If PHP's memory limit is very low, some operations may fail.
28 -# ini_set( 'memory_limit', '20M' );
29 -
30 -if ( $wgCommandLineMode ) {
31 - if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
32 - die( "This script must be run from the command line\n" );
33 - }
34 -}
35 -## Uncomment this to disable output compression
36 -# $wgDisableOutputCompression = true;
37 -
38 -$wgSitename = "Wikiation_<<TARGET>>";
39 -
40 -## The URL base path to the directory containing the wiki;
41 -## defaults for all runtime URL paths are based off of this.
42 -$wgScriptPath = "<<BASE_SCRIPTPATH>><<TARGET>>";
43 -$wgScriptExtension = ".php";
44 -
45 -
46 -## For more information on customizing the URLs please see:
47 -## http://www.mediawiki.org/wiki/Manual:Short_URL
48 -
49 -$wgEnableEmail = true;
50 -$wgEnableUserEmail = true;
51 -
52 -$wgEmergencyContact = "webmaster@localhost";
53 -$wgPasswordSender = "webmaster@localhost";
54 -
55 -## For a detailed description of the following switches see
56 -## http://www.mediawiki.org/wiki/Extension:Email_notification
57 -## and http://www.mediawiki.org/wiki/Extension:Email_notification
58 -## There are many more options for fine tuning available see
59 -## /includes/DefaultSettings.php
60 -## UPO means: this is also a user preference option
61 -$wgEnotifUserTalk = true; # UPO
62 -$wgEnotifWatchlist = true; # UPO
63 -$wgEmailAuthentication = true;
64 -
65 -$wgDBtype = "mysql";
66 -$wgDBserver = "localhost";
67 -$wgDBname = '<<TARGET>>';
68 -$wgDBuser = "root";
69 -$wgDBpassword = "";
70 -
71 -# MySQL specific settings
72 -$wgDBprefix = "";
73 -
74 -# MySQL table options to use during installation or update
75 -$wgDBTableOptions = "TYPE=InnoDB";
76 -
77 -# Experimental charset support for MySQL 4.1/5.0.
78 -$wgDBmysql5 = false;
79 -
80 -# Postgres specific settings
81 -$wgDBport = "5432";
82 -$wgDBmwschema = "mediawiki";
83 -$wgDBts2schema = "public";
84 -
85 -## Shared memory settings
86 -$wgMainCacheType = CACHE_ACCEL;
87 -$wgMemCachedServers = array();
88 -
89 -## To enable image uploads, make sure the 'images' directory
90 -## is writable, then set this to true:
91 -$wgEnableUploads = false;
92 -# $wgUseImageMagick = true;
93 -# $wgImageMagickConvertCommand = "/usr/bin/convert";
94 -
95 -## If you want to use image uploads under safe mode,
96 -## create the directories images/archive, images/thumb and
97 -## images/temp, and make them all writable. Then uncomment
98 -## this, if it's not already uncommented:
99 -# $wgHashedUploadDirectory = false;
100 -
101 -## If you have the appropriate support software installed
102 -## you can enable inline LaTeX equations:
103 -$wgUseTeX = false;
104 -
105 -$wgLocalInterwiki = $wgSitename;
106 -
107 -$wgLanguageCode = "en";
108 -
109 -$wgProxyKey = "eeedfbcf7f4e6238a2db7959e50e5e19d0e0c1a6500dbfaa5d38f6dabe801c76";
110 -
111 -## Default skin: you can change the default skin. Use the internal symbolic
112 -## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
113 -$wgDefaultSkin = 'monobook';
114 -
115 -## For attaching licensing metadata to pages, and displaying an
116 -## appropriate copyright notice / icon. GNU Free Documentation
117 -## License and Creative Commons licenses are supported so far.
118 -# $wgEnableCreativeCommonsRdf = true;
119 -$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
120 -$wgRightsUrl = "";
121 -$wgRightsText = "";
122 -$wgRightsIcon = "";
123 -# $wgRightsCode = ""; # Not yet used
124 -
125 -$wgDiff3 = "/usr/bin/diff3";
126 -
127 -# When you make changes to this configuration file, this will make
128 -# sure that cached pages are cleared.
129 -$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
130 -
131 -$wgGroupPermissions['*' ]['read'] = true;
132 -$wgGroupPermissions['*' ]['write'] = false;
133 -
134 -
135 -# No wiki is complete without a logo.
136 -$wgLogo="$wgScriptPath/Logo.png";
137 -
138 -# load Localsettings specific to particular modules
139 -
140 -$additional_settings=glob("$IP/LocalSettings/*.php");
141 -foreach ($additional_settings as $file) {
142 - require_once($file);
143 -}
144 -
145 -
146 -?>
Index: trunk/wikiation/installer/LocalSettings.php
@@ -0,0 +1,143 @@
 2+<?php
 3+
 4+# This file was automatically generated by the MediaWiki installer.
 5+# If you make manual changes, please keep track in case you need to
 6+# recreate them later.
 7+#
 8+# See includes/DefaultSettings.php for all configurable settings
 9+# and their default values, but don't forget to make changes in _this_
 10+# file, not there.
 11+
 12+error_reporting( E_ALL | E_STRICT);
 13+
 14+# If you customize your file layout, set $IP to the directory that contains
 15+# the other MediaWiki files. It will be used as a base to locate files.
 16+if( defined( 'MW_INSTALL_PATH' ) ) {
 17+ $IP = MW_INSTALL_PATH;
 18+} else {
 19+ $IP = dirname( __FILE__ );
 20+}
 21+
 22+$path = array( $IP, "$IP/includes", "$IP/languages" );
 23+set_include_path( implode( PATH_SEPARATOR, $path ) . PATH_SEPARATOR . get_include_path() );
 24+
 25+require_once( "$IP/includes/DefaultSettings.php" );
 26+
 27+# If PHP's memory limit is very low, some operations may fail.
 28+# ini_set( 'memory_limit', '20M' );
 29+
 30+if ( $wgCommandLineMode ) {
 31+ if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
 32+ die( "This script must be run from the command line\n" );
 33+ }
 34+}
 35+## Uncomment this to disable output compression
 36+# $wgDisableOutputCompression = true;
 37+
 38+require_once ("$IP/InstallerUniqueSettings.php");
 39+
 40+## The URL base path to the directory containing the wiki;
 41+## defaults for all runtime URL paths are based off of this.
 42+$wgScriptExtension = ".php";
 43+
 44+
 45+## For more information on customizing the URLs please see:
 46+## http://www.mediawiki.org/wiki/Manual:Short_URL
 47+
 48+$wgEnableEmail = true;
 49+$wgEnableUserEmail = true;
 50+
 51+$wgEmergencyContact = "webmaster@localhost";
 52+$wgPasswordSender = "webmaster@localhost";
 53+
 54+## For a detailed description of the following switches see
 55+## http://www.mediawiki.org/wiki/Extension:Email_notification
 56+## and http://www.mediawiki.org/wiki/Extension:Email_notification
 57+## There are many more options for fine tuning available see
 58+## /includes/DefaultSettings.php
 59+## UPO means: this is also a user preference option
 60+$wgEnotifUserTalk = true; # UPO
 61+$wgEnotifWatchlist = true; # UPO
 62+$wgEmailAuthentication = true;
 63+
 64+$wgDBtype = "mysql";
 65+$wgDBserver = "localhost";
 66+$wgDBuser = "root";
 67+$wgDBpassword = "";
 68+
 69+# MySQL specific settings
 70+$wgDBprefix = "";
 71+
 72+# MySQL table options to use during installation or update
 73+$wgDBTableOptions = "TYPE=InnoDB";
 74+
 75+# Experimental charset support for MySQL 4.1/5.0.
 76+$wgDBmysql5 = false;
 77+
 78+# Postgres specific settings
 79+$wgDBport = "5432";
 80+$wgDBmwschema = "mediawiki";
 81+$wgDBts2schema = "public";
 82+
 83+## Shared memory settings
 84+$wgMainCacheType = CACHE_ACCEL;
 85+$wgMemCachedServers = array();
 86+
 87+## To enable image uploads, make sure the 'images' directory
 88+## is writable, then set this to true:
 89+$wgEnableUploads = false;
 90+# $wgUseImageMagick = true;
 91+# $wgImageMagickConvertCommand = "/usr/bin/convert";
 92+
 93+## If you want to use image uploads under safe mode,
 94+## create the directories images/archive, images/thumb and
 95+## images/temp, and make them all writable. Then uncomment
 96+## this, if it's not already uncommented:
 97+# $wgHashedUploadDirectory = false;
 98+
 99+## If you have the appropriate support software installed
 100+## you can enable inline LaTeX equations:
 101+$wgUseTeX = false;
 102+
 103+$wgLocalInterwiki = $wgSitename;
 104+
 105+$wgLanguageCode = "en";
 106+
 107+$wgProxyKey = "eeedfbcf7f4e6238a2db7959e50e5e19d0e0c1a6500dbfaa5d38f6dabe801c76";
 108+
 109+## Default skin: you can change the default skin. Use the internal symbolic
 110+## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
 111+$wgDefaultSkin = 'monobook';
 112+
 113+## For attaching licensing metadata to pages, and displaying an
 114+## appropriate copyright notice / icon. GNU Free Documentation
 115+## License and Creative Commons licenses are supported so far.
 116+# $wgEnableCreativeCommonsRdf = true;
 117+$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
 118+$wgRightsUrl = "";
 119+$wgRightsText = "";
 120+$wgRightsIcon = "";
 121+# $wgRightsCode = ""; # Not yet used
 122+
 123+$wgDiff3 = "/usr/bin/diff3";
 124+
 125+# When you make changes to this configuration file, this will make
 126+# sure that cached pages are cleared.
 127+$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
 128+
 129+$wgGroupPermissions['*' ]['read'] = true;
 130+$wgGroupPermissions['*' ]['write'] = false;
 131+
 132+
 133+# No wiki is complete without a logo.
 134+$wgLogo="$wgScriptPath/Logo.png";
 135+
 136+# load Localsettings specific to particular modules
 137+
 138+$additional_settings=glob("$IP/LocalSettings/*.php");
 139+foreach ($additional_settings as $file) {
 140+ require_once($file);
 141+}
 142+
 143+
 144+?>
Index: trunk/wikiation/installer/mediawiki_installer.py
@@ -227,16 +227,25 @@
228228
229229
230230 def localsettings(target):
231 - """create a localSettings.php file, for target mediawiki instance based
232 - on the LocalSettings.php.template file
 231+ """Copy over our LocalSettings.php , and create InstallerUniqueSettings.php
 232+ (which contains settings unique to this instance)
233233 LocalSettings.php is the main configuration file for mediawiki."""
234234
235 - template=settings.installerdir+"/LocalSettings.php.template"
236 - localsettings=settings.instancesdir+"/"+target+"/LocalSettings.php"
237 - replacements={'<<TARGET>>':target,"<<BASE_SCRIPTPATH>>":settings.base_scriptpath}
238 - replace_generic(replacements,template,localsettings)
239 - subdir=settings.instancesdir+"/"+target+"/LocalSettings"
240 - os.mkdir(subdir)
 235+ here=settings.installerdir+"/LocalSettings.php"
 236+ instancedir=settings.instancesdir+"/"+target
 237+ there=instancedir+"/LocalSettings.php"
 238+ shutil.copy2(here,there)
 239+
 240+ uniquesettings=settings.instancesdir+"/"+target+"/InstallerUniqueSettings.php"
 241+ unique=file(uniquesettings,"w")
 242+ unique.write('<?php\n')
 243+ unique.write('$wgSitename = "Wikiation_'+target+'";\n')
 244+ unique.write('$wgScriptPath = "'+settings.base_scriptpath+"/"+target+'";\n')
 245+ unique.write('$wgDBname = "'+target+'";\n')
 246+ unique.write('?>\n')
 247+
 248+ unique.close()
 249+
241250
242251 def logo(target):
243252 """copy a nice logo"""

Status & tagging log