r50631 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50630‎ | r50631 | r50632 >
Date:16:02, 15 May 2009
Author:kim
Status:deferred
Tags:
Comment:
Add the language option

eg.
install mediawiki:latest as ein_deutche_wiki language de
install mediawiki:latest as een_nederlandse_wiki language nl
install mediawiki:latest as un_wiki_francais language fr
Modified paths:
  • /trunk/testing/installer/LocalSettings.php (modified) (history)
  • /trunk/testing/installer/installation_system.py (modified) (history)
  • /trunk/testing/installer/installers.py (modified) (history)
  • /trunk/testing/installer/mediawiki_installer.py (modified) (history)
  • /trunk/testing/installer/settings_handler.py (modified) (history)

Diff [purge]

Index: trunk/testing/installer/settings_handler.py
@@ -72,6 +72,11 @@
7373
7474 dbname_prefix=""
7575
 76+
 77+# default language code for the wiki.
 78+
 79+wgLanguageCode="en"
 80+
7681 # what mysql commands should be used. (Who us? Use horrible hacks?)
7782
7883 userpart=""
Index: trunk/testing/installer/installation_system.py
@@ -32,6 +32,7 @@
3333 self.as_alias=None
3434 self.revision=None
3535 self.tag=None
 36+ self.language=None
3637 if instance:
3738 self.set_instance(instance)
3839
Index: trunk/testing/installer/LocalSettings.php
@@ -101,8 +101,6 @@
102102
103103 $wgLocalInterwiki = $wgSitename;
104104
105 -$wgLanguageCode = "en";
106 -
107105 $wgProxyKey = "eeedfbcf7f4e6238a2db7959e50e5e19d0e0c1a6500dbfaa5d38f6dabe801c76";
108106
109107 ## Default skin: you can change the default skin. Use the internal symbolic
Index: trunk/testing/installer/installers.py
@@ -205,6 +205,8 @@
206206 system.revision=ppath["revision"]
207207 if ppath["tag"]:
208208 system.tag=ppath["tag"]
 209+ if ppath["language"]:
 210+ system.language=ppath["language"]
209211
210212 try:
211213 success=system.install(ppath["installer"])
@@ -294,18 +296,18 @@
295297 """parses a path of the form
296298 [ai.][system:]installer [in iii] [as aaa] [revision rrr] [tag ttt] [limit n]
297299
298 - where:
299 - ai:=<available|installed|revisions|tags>
300 - system:=< (see the systems constant, defined near end of file) >
301 - installer is some name of a script to install an item or the item name to be installed (depends on system)
302 - in where to install things *in* (typically used with the extension installer)
303 - as give something a name or alias
304 - install mediawiki:REL1_13_3 as my_mediawiki_example
305 - creates a new mediawiki instance (release 1.13.3) with the name my_mediawiki_example
306 - revision use a particular (svn) revision number
307 - tag use a particular (svn) tag
308 - limit n limits output to at most n items (analogous to the sql command of same name) (useful with ls)
309 - """
 300+ where:
 301+ ai:=<available|installed|revisions|tags>
 302+ system:=< (see the systems constant, defined near end of file) >
 303+ installer is some name of a script to install an item or the item name to be installed (depends on system)
 304+ in where to install things *in* (typically used with the extension installer)
 305+ as give something a name or alias
 306+ install mediawiki:REL1_13_3 as my_mediawiki_example
 307+ creates a new mediawiki instance (release 1.13.3) with the name my_mediawiki_example
 308+ revision use a particular (svn) revision number
 309+ tag use a particular (svn) tag
 310+ limit n limits output to at most n items (analogous to the sql command of same name) (useful with ls)
 311+ """
310312
311313 ai=None # available, installed (and now revisions and tags and test too)
312314 system=None # installation system
@@ -315,6 +317,7 @@
316318 revision=None # revision number, if any
317319 tag=None # tag, if any
318320 limit=None # limit output from list commands to n lines.
 321+ language=None # default language code for wikis
319322
320323 #partial components
321324 whence=None # eg. 'available.mediawiki:'
@@ -364,7 +367,7 @@
365368 # right side (inpath) :_______________
366369 if inpath:
367370 l=inpath.split()
368 - if l[0] not in ['in', 'as', 'revision', 'tag','limit']:
 371+ if l[0] not in ['in', 'as', 'revision', 'tag','limit','language']:
369372 installer=l[0]
370373
371374 in_installer=_ppath_find(l,"in")
@@ -375,6 +378,7 @@
376379 limit=int(_ppath_find(l,'limit'))
377380 except Exception:
378381 pass
 382+ language=_ppath_find(l,'language')
379383
380384 # Ok, we have our basic return value now
381385 ppath={
@@ -385,7 +389,8 @@
386390 "as_alias":as_alias,
387391 "revision":revision,
388392 "tag":tag,
389 - "limit":limit}
 393+ "limit":limit,
 394+ "language":language}
390395
391396 # maybe we can assume some useful defaults (saves typing)
392397 if defaults:
Index: trunk/testing/installer/mediawiki_installer.py
@@ -86,7 +86,7 @@
8787
8888 name=as_alias or self.as_alias or installer_name
8989
90 - install(installer_name, name, self.revision)
 90+ install(installer_name, name, self.revision, self.language)
9191 return self.is_installed(name)
9292
9393 #download is unused, but leave for future expansion
@@ -178,7 +178,7 @@
179179
180180
181181
182 -def install(target, option_as, revision):
 182+def install(target, option_as, revision, language=None):
183183 """implement install command. Installs a mediawiki version"""
184184 target=clean_target(target)
185185
@@ -210,7 +210,7 @@
211211
212212 print "Copying LocalSettings.php,creating unique settings..."
213213 localsettings(name)
214 - uniquesettings(name)
 214+ uniquesettings(name,language)
215215 print "Copy logo..."
216216 logo(name)
217217 print "Setting up database..."
@@ -275,13 +275,17 @@
276276 subdir=os.path.join(settings.instancesdir,target,"LocalSettings")
277277 os.mkdir(subdir)
278278
279 -def uniquesettings(target):
 279+def uniquesettings(target,language=None):
 280+ """Set up settings that are unique to one particular wiki (in the file InstallerUniqueSettings.php)"""
280281 uniquesettings=settings.instancesdir+"/"+target+"/InstallerUniqueSettings.php"
281282 unique=file(uniquesettings,"w")
282283 unique.write('<?php\n')
283284 unique.write('$wgSitename = "'+target+'";\n')
284285 unique.write('$wgScriptPath = "'+settings.base_scriptpath+target+'";\n')
285286 unique.write('$wgDBname = "'+dbname(target)+'";\n')
 287+
 288+ use_language=language or settings.wgLanguageCode
 289+ unique.write('$wgLanguageCode = "'+use_language+'";\n');
286290 unique.write('?>\n')
287291
288292 unique.close()

Status & tagging log