devtools/__init__.py
branchstable
changeset 7506 c8cda2aca92e
parent 7240 6f5118b48d6a
child 7514 32081892850e
child 7520 b7456b454334
equal deleted inserted replaced
7505:e04790a6eea8 7506:c8cda2aca92e
   598             self.dbcnx.commit()
   598             self.dbcnx.commit()
   599 
   599 
   600     def _backup_database(self, db_id):
   600     def _backup_database(self, db_id):
   601         """Actual backup the current database.
   601         """Actual backup the current database.
   602 
   602 
   603         return a value to be stored in db_cache to allow restoration"""
   603         return a value to be stored in db_cache to allow restoration
       
   604         """
   604         from cubicweb.server.serverctl import createdb
   605         from cubicweb.server.serverctl import createdb
   605         orig_name = self.system_source['db-name']
   606         orig_name = self.system_source['db-name']
   606         try:
   607         try:
   607             backup_name = self._backup_name(db_id)
   608             backup_name = self._backup_name(db_id)
   608             self._drop(backup_name)
   609             self._drop(backup_name)
   609             self.system_source['db-name'] = backup_name
   610             self.system_source['db-name'] = backup_name
       
   611             self._repo.turn_repo_off()
   610             createdb(self.helper, self.system_source, self.dbcnx, self.cursor, template=orig_name)
   612             createdb(self.helper, self.system_source, self.dbcnx, self.cursor, template=orig_name)
   611             self.dbcnx.commit()
   613             self.dbcnx.commit()
       
   614             self._repo.turn_repo_on()
   612             return backup_name
   615             return backup_name
   613         finally:
   616         finally:
   614             self.system_source['db-name'] = orig_name
   617             self.system_source['db-name'] = orig_name
   615 
   618 
   616     def _restore_database(self, backup_coordinates, config):
   619     def _restore_database(self, backup_coordinates, config):