delete list-servername function

This commit is contained in:
Nicolas Roman 2019-05-16 14:40:30 +02:00
parent c995678003
commit 48168c534e
3 changed files with 19 additions and 49 deletions

View File

@ -193,17 +193,15 @@ if (isset($_GET['edit']) ) {
$alias_list = $bdd->list_serveralias($domain);
}
else {
$cmd = 'web-add.sh list-servername ' . $domain;
$cmd = 'web-add.sh list-vhost ' . $domain;
if(!is_superadmin()) {
$cmd = sprintf('%s %s', $cmd, $_SESSION['user']);
}
sudoexec($cmd, $data_output, $exec_return);
foreach($data_output as $data_line) {
array_push($servername_list, $data_line);
}
$data_vhost = explode(':', $data_output[0]);
$servername = $data_vhost[2];
}
include_once EVOADMIN_BASE . '../tpl/header.tpl.php';

View File

@ -128,30 +128,26 @@ del-alias VHOST ALIAS
Del a ServerAlias from an Apache vhost
list-servername LOGIN
List ServerName(s) for user LOGIN
update-servername VHOST SERVERNAME OLD_SERVERNAME
Replace the OLD_SERVERNAME with the SERVERNAME for an Apache vhost
Also apply to rules
Also apply to rewrite rules
check-occurence NAME
List all occurences of NAME in vhosts
list-user-itk DOMAIN LOGIN
list-user-itk LOGIN
List the assigned ITK user for the DOMAIN specified
List the assigned ITK user for the LOGIN specified
enable-user-itk DOMAIN LOGIN
enable-user-itk LOGIN
Enable the assigned ITK user for the DOMAIN specified
Enable the assigned ITK user for the LOGIN specified
disable-user-itk DOMAIN LOGIN
disable-user-itk LOGIN
Disable the assigned ITK user for the DOMAIN specified
Disable the assigned ITK user for the LOGIN specified
setphpversion LOGIN VERSION
@ -828,9 +824,6 @@ arg_processing() {
del-alias)
op_aliasdel "$@"
;;
list-servername)
op_listservername "$@"
;;
update-servername)
op_servernameupdate "$@"
;;
@ -942,25 +935,6 @@ op_aliasdel() {
fi
}
op_listservername() {
if [ $# -eq 1 ]; then
vhost_file="$VHOST_PATH/${1}.conf";
if [ -f "${vhost_file}" ]; then
servernames=$(awk '/^[[:space:]]*ServerName (.*)/ { print $2 }' "$vhost_file" | uniq)
for servername in $servernames; do
echo "$servername";
done
else
echo "VHost file \`${vhost_file}' not found'" >&2
return 1
fi
else
usage
fi
}
op_servernameupdate() {
if [ $# -eq 3 ]; then
vhost="${1}.conf"
@ -968,7 +942,6 @@ op_servernameupdate() {
old_servername=$3
vhost_file="${VHOST_PATH}/${vhost}"
# Remplacement de toutes les directives ServerName, on assume qu'il s'agit du même pour chaque vhost du fichier
if [ -f "${vhost_file}" ]; then
sed -i "/^ *ServerName/ s/$old_servername/$servername/g" "${vhost_file}" --follow-symlinks
sed -i "/^ *RewriteCond/ s/$old_servername/$servername/g" "${vhost_file}" --follow-symlinks

View File

@ -17,7 +17,7 @@
<?php
if(count($servername_list) > 0) { ?>
if(!empty($servername)) { ?>
<table id="tab-list">
<thead>
@ -30,15 +30,14 @@
</thead>
<tbody>
<?php
for ( $i=0; $i < count($servername_list); ++$i ) {
print '<tr>';
printf('<td>%s</td>',
$servername_list[$i]);
if (is_superadmin())
printf('<td><a href="/webadmin/servername/%s?edit=%s">Modifier</a></td>',
$domain, $servername_list[$i]);
print '</tr>';
} ?>
print '<tr>';
printf('<td>%s</td>',
$servername);
if (is_superadmin())
printf('<td><a href="/webadmin/servername/%s?edit=%s">Modifier</a></td>',
$domain, $servername);
print '</tr>';
?>
</tbody>
</table>
<?php