2 Implementation of the 'admin' subcommand.
4 from ..tools.exec_utils import run_legacy_script
6 # Do not repeat documentation of subcommand classes.
7 # pylint: disable=C0111
8 # Using non-top-level imports to avoid eventually unused imports.
9 # pylint: disable=E0012,C0415
13 Analyse and maintain the database.
18 group = parser.add_argument_group('Admin task arguments')
19 group.add_argument('--warm', action='store_true',
20 help='Warm database caches for search and reverse queries.')
21 group.add_argument('--check-database', action='store_true',
22 help='Check that the database is complete and operational.')
23 group = parser.add_argument_group('Arguments for cache warming')
24 group.add_argument('--search-only', action='store_const', dest='target',
26 help="Only pre-warm tables for search queries")
27 group.add_argument('--reverse-only', action='store_const', dest='target',
29 help="Only pre-warm tables for reverse queries")
34 AdminFuncs._warm(args)
36 if args.check_database:
37 run_legacy_script('check_import_finished.php', nominatim_env=args)
45 if args.target == 'reverse':
46 params.append('--reverse-only')
47 if args.target == 'search':
48 params.append('--search-only')
49 return run_legacy_script(*params, nominatim_env=args)