vpanel-stack/panel/classes/Panel/Vhost/VhostsEnable.php

38 lines
882 B
PHP
Raw Normal View History

2023-06-19 11:53:16 -07:00
<?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 VhostsEnable extends \Panel\Vhost {
function beforeRoute($f3) {
parent::beforeRoute($f3);
}
static function get($f3) {
/* run enable command here */
$domain = $f3->get('PARAMS.vhost');
$messages = array();
$output = system("/usr/local/bin/vhost-enable.sh -d $domain", $result_code);
if ($result_code == 0) {
$messages[] = "Website '$domain' has been enabled.";
} else {
$messages[] = "Error enabling website '$domain'.";
$messages[] = $output;
}
$f3->set('SESSION.messages', $messages);
$f3->reroute("/Websites/$domain");
}
}