Compare commits
No commits in common. "master" and "0.1.0" have entirely different histories.
48
README.md
48
README.md
|
@ -1,8 +1,6 @@
|
||||||
Adds a panel to quick-install certain CMSs in AlternC. This module provides
|
Adds a panel to quick-install certain CMSs in AlternC. This module provides support for WordPress and Drupal.
|
||||||
support for WordPress and Drupal.
|
|
||||||
|
|
||||||
Support for other CMSs may be added by other AlternC plugins. See "Extending"
|
Support for other CMSs may be added by other AlternC plugins. See "Extending" for more information.
|
||||||
for more information.
|
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
|
@ -14,43 +12,34 @@ 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/panel/ make install`
|
ALTERNC_BASE_PATH=/your/path/alternc make install
|
||||||
|
`
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
Once installed, add the Drush or WP-CLI paths to /etc/alternc/locals.sh. These
|
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.
|
||||||
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
|
||||||
|
`
|
||||||
|
|
||||||
# Option to limit the One-Click Installer menu to users who have 'su' on their
|
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.
|
||||||
# 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
|
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.
|
||||||
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
|
This module is basically at a 'proof of concept' point. For a first proper release, the following should probably be added:
|
||||||
release, the following should probably be added:
|
|
||||||
|
|
||||||
* make sure form content and variables are properly escaped when passed between
|
* make sure form content and variables are properly escaped when passed between scripts
|
||||||
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
|
||||||
|
@ -60,15 +49,10 @@ release, the following should probably be added:
|
||||||
|
|
||||||
Nice to haves:
|
Nice to haves:
|
||||||
|
|
||||||
* threaded install script so user feedback doesn't have to wait X minutes until
|
* threaded install script so user feedback doesn't have to wait X minutes until the shell scripts finish
|
||||||
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
|
Licensed under the GNU General Public License version 2.0 or later. See LICENSE for the full license text.
|
||||||
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($application, $oci_vars);
|
$errors = $oci->oci_form_validate($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,12 +21,7 @@
|
||||||
class m_oci {
|
class m_oci {
|
||||||
|
|
||||||
function hook_menu() {
|
function hook_menu() {
|
||||||
global $mem, $hooks, $L_OCI_REQUIRE_SU;
|
global $hooks, $L_ALTERNC_WPCLI_BIN, $L_ALTERNC_DRUSH_BIN;
|
||||||
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',
|
||||||
|
@ -34,35 +29,27 @@ class m_oci {
|
||||||
'pos' => 11,
|
'pos' => 11,
|
||||||
'links' => array(),
|
'links' => array(),
|
||||||
);
|
);
|
||||||
$links = $hooks->invokve('hook_oci_menu');
|
// @TODO invoke a hook to get supported applications
|
||||||
if ($links) {
|
// need: id (eg. wordpress), weight (to order), ico, and
|
||||||
$menu['links'] = $links;
|
// optionally - a different action path.
|
||||||
}
|
// @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')) {
|
||||||
$links[] = array(
|
$menu['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')) {
|
||||||
$links[] = array(
|
$menu['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',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $links;
|
if ($menu['links']) {
|
||||||
|
return $menu;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -309,7 +296,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_oci_form', array($app));
|
$vals = $hooks->invoke('hook_oic_form', array($app));
|
||||||
foreach ($vals as $v) {
|
foreach ($vals as $v) {
|
||||||
if ($v) {
|
if ($v) {
|
||||||
$extra .= $v;
|
$extra .= $v;
|
||||||
|
@ -330,13 +317,13 @@ class m_oci {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements hook_oci_form.
|
* Implements hook_oic_form.
|
||||||
*/
|
*/
|
||||||
function hook_oci_form($app) {
|
function hook_oic_form($app) {
|
||||||
$f = '';
|
$f = '';
|
||||||
switch ($app) {
|
switch ($app) {
|
||||||
case 'drupal':
|
case 'drupal':
|
||||||
// These fields should be defined in hook_oci_form_fields
|
// These fields should be defined in hook_oic_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>';
|
||||||
|
@ -419,7 +406,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($app, $vars) {
|
function oci_form_validate($vars) {
|
||||||
global $hooks, $dom, $db;
|
global $hooks, $dom, $db;
|
||||||
$errors = array();
|
$errors = array();
|
||||||
if ($vars['domain'] == '*new*') {
|
if ($vars['domain'] == '*new*') {
|
||||||
|
@ -528,7 +515,7 @@ class m_oci {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$vals = $hooks->invoke('hook_oci_form_validate', array($app, $vars));
|
$vals = $hooks->invoke('hook_oci_form_validate', array($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;
|
||||||
|
@ -540,7 +527,7 @@ class m_oci {
|
||||||
/**
|
/**
|
||||||
* Implements hook_oci_form_validate.
|
* Implements hook_oci_form_validate.
|
||||||
*/
|
*/
|
||||||
function hook_oci_form_validate($app, $vars) {
|
function hook_oci_form_validate($vars) {
|
||||||
$errors = array();
|
$errors = array();
|
||||||
// @TODO Drupal
|
// @TODO Drupal
|
||||||
// @TODO Wordpress
|
// @TODO Wordpress
|
||||||
|
|
Loading…
Reference in New Issue