Add PHP version update interface when running in multiphp mode
This commit is contained in:
parent
369415b5f5
commit
256baadb85
|
@ -87,6 +87,16 @@ function load_config_cluster($cluster) {
|
|||
$conf = array_merge($conf, $clusterconf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return wether or not this evoadmin install is a multi PHP install
|
||||
*
|
||||
* @return boolean - True when it's a multi PHP system
|
||||
*/
|
||||
function is_multiphp()
|
||||
{
|
||||
return array_key_exists('php_versions', $conf) && count($conf['php_versions']) > 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Includes
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* common DirectoryIndex page
|
||||
*
|
||||
* Copyright (c) 2009 Evolix - Tous droits reserves
|
||||
*
|
||||
*
|
||||
* vim: expandtab softtabstop=4 tabstop=4 shiftwidth=4 showtabline=2
|
||||
*
|
||||
* @author Gregory Colpart <reg@evolix.fr>
|
||||
|
@ -24,7 +24,7 @@ define('EVOADMIN_BASE','./');
|
|||
session_name('EVOADMINWEB_SESS');
|
||||
session_start();
|
||||
|
||||
error_reporting(E_ALL | E_NOTICE);
|
||||
error_reporting(E_ALL);
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
/**
|
||||
|
@ -56,6 +56,10 @@ if (!array_key_exists('auth', $_SESSION) || $_SESSION['auth']!=1) {
|
|||
|
||||
include_once EVOADMIN_BASE . '../inc/webadmin-itk.php';
|
||||
|
||||
} elseif (preg_match('#^/webadmin/php/(.*)/?$#', $uri, $params)) {
|
||||
|
||||
include_once EVOADMIN_BASE . '../inc/webadmin-php.php';
|
||||
|
||||
} elseif (preg_match('#^/webadmin/edit/(.*)/?$#', $uri, $params)) {
|
||||
|
||||
include_once EVOADMIN_BASE . '../inc/webadmin-edit.php';
|
||||
|
@ -83,4 +87,3 @@ if (!array_key_exists('auth', $_SESSION) || $_SESSION['auth']!=1) {
|
|||
} else {
|
||||
die ("Cette page n'existe pas !!!");
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Apache VirtualHost Management Page
|
||||
*
|
||||
* Copyright (c) 2009 Evolix - Tous droits reserves
|
||||
*
|
||||
* vim: expandtab softtabstop=4 tabstop=4 shiftwidth=4 showtabline=2
|
||||
*
|
||||
* @author Gregory Colpart <reg@evolix.fr>
|
||||
* @author Thomas Martin <tmartin@evolix.fr>
|
||||
* @author Sebastien Palma <spalma@evolix.fr>
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
require_once EVOADMIN_BASE . '../lib/bdd.php';
|
||||
require_once EVOADMIN_BASE . '../lib/domain.php';
|
||||
require_once EVOADMIN_BASE . '../evolibs/Form.php';
|
||||
|
||||
global $conf;
|
||||
|
||||
$form = new FormPage("Modification de la version de PHP", FALSE);
|
||||
$form->addField('php_version', new SelectFormField("Nouvelle version de PHP", True, $conf['php_versions']));
|
||||
|
||||
include_once EVOADMIN_BASE . '../tpl/header.tpl.php';
|
||||
include_once EVOADMIN_BASE . '../tpl/menu.tpl.php';
|
||||
|
||||
$domain = $params[1];
|
||||
|
||||
// TODO: adapt for cluster mode
|
||||
if ($conf['cluster']) {
|
||||
print "<center>";
|
||||
printf ('<h2>ERREUR</h2>');
|
||||
printf ('<p>Cette action n\'est pas encore supportée en mode cluster</p>');
|
||||
printf ('<p><a href="/webadmin">Retour à liste des comptes</a></p>');
|
||||
print "</center>";
|
||||
}
|
||||
else {
|
||||
$cmd = 'web-add.sh list-vhost ' . escapeshellarg($domain);
|
||||
sudoexec($cmd, $data_output, $exec_return);
|
||||
|
||||
$data_split = explode(':', $data_output[0]);
|
||||
$current_PHP_version = $data_split[7];
|
||||
|
||||
if (!empty($_POST)) {
|
||||
$form->isCurrentPage(TRUE);
|
||||
$form->initFields();
|
||||
|
||||
if ($form->verify(TRUE)) {
|
||||
if (isset($conf['php_versions'][$form->getField('php_version')->getValue()]))
|
||||
{
|
||||
$selected_php_version = $conf['php_versions'][$form->getField('php_version')->getValue()];
|
||||
$exec_cmd = 'web-add.sh setphpversion '.escapeshellarg($domain).' '.escapeshellarg($selected_php_version);
|
||||
sudoexec($exec_cmd, $exec_output, $exec_return);
|
||||
|
||||
if ($exec_return == 0) {
|
||||
|
||||
print "<center>";
|
||||
printf ('<p>La version de PHP bien été modifié</p>');
|
||||
printf ('<p><a href="/webadmin">Retour à liste des comptes</a></p>');
|
||||
print "</center>";
|
||||
|
||||
}
|
||||
else {
|
||||
print "<center>";
|
||||
printf ('<h2>ERREUR</h2>');
|
||||
printf ('<p>Une erreur innatendue s\'est produite </p>');
|
||||
|
||||
if ($conf['debug'] == TRUE) {
|
||||
print '<pre>';
|
||||
foreach($exec_output as $exec_line) {
|
||||
printf("%s\n", $exec_line);
|
||||
}
|
||||
print '</pre>';
|
||||
}
|
||||
|
||||
printf ('<p><a href="/webadmin">Retour à liste des comptes</a></p>');
|
||||
print "</center>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
include_once EVOADMIN_BASE . '../tpl/webadmin-php.tpl.php';
|
||||
}
|
||||
}
|
||||
else {
|
||||
include_once EVOADMIN_BASE . '../tpl/webadmin-php.tpl.php';
|
||||
}
|
||||
}
|
||||
else {
|
||||
include_once EVOADMIN_BASE . '../tpl/webadmin-php.tpl.php';
|
||||
}
|
||||
|
||||
include_once EVOADMIN_BASE . '../tpl/footer.tpl.php';
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Edition d'un domaine
|
||||
*
|
||||
* Copyright (c) 2009 Evolix - Tous droits reserves
|
||||
*
|
||||
* vim: expandtab softtabstop=4 tabstop=4 shiftwidth=4 showtabline=2
|
||||
*
|
||||
* @author Thomas Martin <tmartin@evolix.fr>
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<h2>Version PHP</h2>
|
||||
|
||||
<p>Version actuelle de PHP : <?= preg_replace("/^(\d)(\d)$/", '\1.\2', $current_PHP_version) ?></p>
|
||||
|
||||
<form name="form-add" id="form-add" action="" method="POST">
|
||||
<fieldset>
|
||||
<legend>Changement de version de PHP</legend>
|
||||
<?= $form ?>
|
||||
<p><input type="submit" value="Changer"/></p>
|
||||
</fieldset>
|
||||
</form>
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* Copyright (c) 2009 Evolix - Tous droits reserves
|
||||
*
|
||||
* vim: expandtab softtabstop=4 tabstop=4 shiftwidth=4 showtabline=2
|
||||
* vim: expandtab softtabstop=4 tabstop=4 shiftwidth=4 showtabline=2
|
||||
*
|
||||
* @author Gregory Colpart <reg@evolix.fr>
|
||||
* @author Thomas Martin <tmartin@evolix.fr>
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
?>
|
||||
|
||||
<h2>Domaines</h2>
|
||||
<h2>Liste des comptes web</h2>
|
||||
|
||||
<?php if(count($vhost_list) > 0) { ?>
|
||||
<table id="tab-list">
|
||||
|
@ -41,9 +41,7 @@
|
|||
<th> Actif ? </th>
|
||||
|
||||
<?php if(is_superadmin()) {
|
||||
print '<th> Alias </th>';
|
||||
print '<th> ServerName </th>';
|
||||
print '<th> Sécurité </th>';
|
||||
print '<th>Administration</th>';
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -65,7 +63,7 @@
|
|||
}
|
||||
printf('<td><a href="http://%s">http://%s</a></td>',
|
||||
$vhost_info['server_name'], $vhost_info['server_name']);
|
||||
|
||||
|
||||
if ($conf['cluster']) {
|
||||
if (empty($vhost_info['bdd']))
|
||||
printf('<td bgcolor="#696969"/>');
|
||||
|
@ -101,13 +99,15 @@
|
|||
printf('<td>%s</td>', preg_replace("/^(\d)(\d)$/", '\1.\2', $vhost_info['php_version']));
|
||||
}
|
||||
printf('<td>%s</td>', ($vhost_info['is_enabled'] ? 'Activé' : 'Désactivé' ));
|
||||
|
||||
if (is_superadmin()) {
|
||||
printf('<td><a href="/webadmin/edit/%s">Gérer</a></td>',
|
||||
$vhost_info['owner']);
|
||||
printf('<td><a href="/webadmin/servername/%s">Modifier</a></td>',
|
||||
$vhost_info['owner']);
|
||||
printf('<td><a href="/webadmin/itk/%s">Gérer</a></td>',
|
||||
$vhost_info['owner']);
|
||||
printf('<td>');
|
||||
printf('<a href="/webadmin/edit/%s">Alias</a> - ', $vhost_info['owner']);
|
||||
printf('<a href="/webadmin/servername/%s">Servername</a> - ', $vhost_info['owner']);
|
||||
printf('<a href="/webadmin/itk/%s">ITK</a> - ', $vhost_info['owner']);
|
||||
printf('<a href="/webadmin/php/%s">PHP</a>', $vhost_info['owner']);
|
||||
printf('</td>');
|
||||
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
|
|
Loading…
Reference in New Issue