Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
|
4d447ceffb | |
|
0b7e7a5e74 | |
|
fcdd844de4 | |
|
f9c2a60113 | |
|
ea13c90492 | |
|
85406a7813 |
48
README.md
48
README.md
|
@ -1,6 +1,8 @@
|
||||||
Adds a panel to quick-install certain CMSs in AlternC. This module provides support for WordPress and Drupal.
|
Adds a panel to quick-install certain CMSs in AlternC. This module provides
|
||||||
|
support for WordPress and Drupal.
|
||||||
|
|
||||||
Support for other CMSs may be added by other AlternC plugins. See "Extending" for more information.
|
Support for other CMSs may be added by other AlternC plugins. See "Extending"
|
||||||
|
for more information.
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
|
@ -12,34 +14,43 @@ For [Drupal][2]: Install [Drush](https://github.com/drush-ops/drush/ "Drush on G
|
||||||
|
|
||||||
## Manual Install
|
## Manual Install
|
||||||
|
|
||||||
`
|
```
|
||||||
make install
|
make install
|
||||||
`
|
```
|
||||||
|
|
||||||
If AlternC is installed in another directory, use something like: `
|
If AlternC is installed in another directory, use something like:
|
||||||
ALTERNC_BASE_PATH=/your/path/alternc make install
|
`ALTERNC_BASE_PATH=/your/path/alternc/panel/ make install`
|
||||||
`
|
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
Once installed, add the Drush or WP-CLI paths to /etc/alternc/locals.sh. These need to be accessible within the basedir restrictions of the AlternC panel.
|
Once installed, add the Drush or WP-CLI paths to /etc/alternc/locals.sh. These
|
||||||
|
need to be accessible within the basedir restrictions of the AlternC panel.
|
||||||
|
|
||||||
Example: `
|
```
|
||||||
ALTERNC_DRUSH_BIN=/usr/local/bin/drush
|
ALTERNC_DRUSH_BIN=/usr/local/bin/drush
|
||||||
ALTERNC_WPCLI_BIN=/usr/local/bin/wp
|
ALTERNC_WPCLI_BIN=/usr/local/bin/wp
|
||||||
`
|
|
||||||
|
|
||||||
If they are not configured, the links for installation will be disabled. If no CMSs are configured, the quick links menu item will not be displayed.
|
# Option to limit the One-Click Installer menu to users who have 'su' on their
|
||||||
|
# account. Set to 1 to enable that restriction. Default is 0 (no restriction).
|
||||||
|
OCI_REQUIRE_SU=0
|
||||||
|
```
|
||||||
|
|
||||||
|
If they are not configured, the links for installation will be disabled. If no
|
||||||
|
CMSs are configured, the quick links menu item will not be displayed.
|
||||||
|
|
||||||
# Extending
|
# Extending
|
||||||
|
|
||||||
A number of hooks are available to modify the install form and run the actual install. Drupal and WordPress are implemented as examples that could done in another module easily.
|
A number of hooks are available to modify the install form and run the actual
|
||||||
|
install. Drupal and WordPress are implemented as examples that could done in
|
||||||
|
another module easily.
|
||||||
|
|
||||||
# Roadmap
|
# Roadmap
|
||||||
|
|
||||||
This module is basically at a 'proof of concept' point. For a first proper release, the following should probably be added:
|
This module is basically at a 'proof of concept' point. For a first proper
|
||||||
|
release, the following should probably be added:
|
||||||
|
|
||||||
* make sure form content and variables are properly escaped when passed between scripts
|
* make sure form content and variables are properly escaped when passed between
|
||||||
|
scripts
|
||||||
* user interface / form cleanup
|
* user interface / form cleanup
|
||||||
* hide form elements based on choices
|
* hide form elements based on choices
|
||||||
* sub-domain list changing based on chosen domain
|
* sub-domain list changing based on chosen domain
|
||||||
|
@ -49,10 +60,15 @@ This module is basically at a 'proof of concept' point. For a first proper relea
|
||||||
|
|
||||||
Nice to haves:
|
Nice to haves:
|
||||||
|
|
||||||
* threaded install script so user feedback doesn't have to wait X minutes until the shell scripts finish
|
* threaded install script so user feedback doesn't have to wait X minutes until
|
||||||
|
the shell scripts finish
|
||||||
|
|
||||||
# Copyright & License
|
# Copyright & License
|
||||||
|
|
||||||
2018 Kienan Stewart <kienan@koumbit.org>
|
2018 Kienan Stewart <kienan@koumbit.org>
|
||||||
|
|
||||||
Licensed under the GNU General Public License version 2.0 or later. See LICENSE for the full license text.
|
Licensed under the GNU General Public License version 2.0 or later. See LICENSE
|
||||||
|
for the full license text.
|
||||||
|
|
||||||
|
[1]: https://wordpress.org/
|
||||||
|
[2]: https://drupal.org/
|
||||||
|
|
|
@ -59,7 +59,7 @@ if (!$oci->app_is_installable($application)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO validations
|
// @TODO validations
|
||||||
$errors = $oci->oci_form_validate($oci_vars);
|
$errors = $oci->oci_form_validate($application, $oci_vars);
|
||||||
if (!empty($errors)) {
|
if (!empty($errors)) {
|
||||||
print('<div class="validation-wrapper">');
|
print('<div class="validation-wrapper">');
|
||||||
print('<h3>' . _('Validation Errors') . '</h3>');
|
print('<h3>' . _('Validation Errors') . '</h3>');
|
||||||
|
|
|
@ -21,7 +21,12 @@
|
||||||
class m_oci {
|
class m_oci {
|
||||||
|
|
||||||
function hook_menu() {
|
function hook_menu() {
|
||||||
global $hooks, $L_ALTERNC_WPCLI_BIN, $L_ALTERNC_DRUSH_BIN;
|
global $mem, $hooks, $L_OCI_REQUIRE_SU;
|
||||||
|
if ($L_OCI_REQUIRE_SU) {
|
||||||
|
if (!$mem->checkright()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
$menu = array(
|
$menu = array(
|
||||||
'title' => _('Quick Install'),
|
'title' => _('Quick Install'),
|
||||||
'ico' => 'images/ocilogo.png',
|
'ico' => 'images/ocilogo.png',
|
||||||
|
@ -29,27 +34,35 @@ class m_oci {
|
||||||
'pos' => 11,
|
'pos' => 11,
|
||||||
'links' => array(),
|
'links' => array(),
|
||||||
);
|
);
|
||||||
// @TODO invoke a hook to get supported applications
|
$links = $hooks->invokve('hook_oci_menu');
|
||||||
// need: id (eg. wordpress), weight (to order), ico, and
|
if ($links) {
|
||||||
// optionally - a different action path.
|
$menu['links'] = $links;
|
||||||
// @TODO required binaries for installation: eg, wp-cli, drush
|
}
|
||||||
|
if ($menu['links']) {
|
||||||
|
return $menu;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_oci_menu().
|
||||||
|
*/
|
||||||
|
function hook_oci_menu() {
|
||||||
|
$links = array();
|
||||||
if ($this->app_is_installable('wordpress')) {
|
if ($this->app_is_installable('wordpress')) {
|
||||||
$menu['links'][] = array(
|
$links[] = array(
|
||||||
'txt' => _('WordPress'),
|
'txt' => _('WordPress'),
|
||||||
'url' => 'oci_install.php?app=wordpress',
|
'url' => 'oci_install.php?app=wordpress',
|
||||||
'ico' => 'images/wordpress.png',
|
'ico' => 'images/wordpress.png',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($this->app_is_installable('drupal')) {
|
if ($this->app_is_installable('drupal')) {
|
||||||
$menu['links'][] = array(
|
$links[] = array(
|
||||||
'txt' => _('Drupal'),
|
'txt' => _('Drupal'),
|
||||||
'url' => 'oci_install.php?app=drupal',
|
'url' => 'oci_install.php?app=drupal',
|
||||||
'ico' => 'images/drupal.png',
|
'ico' => 'images/drupal.png',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($menu['links']) {
|
return $links;
|
||||||
return $menu;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -296,7 +309,7 @@ class m_oci {
|
||||||
|
|
||||||
// Invoke hook to get app-specific form fields.
|
// Invoke hook to get app-specific form fields.
|
||||||
$extra = '';
|
$extra = '';
|
||||||
$vals = $hooks->invoke('hook_oic_form', array($app));
|
$vals = $hooks->invoke('hook_oci_form', array($app));
|
||||||
foreach ($vals as $v) {
|
foreach ($vals as $v) {
|
||||||
if ($v) {
|
if ($v) {
|
||||||
$extra .= $v;
|
$extra .= $v;
|
||||||
|
@ -317,13 +330,13 @@ class m_oci {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements hook_oic_form.
|
* Implements hook_oci_form.
|
||||||
*/
|
*/
|
||||||
function hook_oic_form($app) {
|
function hook_oci_form($app) {
|
||||||
$f = '';
|
$f = '';
|
||||||
switch ($app) {
|
switch ($app) {
|
||||||
case 'drupal':
|
case 'drupal':
|
||||||
// These fields should be defined in hook_oic_form_fields
|
// These fields should be defined in hook_oci_form_fields
|
||||||
// Choose the install source
|
// Choose the install source
|
||||||
$f .= '<div id="drupal-install-source-wrapper">';
|
$f .= '<div id="drupal-install-source-wrapper">';
|
||||||
$f .= '<label for="drupal-install-source">' . _('Choose installation source') . '</label>';
|
$f .= '<label for="drupal-install-source">' . _('Choose installation source') . '</label>';
|
||||||
|
@ -406,7 +419,7 @@ class m_oci {
|
||||||
* @returns array
|
* @returns array
|
||||||
* Array of errors eg. array(0 => array('module' => 'm_oci', 'message' => '...'), ...)
|
* Array of errors eg. array(0 => array('module' => 'm_oci', 'message' => '...'), ...)
|
||||||
*/
|
*/
|
||||||
function oci_form_validate($vars) {
|
function oci_form_validate($app, $vars) {
|
||||||
global $hooks, $dom, $db;
|
global $hooks, $dom, $db;
|
||||||
$errors = array();
|
$errors = array();
|
||||||
if ($vars['domain'] == '*new*') {
|
if ($vars['domain'] == '*new*') {
|
||||||
|
@ -515,7 +528,7 @@ class m_oci {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$vals = $hooks->invoke('hook_oci_form_validate', array($vars));
|
$vals = $hooks->invoke('hook_oci_form_validate', array($app, $vars));
|
||||||
foreach ($vals as $v) {
|
foreach ($vals as $v) {
|
||||||
if ($v && is_array($v) && !is_empty($v)) {
|
if ($v && is_array($v) && !is_empty($v)) {
|
||||||
$errors = $errors + $v;
|
$errors = $errors + $v;
|
||||||
|
@ -527,7 +540,7 @@ class m_oci {
|
||||||
/**
|
/**
|
||||||
* Implements hook_oci_form_validate.
|
* Implements hook_oci_form_validate.
|
||||||
*/
|
*/
|
||||||
function hook_oci_form_validate($vars) {
|
function hook_oci_form_validate($app, $vars) {
|
||||||
$errors = array();
|
$errors = array();
|
||||||
// @TODO Drupal
|
// @TODO Drupal
|
||||||
// @TODO Wordpress
|
// @TODO Wordpress
|
||||||
|
|
Loading…
Reference in New Issue