5 from wizard import app, install, resolve, util
6 from wizard.app import php
9 # 2.0.19 87 ++++++++++++++++++++++++++++++
13 def make_filename_regex(var):
14 return CONFIG, php.re_var(var)
16 seed = util.dictmap(make_filename_regex, {
17 'WIZARD_DBSERVER' : 'dbhost',
18 'WIZARD_DBNAME' : 'dbname',
19 'WIZARD_DBUSER' : 'dbuser',
20 'WIZARD_DBPASSWORD' : 'dbpasswd' })
22 class Application(app.Application):
23 install_schema = install.ArgSchema('db', 'admin', 'email', 'title')
25 parametrized_files = [ CONFIG ] + php.parametrized_files
26 extractors = app.make_extractors(seed)
27 extractors.update(php.extractors)
28 substitutions = app.make_substitutions(seed)
29 substitutions.update(php.substitutions)
31 def checkConfig(self, deployment):
32 return os.path.getsize('config.php')
34 def detectVersion(self, deployment):
35 version = self.detectVersionFromFile('install/database_update.php', php.re_var('updates_to_version'))
36 if version.startswith('.'): # blehh, but phpBB2 uses '.0.19'...
37 version = '2' + version
40 def remove(self, deployment, options):
41 app.remove_database(deployment)
43 def install(self, version, options):
44 self.install_2(options)
46 def install_2(self, options):
51 'dbhost' : options.dsn.host,
52 'dbname' : options.dsn.database,
53 'dbuser' : options.dsn.username,
54 'dbpasswd' : options.dsn.password,
56 'board_email' : options.email,
57 'server_name' : options.web_host,
59 'script_path' : options.web_path,
60 'admin_name' : options.admin_name,
61 'admin_pass1' : options.admin_password,
62 'admin_pass2' : options.admin_password,
64 'cur_lang' : 'english' }
66 result = install.fetch(options, 'install/install.php', database_dict)
67 logging.debug('install.php output:\n\n' + result)
68 if 'Thank you' not in result:
69 raise app.InstallFailure()
70 #shutil.rmtree('install')
71 #shutil.rmtree('contrib')
73 def install_3(self, options):
74 def install_helper(sub, post):
75 uri = 'install/index.php?mode=install&language=en'
77 uri += '&sub=%s' % sub
78 result = install.fetch(options, uri, post)
79 logging.debug('%s (%s) output:\n\n' % (uri, sub) + result)
83 install_helper('', {})
84 install_helper('requirements', {})
86 database_dict = { 'img_imagick' : '/usr/bin/' }
87 install_helper('database', database_dict)
89 database_dict.update({
91 'dbhost' : options.mysql_host,
92 'dbname' : options.mysql_db,
93 'dbuser' : options.mysql_user,
94 'dbpasswd' : options.mysql_password,
96 'img_imagick' : '/usr/bin/',
99 install_helper('database', database_dict)
101 database_dict['dbport'] = ''
102 del database_dict['testdb']
103 install_helper('administrator', database_dict)
105 database_dict.update({
106 'default_lang' : 'en',
107 'admin_name' : options.admin_name,
108 'admin_pass1' : options.admin_password,
109 'admin_pass2' : options.admin_password,
110 'board_email1' : options.email,
111 'board_email2' : options.email,
113 install_helper('administrator', database_dict)
115 del database_dict['check']
116 install_helper('config_file', database_dict)
117 install_helper('advanced', database_dict)
119 database_dict.update({
120 'email_enable' : '1',
121 'smtp_delivery' : '0',
122 'smtp_auth' : 'PLAIN',
123 'cookie_secure' : '0',
124 'force_server_vars' : '0',
125 'server_protocol' : 'http://',
126 'server_name' : options.web_host,
127 'server_port' : '80',
128 'script_path' : options.web_path })
129 install_helper('create_table', database_dict)
131 database_dict.update({
138 install_helper('final', database_dict)