2 """Updates the wrinncache table (by calling wrpylib.wrmwcache.update_wrinncache()).
3 Can be used in a python session or at the command line.
6 $ python updatewrinncache.py inifile1.ini ...
8 One or more .ini configuration files can be given.
9 At the end, the following entries have to be present:
13 dbname=philipp_winterrodeln_wiki
19 from sqlalchemy.engine import create_engine
20 import wrpylib.wrmwcache
23 def update_wrinncache(inifile):
25 :param inifile: filename of an .ini file or a list of .ini files.
27 config = configparser.ConfigParser()
30 host = config.get('mysql', 'host')
31 dbname = config.get('mysql', 'dbname')
32 user = config.get('mysql', 'user_name')
33 passwd = config.get('mysql', 'user_pass')
35 engine = create_engine(f'mysql://{user}@{host}:3306/{dbname}?passwd={passwd}&charset=utf8mb4')
36 wrpylib.wrmwcache.update_wrinncache(engine.connect())
39 if __name__ == '__main__':
40 parser = argparse.ArgumentParser(description='Updates the wrinncache table.')
41 parser.add_argument('inifile', nargs='+', help='inifile.ini, see: https://www.winterrodeln.org/trac/wiki/ConfigIni')
42 args = parser.parse_args()
43 update_wrinncache(args.inifile)