Skip to content
Commits on Source (2)
ALTER TABLE `mail_user` CHANGE `quota` `quota` BIGINT(20) NOT NULL DEFAULT '0';
/* install_wordpress */
ALTER TABLE `web_domain` ADD `task_request` VARCHAR(255) NOT NULL AFTER `last_jailkit_hash`;
ALTER TABLE `web_domain` ADD `task_request_options` MEDIUMTEXT NOT NULL AFTER `task_request`;
......@@ -298,6 +298,12 @@ $form["tabs"]['domain'] = array (
'default' => 'y',
'value' => array(0 => 'n', 1 => 'y')
),
'install_wordpress' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'n',
'value' => array(0 => 'n', 1 => 'y')
),
//#################################
// END Datatable fields
//#################################
......
......@@ -275,6 +275,12 @@
</div>
</div>
{tmpl_hook name="end_form"}
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='XXXX_txt'}Install wordpress?</label>
<div class="col-sm-9">
{tmpl_var name='install_wordpress'}
</div>
</div>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
......
......@@ -1261,6 +1261,17 @@ class page_action extends tform_actions {
}
}
if ($this->dataRecord['install_wordpress'] ) {
//TODO create database + user, store in $options
// TODO look at the sys_remoteaction table
$this->dataRecord['task_request'] = 'install_wordpress';
$this->dataRecord['task_request_options'] = json_encode($options);
unset(this->dataRecord['install_wordpress']);
}
$this->validateDefaultFastcgiPhpVersion();
parent::onSubmit();
......
<?php
class wordpress_plugin {
var $plugin_name = 'wordpress_plugin';
var $class_name = 'wordpress_plugin';
function onLoad() {
global $app;
// Register for the events
$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'install_wordpress');
$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'install_wordpress');
}
// Handle the creation of SSL certificates
function install_wordpress($event_name, $data) {
global $app, $conf;
$app->uses('system');
// load the server configuration options
$app->uses('getconf');
if (empty($data['new']['task_request'])) {
return true;
}
// TODO Use $data['new']['document_root']
// Get db credentials from $data ? pass via task_request_options field as json?
// Generate admin_userlogin password for wordpress, mail the data to the client?
# Download and extract WordPress
#wp core download # --locale=nl_NL\n".
#wp core config --dbname=$var[db_name] --dbuser=$var[db_username] --dbpass=$var[password] --dbhost=.
#wp core install --url=https://www... --title='' --admin_user= --admin_email=info@ --admin_password=
// Cleanup the task_request field content
}
}