server/serverctl.py
changeset 8449 cc83a3f16c0f
parent 8434 39c5bb4dcc59
child 8544 3d049071957e
equal deleted inserted replaced
8448:c5fff93d3a1c 8449:cc83a3f16c0f
   991 
   991 
   992 
   992 
   993 class RebuildFTICommand(Command):
   993 class RebuildFTICommand(Command):
   994     """Rebuild the full-text index of the system database of an instance.
   994     """Rebuild the full-text index of the system database of an instance.
   995 
   995 
   996     <instance>
   996     <instance> [etype(s)]
   997       the identifier of the instance to rebuild
   997       the identifier of the instance to rebuild
       
   998 
       
   999     If no etype is specified, cubicweb will reindex everything, otherwise
       
  1000     only specified etypes will be considered.
   998     """
  1001     """
   999     name = 'db-rebuild-fti'
  1002     name = 'db-rebuild-fti'
  1000     arguments = '<instance>'
  1003     arguments = '<instance>'
  1001     min_args = max_args = 1
  1004     min_args = 1
  1002 
  1005 
  1003     def run(self, args):
  1006     def run(self, args):
  1004         from cubicweb.server.checkintegrity import reindex_entities
  1007         from cubicweb.server.checkintegrity import reindex_entities
  1005         appid = args[0]
  1008         appid = args.pop(0)
       
  1009         etypes = args or None
  1006         config = ServerConfiguration.config_for(appid)
  1010         config = ServerConfiguration.config_for(appid)
  1007         repo, cnx = repo_cnx(config)
  1011         repo, cnx = repo_cnx(config)
  1008         session = repo._get_session(cnx.sessionid, setcnxset=True)
  1012         session = repo._get_session(cnx.sessionid, setcnxset=True)
  1009         reindex_entities(repo.schema, session)
  1013         reindex_entities(repo.schema, session, etypes=etypes)
  1010         cnx.commit()
  1014         cnx.commit()
  1011 
  1015 
  1012 
  1016 
  1013 class SynchronizeInstanceSchemaCommand(Command):
  1017 class SynchronizeInstanceSchemaCommand(Command):
  1014     """Synchronize persistent schema with cube schema.
  1018     """Synchronize persistent schema with cube schema.