cubicweb/cwctl.py
branch3.26
changeset 12265 3f57a23e9954
parent 12253 9165f4b7426b
child 12317 5166a1a7e4f4
equal deleted inserted replaced
12264:cc83524263a9 12265:3f57a23e9954
    42 from logilab.common.shellutils import ASK
    42 from logilab.common.shellutils import ASK
    43 from logilab.common.configuration import merge_options
    43 from logilab.common.configuration import merge_options
    44 from logilab.common.decorators import clear_cache
    44 from logilab.common.decorators import clear_cache
    45 
    45 
    46 from cubicweb import ConfigurationError, ExecutionError, BadCommandUsage
    46 from cubicweb import ConfigurationError, ExecutionError, BadCommandUsage
    47 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg, CWDEV, CONFIGURATIONS
    47 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg, CONFIGURATIONS
    48 from cubicweb.toolsutils import Command, rm, create_dir, underline_title
    48 from cubicweb.toolsutils import Command, rm, create_dir, underline_title
    49 from cubicweb.__pkginfo__ import version
    49 from cubicweb.__pkginfo__ import version
    50 
    50 
    51 # don't check duplicated commands, it occurs when reloading site_cubicweb
    51 # don't check duplicated commands, it occurs when reloading site_cubicweb
    52 CWCTL = CommandLine('cubicweb-ctl', 'The CubicWeb swiss-knife.',
    52 CWCTL = CommandLine('cubicweb-ctl', 'The CubicWeb swiss-knife.',
   758         else:
   758         else:
   759             applcubicwebversion = vcconf.get('cubicweb')
   759             applcubicwebversion = vcconf.get('cubicweb')
   760         if cubicwebversion > applcubicwebversion:
   760         if cubicwebversion > applcubicwebversion:
   761             toupgrade.append(('cubicweb', applcubicwebversion, cubicwebversion))
   761             toupgrade.append(('cubicweb', applcubicwebversion, cubicwebversion))
   762         # only stop once we're sure we have something to do
   762         # only stop once we're sure we have something to do
   763         if instance_running and not (CWDEV or self.config.nostartstop):
   763         if instance_running and not self.config.nostartstop:
   764             StopInstanceCommand(self.logger).stop_instance(appid)
   764             StopInstanceCommand(self.logger).stop_instance(appid)
   765         # run cubicweb/componants migration scripts
   765         # run cubicweb/componants migration scripts
   766         if self.config.fs_only or toupgrade:
   766         if self.config.fs_only or toupgrade:
   767             for cube, fromversion, toversion in toupgrade:
   767             for cube, fromversion, toversion in toupgrade:
   768                 print('-> migration needed from %s to %s for %s' % (fromversion, toversion, cube))
   768                 print('-> migration needed from %s to %s for %s' % (fromversion, toversion, cube))
   781             return
   781             return
   782         print()
   782         print()
   783         if helper:
   783         if helper:
   784             helper.postupgrade(repo)
   784             helper.postupgrade(repo)
   785         print('-> instance migrated.')
   785         print('-> instance migrated.')
   786         if instance_running and not (CWDEV or self.config.nostartstop):
   786         if instance_running and not self.config.nostartstop:
   787             # restart instance through fork to get a proper environment, avoid
   787             # restart instance through fork to get a proper environment, avoid
   788             # uicfg pb (and probably gettext catalogs, to check...)
   788             # uicfg pb (and probably gettext catalogs, to check...)
   789             forkcmd = '%s start %s' % (sys.argv[0], appid)
   789             forkcmd = '%s start %s' % (sys.argv[0], appid)
   790             status = system(forkcmd)
   790             status = system(forkcmd)
   791             if status:
   791             if status: