r51551 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51550‎ | r51551 | r51552 >
Date:18:29, 6 June 2009
Author:kim
Status:deferred
Tags:
Comment:
Installer stuff
*new command: maintenance_update
*new option: duplicate now supports an optional language parameter
Modified paths:
  • /trunk/testing/installer/installer.py (modified) (history)
  • /trunk/testing/installer/installers.py (modified) (history)
  • /trunk/testing/installer/mediawiki_installer.py (modified) (history)
  • /trunk/testing/installer/naive_installer.py (modified) (history)

Diff [purge]

Index: trunk/testing/installer/installer.py
@@ -88,14 +88,18 @@
8989
9090 def duplicate(args):
9191 """duplicate an instance"""
92 - if len(args)!=3:
93 - print "syntax:\n duplicate source_instance destination_instance"
 92+ if len(args)<3:
 93+ print "syntax:\n duplicate <source_instance> <destination_instance> [language <language_code>]"
9494 installers.duplicate(args)
9595
9696 def uninstall(args):
9797 """uninstall something"""
9898 installers.uninstall(args)
9999
 100+def maintenance_update(args):
 101+ """run maintenance/update.php"""
 102+ installers.maintenance_update(args)
 103+
100104 def update_self(args):
101105 """update self to newest revision, (and switch to interactive mode)"""
102106
@@ -167,7 +171,8 @@
168172 "update_self":update_self,
169173 "update_tags":update_tags,
170174 "duplicate":duplicate,
171 - "test":test
 175+ "test":test,
 176+ "maintenance_update":maintenance_update
172177 }
173178
174179 # additional help texts for some commands.
Index: trunk/testing/installer/naive_installer.py
@@ -44,7 +44,6 @@
4545
4646 def _setup(self, installer_name, destination_dir):
4747 self._setup_schema(installer_name, destination_dir)
48 - self._setup_update()
4948
5049 def _setup_schema(self, installer_name, destination_dir):
5150 schema_path=os.path.join(destination_dir, installer_name, "schema.sql")
@@ -54,23 +53,6 @@
5554 except Exception,e:
5655 raise Naive_Installer_Exception("_setup_schema: While installing, I found a schema.sql and tried to use it, but there was some issue with it.\n",e)
5756
58 - def _setup_update(self):
59 -
60 - return # XXX This method is a work in progress. I don't want to hold up users,
61 - # so I'll upload to svn like this
62 - if not self.instancedir():
63 - raise Naive_Installer_Exception("_setup_update:Internal Error: Could not determine instancedir")
64 -
65 - update_script=os.path.join(self.instancedir(),"maintenance","update.php")
66 -
67 - if not os.path.exists(update_script):
68 - raise Naive_Installer_Exception("_setup_update:While installing, could not find update.php at: "+command)
69 -
70 - command=settings.phpcommand+" "+update_script
71 - rv=os.system(command)>>8
72 - if rv:
73 - raise Naive_Installer_Exception("_setup_update:While installing, I tried to run the instance's maintenance/update.php, but some issue occurred.")
74 -
7557 def _uninstall(self, installer_name, destination_dir):
7658 """perform uninstallation of things that need uninstalling, in the case of the naive installer, we uninstall"""
7759 schemafilename=os.path.join(destination_dir, installer_name, "schema.sql")
Index: trunk/testing/installer/installers.py
@@ -14,7 +14,7 @@
1515 #from installation_system import Installation_System
1616 from toolkit_installer import Toolkit_Installer
1717 from scripted_installer import Scripted_Installer
18 -from mediawiki_installer import Mediawiki_Installer
 18+from mediawiki_installer import Mediawiki_Installer, Mediawiki_Installer_Exception
1919 from naive_installer import Naive_Installer
2020 from installation_system import Installer_Exception
2121 from download_installer import Download_Installer
@@ -173,12 +173,43 @@
174174 def duplicate(args):
175175 """duplicate a mediawiki instance"""
176176 mw=get_system("mediawiki")
 177+
 178+ if len(args)>3 and args[3]=="language":
 179+ if len(args)==5:
 180+ mw.language=args[4]
 181+ else:
 182+ print "which language did you mean?"
177183 try:
178184 mw.duplicate(args[1],args[2])
179185 except Mediawiki_Installer_Exception,e:
180186 print str(e)
181187
 188+def maintenance_update(args):
 189+ """run maintenance/update.php, which allows any standard scripts to
 190+ install themselves further."""
 191+ mw=get_system("mediawiki")
 192+ try:
 193+ ppath=parse_path(" ".join(args[1:]),defaults={'ai':'installed'})
 194+ except Parse_Exception,e:
 195+ print str(e)
 196+ return
 197+ instance=ppath["installer"]
 198+ if not instance:
 199+ print "I can't figure out what mediawiki instance you would like to perform maintenance_update on. Please mention it explicitly. Syntax: maintenance_update <instance_name>"
 200+ return
 201+
 202+ if not mw.is_installed(instance):
 203+ print "The mediawiki instance '"+instance+"' does not appear to be installed. Perhaps you misspelled the name?"
 204+ return
182205
 206+ mw.set_instance(instance)
 207+
 208+ try:
 209+ mw.maintenance_update()
 210+ except Mediawiki_Installer_Exception,e:
 211+ print str(e)
 212+
 213+
183214 def install(args):
184215 """install something. What gets installed depends on the path"""
185216 if len(args)<2:
Index: trunk/testing/installer/mediawiki_installer.py
@@ -161,8 +161,23 @@
162162 os.unlink(dbtmp)
163163 print "done."
164164
 165+ def maintenance_update(self):
 166+ """run maintenance/update.php to deal with any installed extensions"""
 167+ if not self.instancedir():
 168+ raise Mediawiki_Installer_Exception("setup_update:Internal Error: Could not determine instancedir")
165169
 170+ update_script=os.path.join(self.instancedir(),"maintenance","update.php")
166171
 172+ if not os.path.exists(update_script):
 173+ raise Mediawiki_Installer_Exception("setup_update:While installing, could not find update.php at: "+command)
 174+
 175+ command=settings.phpcommand+" "+update_script
 176+ rv=os.system(command)>>8
 177+ if rv:
 178+ raise Mediawiki_Installer_Exception("setup_update:While installing, I tried to run the instance's maintenance/update.php, but some issue occurred.")
 179+
 180+
 181+
167182 #TODO: use this method everywhere a database name is requested
168183 # REFACTOR: dbname now in installation_system.py
169184 def dbname(installer_name):

Status & tagging log