]> scripts.mit.edu Git - wizard.git/blob - wizard/app/mediawiki.py
Add mediawiki variable extraction support for deployments.
[wizard.git] / wizard / app / mediawiki.py
1 import re
2
3 from wizard import app, deploy, util
4 from wizard.app import php
5
6 @app.filename_regex_extractor
7 def make_extractor(var):
8     return 'LocalSettings.php', re.compile('^\$' + re.escape(var) + r'''\s*=\s*((["\']).*\2);$''', re.M)
9
10 class Application(deploy.Application):
11     @property
12     def extractors(self):
13         if not self._extractors:
14             self._extractors = util.dictmap(make_extractor,
15                 {'WIZARD_IP': 'IP' # obsolete
16                 ,'WIZARD_SITENAME': 'wgSitename'
17                 ,'WIZARD_SCRIPTPATH': 'wgScriptPath'
18                 ,'WIZARD_EMERGENCYCONTACT': 'wgEmergencyContact'
19                 ,'WIZARD_DBSERVER': 'wgDBserver'
20                 ,'WIZARD_DBNAME': 'wgDBname'
21                 ,'WIZARD_DBUSER': 'wgDBuser'
22                 ,'WIZARD_DBPASSWORD': 'wgDBpassword'
23                 ,'WIZARD_PROXYKEY': 'wgProxyKey'
24                 })
25             self._extractors.update(php.extractors)
26         return self._extractors