def duplicate(self, src, dst): """Duplicate an existing instance. src is the instance to duplicate dst is the name to copy to. """ if not installer_util.db_works(): raise Installer_Exception( "Cannot access database. (Is your settings.py correct?)") if not self.is_installed(src): raise Mediawiki_Installer_Exception(src + " not found.") if self.is_installed(dst): raise Mediawiki_Installer_Exception(dst + " already exists.") srcpath = os.path.join(settings.instancesdir, src) dstpath = os.path.join(settings.instancesdir, dst) dbtmp = os.path.join(dstpath, "installerdbtmp.sql") print "Copying instance files..." shutil.copytree(srcpath, dstpath, symlinks=True) print "updating unique settings and adminsettings" uniquesettings(dst, self.language) adminsettings(dst) print "Copying instance database..." dumpdb(src, dbtmp) dropdb(dst) createdb(dst) do_sql(dst, dbtmp) print "cleanup" os.unlink(dbtmp) print "done."
def duplicate(self, src, dst): """Duplicate an existing instance. src is the instance to duplicate dst is the name to copy to. """ if not installer_util.db_works(): raise Installer_Exception("Cannot access database. (Is your settings.py correct?)") if not self.is_installed(src): raise Mediawiki_Installer_Exception(src+" not found.") if self.is_installed(dst): raise Mediawiki_Installer_Exception(dst+" already exists.") srcpath= os.path.join(settings.instancesdir,src) dstpath= os.path.join(settings.instancesdir,dst) dbtmp=os.path.join(dstpath,"installerdbtmp.sql") print "Copying instance files..." shutil.copytree(srcpath,dstpath,symlinks=True) print "updating unique settings and adminsettings" uniquesettings(dst, self.language) adminsettings(dst) print "Copying instance database..." dumpdb(src,dbtmp) dropdb(dst) createdb(dst) do_sql(dst,dbtmp) print "cleanup" os.unlink(dbtmp) print "done."
def uninstall(self,installer_name): name=self.as_alias or installer_name if not self.is_installed(name): print name+" does not appear to be installed" return if not installer_util.db_works(): raise Installer_Exception("Cannot access database. (Is your settings.py correct?)") uninstall(name) return not self.is_installed(name)
def uninstall(self, installer_name): name = self.as_alias or installer_name if not self.is_installed(name): print name + " does not appear to be installed" return if not installer_util.db_works(): raise Installer_Exception( "Cannot access database. (Is your settings.py correct?)") uninstall(name) return not self.is_installed(name)
def install(self, installer_name=None, as_alias=None): if self.tag: installer_name=self.tag if self.revision: installer_name="latest" if not installer_name: installer_name=self.instance if not installer_name: raise Mediawiki_Installer_Exception("Please specify which mediawiki tag or revision you would like to view") name=as_alias or self.as_alias or installer_name if not installer_util.db_works(): raise Installer_Exception("Cannot access database. (Is your settings.py correct?)") install(installer_name, name, self.revision, self.language) return self.is_installed(name)
def install(self, installer_name=None, as_alias=None): if self.tag: installer_name = self.tag if self.revision: installer_name = "latest" if not installer_name: installer_name = self.instance if not installer_name: raise Mediawiki_Installer_Exception( "Please specify which mediawiki tag or revision you would like to view" ) name = as_alias or self.as_alias or installer_name if not installer_util.db_works(): raise Installer_Exception( "Cannot access database. (Is your settings.py correct?)") install(installer_name, name, self.revision, self.language) return self.is_installed(name)