import re
-from wizard import deploy
+from wizard import app, deploy, util
+from wizard.app import php
-def make_regex(var):
- return re.compile('^\$' + var + r'''\s*=\s*((["\']).*\2;)$''', re.M)
-
-wizard_to_var = \
- {'WIZARD_IP': 'IP' # obsolete
- ,'WIZARD_SITENAME': 'wgSitename'
- ,'WIZARD_SCRIPTPATH': 'wgScriptPath'
- ,'WIZARD_EMERGENCYCONTACT': 'wgEmergencyContact'
- ,'WIZARD_DBSERVER': 'wgDBserver'
- ,'WIZARD_DBNAME': 'wgDBname'
- ,'WIZARD_DBUSER': 'wgDBuser'
- ,'WIZARD_DBPASSWORD': 'wgDBpassword'
- ,'WIZARD_PROXYKEY': 'wgProxyKey'}
+@app.filename_regex_extractor
+def make_extractor(var):
+ return 'LocalSettings.php', re.compile('^\$' + re.escape(var) + r'''\s*=\s*((["\']).*\2);$''', re.M)
class Application(deploy.Application):
- pass
+ @property
+ def extractors(self):
+ if not self._extractors:
+ self._extractors = util.dictmap(make_extractor,
+ {'WIZARD_IP': 'IP' # obsolete
+ ,'WIZARD_SITENAME': 'wgSitename'
+ ,'WIZARD_SCRIPTPATH': 'wgScriptPath'
+ ,'WIZARD_EMERGENCYCONTACT': 'wgEmergencyContact'
+ ,'WIZARD_DBSERVER': 'wgDBserver'
+ ,'WIZARD_DBNAME': 'wgDBname'
+ ,'WIZARD_DBUSER': 'wgDBuser'
+ ,'WIZARD_DBPASSWORD': 'wgDBpassword'
+ ,'WIZARD_PROXYKEY': 'wgProxyKey'
+ })
+ self._extractors.update(php.extractors)
+ return self._extractors