equal
deleted
inserted
replaced
56 PURE_VIRTUAL_RTYPES, |
56 PURE_VIRTUAL_RTYPES, |
57 CubicWebRelationSchema, order_eschemas) |
57 CubicWebRelationSchema, order_eschemas) |
58 from cubicweb.cwvreg import CW_EVENT_MANAGER |
58 from cubicweb.cwvreg import CW_EVENT_MANAGER |
59 from cubicweb.dbapi import get_repository, repo_connect |
59 from cubicweb.dbapi import get_repository, repo_connect |
60 from cubicweb.migration import MigrationHelper, yes |
60 from cubicweb.migration import MigrationHelper, yes |
61 from cubicweb.server.session import hooks_control |
|
62 from cubicweb.server import hook |
61 from cubicweb.server import hook |
63 try: |
62 try: |
64 from cubicweb.server import SOURCE_TYPES, schemaserial as ss |
63 from cubicweb.server import SOURCE_TYPES, schemaserial as ss |
65 from cubicweb.server.utils import manager_userpasswd |
64 from cubicweb.server.utils import manager_userpasswd |
66 from cubicweb.server.sqlutils import sqlexec, SQL_PREFIX |
65 from cubicweb.server.sqlutils import sqlexec, SQL_PREFIX |
150 if options.backup_db is None: |
149 if options.backup_db is None: |
151 self.backup_database() |
150 self.backup_database() |
152 elif options.backup_db: |
151 elif options.backup_db: |
153 self.backup_database(askconfirm=False) |
152 self.backup_database(askconfirm=False) |
154 # disable notification during migration |
153 # disable notification during migration |
155 with hooks_control(self.session, self.session.HOOKS_ALLOW_ALL, 'notification'): |
154 with self.session.allow_all_hooks_but('notification'): |
156 super(ServerMigrationHelper, self).migrate(vcconf, toupgrade, options) |
155 super(ServerMigrationHelper, self).migrate(vcconf, toupgrade, options) |
157 |
156 |
158 def cmd_process_script(self, migrscript, funcname=None, *args, **kwargs): |
157 def cmd_process_script(self, migrscript, funcname=None, *args, **kwargs): |
159 try: |
158 try: |
160 return super(ServerMigrationHelper, self).cmd_process_script( |
159 return super(ServerMigrationHelper, self).cmd_process_script( |
374 confirm = self.confirm |
373 confirm = self.confirm |
375 execscript_confirm = self.execscript_confirm |
374 execscript_confirm = self.execscript_confirm |
376 self.confirm = yes |
375 self.confirm = yes |
377 self.execscript_confirm = yes |
376 self.execscript_confirm = yes |
378 try: |
377 try: |
|
378 if event == 'postcreate': |
|
379 with self.session.allow_all_hooks_but(): |
|
380 return self.cmd_process_script(apc, funcname, *args, **kwargs) |
379 return self.cmd_process_script(apc, funcname, *args, **kwargs) |
381 return self.cmd_process_script(apc, funcname, *args, **kwargs) |
380 finally: |
382 finally: |
381 self.confirm = confirm |
383 self.confirm = confirm |
382 self.execscript_confirm = execscript_confirm |
384 self.execscript_confirm = execscript_confirm |
383 if self.config.free_wheel: |
385 if self.config.free_wheel: |
696 continue |
698 continue |
697 self.cmd_add_relation_definition(str(fromtype), rschema.type, |
699 self.cmd_add_relation_definition(str(fromtype), rschema.type, |
698 str(totype)) |
700 str(totype)) |
699 # execute post-create files |
701 # execute post-create files |
700 for cube in reversed(newcubes): |
702 for cube in reversed(newcubes): |
701 self.cmd_exec_event_script('postcreate', cube) |
703 with self.session.allow_all_hooks_but(): |
702 self.commit() |
704 self.cmd_exec_event_script('postcreate', cube) |
|
705 self.commit() |
703 |
706 |
704 def cmd_remove_cube(self, cube, removedeps=False): |
707 def cmd_remove_cube(self, cube, removedeps=False): |
705 removedcubes = super(ServerMigrationHelper, self).cmd_remove_cube( |
708 removedcubes = super(ServerMigrationHelper, self).cmd_remove_cube( |
706 cube, removedeps) |
709 cube, removedeps) |
707 if not removedcubes: |
710 if not removedcubes: |