]> scripts.mit.edu Git - wizard.git/blob - wizard/app/mediawiki.py
Fix wizard -> wizard_bin bug, fix dry run, create .scripts/variables
[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 def make_filename_regex(var):
7     return 'LocalSettings.php', re.compile('^\$(' + re.escape(var) + r'''\s*=\s*)(.*)(;)$''', re.M)
8
9 make_extractor = app.filename_regex_extractor(make_filename_regex)
10
11 class Application(deploy.Application):
12     @property
13     def extractors(self):
14         if not self._extractors:
15             self._extractors = util.dictmap(make_extractor,
16                 {'WIZARD_IP': 'IP' # obsolete, remove after we're done
17                 ,'WIZARD_SITENAME': 'wgSitename'
18                 ,'WIZARD_SCRIPTPATH': 'wgScriptPath'
19                 ,'WIZARD_EMERGENCYCONTACT': 'wgEmergencyContact'
20                 ,'WIZARD_DBSERVER': 'wgDBserver'
21                 ,'WIZARD_DBNAME': 'wgDBname'
22                 ,'WIZARD_DBUSER': 'wgDBuser'
23                 ,'WIZARD_DBPASSWORD': 'wgDBpassword'
24                 ,'WIZARD_PROXYKEY': 'wgProxyKey'
25                 })
26             self._extractors.update(php.extractors)
27         return self._extractors