vpanel-stack/panel/classes/Panel/Vhost/VhostsDisable.php
2023-06-19 11:53:16 -07:00

48 lines
1.2 KiB
PHP

<?php
/**
* vpanel-stack
* https://git.stack-source.com/msb/vpanel-stack
* Copyright (c) 2022 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
* GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
*/
namespace Panel\Vhost;
class VhostsDisable extends \Panel\Vhost {
function beforeRoute($f3) {
parent::beforeRoute($f3);
/* verify user exists */
}
static function get($f3) {
/* run delete command here */
$domain = $f3->get('PARAMS.vhost');
$messages = array();
$output = system("/usr/local/bin/vhost-disable.sh -d $domain", $result_code);
if ($result_code == 0) {
$messages[] = "Website '$domain' has been disabled.";
$messages[] = "NOTICE: Nothing has been deleted and the site can be re-enabled at any time.";
} else {
$messages[] = "Error disabling website '$domain'.";
$messages[] = $output;
}
$f3->set('SESSION.messages', $messages);
$f3->reroute("/Websites/$domain");
// $mapping = $f3->get('NAV.mapping');
// if ($mapping == 'vmail') {
// $f3->reroute("/Users");
// } else {
// $f3->reroute("/Email/$domain/Accounts");
// }
}
}