Index: trunk/testing/installer/installer.py |
— | — | @@ -88,14 +88,18 @@ |
89 | 89 | |
90 | 90 | def duplicate(args): |
91 | 91 | """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>]" |
94 | 94 | installers.duplicate(args) |
95 | 95 | |
96 | 96 | def uninstall(args): |
97 | 97 | """uninstall something""" |
98 | 98 | installers.uninstall(args) |
99 | 99 | |
| 100 | +def maintenance_update(args): |
| 101 | + """run maintenance/update.php""" |
| 102 | + installers.maintenance_update(args) |
| 103 | + |
100 | 104 | def update_self(args): |
101 | 105 | """update self to newest revision, (and switch to interactive mode)""" |
102 | 106 | |
— | — | @@ -167,7 +171,8 @@ |
168 | 172 | "update_self":update_self, |
169 | 173 | "update_tags":update_tags, |
170 | 174 | "duplicate":duplicate, |
171 | | - "test":test |
| 175 | + "test":test, |
| 176 | + "maintenance_update":maintenance_update |
172 | 177 | } |
173 | 178 | |
174 | 179 | # additional help texts for some commands. |
Index: trunk/testing/installer/naive_installer.py |
— | — | @@ -44,7 +44,6 @@ |
45 | 45 | |
46 | 46 | def _setup(self, installer_name, destination_dir): |
47 | 47 | self._setup_schema(installer_name, destination_dir) |
48 | | - self._setup_update() |
49 | 48 | |
50 | 49 | def _setup_schema(self, installer_name, destination_dir): |
51 | 50 | schema_path=os.path.join(destination_dir, installer_name, "schema.sql") |
— | — | @@ -54,23 +53,6 @@ |
55 | 54 | except Exception,e: |
56 | 55 | 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) |
57 | 56 | |
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 | | - |
75 | 57 | def _uninstall(self, installer_name, destination_dir): |
76 | 58 | """perform uninstallation of things that need uninstalling, in the case of the naive installer, we uninstall""" |
77 | 59 | schemafilename=os.path.join(destination_dir, installer_name, "schema.sql") |
Index: trunk/testing/installer/installers.py |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | #from installation_system import Installation_System |
16 | 16 | from toolkit_installer import Toolkit_Installer |
17 | 17 | from scripted_installer import Scripted_Installer |
18 | | -from mediawiki_installer import Mediawiki_Installer |
| 18 | +from mediawiki_installer import Mediawiki_Installer, Mediawiki_Installer_Exception |
19 | 19 | from naive_installer import Naive_Installer |
20 | 20 | from installation_system import Installer_Exception |
21 | 21 | from download_installer import Download_Installer |
— | — | @@ -173,12 +173,43 @@ |
174 | 174 | def duplicate(args): |
175 | 175 | """duplicate a mediawiki instance""" |
176 | 176 | 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?" |
177 | 183 | try: |
178 | 184 | mw.duplicate(args[1],args[2]) |
179 | 185 | except Mediawiki_Installer_Exception,e: |
180 | 186 | print str(e) |
181 | 187 | |
| 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 |
182 | 205 | |
| 206 | + mw.set_instance(instance) |
| 207 | + |
| 208 | + try: |
| 209 | + mw.maintenance_update() |
| 210 | + except Mediawiki_Installer_Exception,e: |
| 211 | + print str(e) |
| 212 | + |
| 213 | + |
183 | 214 | def install(args): |
184 | 215 | """install something. What gets installed depends on the path""" |
185 | 216 | if len(args)<2: |
Index: trunk/testing/installer/mediawiki_installer.py |
— | — | @@ -161,8 +161,23 @@ |
162 | 162 | os.unlink(dbtmp) |
163 | 163 | print "done." |
164 | 164 | |
| 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") |
165 | 169 | |
| 170 | + update_script=os.path.join(self.instancedir(),"maintenance","update.php") |
166 | 171 | |
| 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 | + |
167 | 182 | #TODO: use this method everywhere a database name is requested |
168 | 183 | # REFACTOR: dbname now in installation_system.py |
169 | 184 | def dbname(installer_name): |