PHP Deployment Scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
neatoDeploy/app/utils/apache.php

75 lines
2.6 KiB

<?php
namespace utils;
class apache {
public static function enable_site($site) {
exec(\neato::get_super_user_bin . 'a2ensite ' . safeCmdQuotes($site), $output, $exit_code);
checkForError($exit_code, "Apache Unable to enable site: {$site}");
return $exit_code;
}
public static function disable_site($site) {
exec(\neato::get_super_user_bin . 'a2dissite ' . safeCmdQuotes($site), $output, $exit_code);
checkForError($exit_code, "Apache Unable to disable site: {$site}");
return $exit_code;
}
public static function enable_module($name) {
exec(\neato::get_super_user_bin . 'a2enmod ' . safeCmdQuotes($name), $output, $exit_code);
checkForError($exit_code, "Apache Unable to enable module: {$name}");
return $exit_code;
}
public static function disable_module($name) {
exec(\neato::get_super_user_bin . 'a2dismod ' . safeCmdQuotes($name), $output, $exit_code);
checkForError($exit_code, "Apache Unable to disable site: {$name}");
return $exit_code;
}
public static function enable_config($name) {
exec(\neato::get_super_user_bin . 'a2enconf ' . safeCmdQuotes($name), $output, $exit_code);
checkForError($exit_code, "Apache Unable to enable config: {$name}");
return $exit_code;
}
public static function disable_config($name) {
exec(\neato::get_super_user_bin . 'a2disconf ' . safeCmdQuotes($name), $output, $exit_code);
checkForError($exit_code, "Apache Unable to disable config: {$name}");
return $exit_code;
}
public static function query_site($name) {
exec(\neato::get_super_user_bin . 'a2query -s ' . safeCmdQuotes($name), $output, $exit_code);
return $exit_code;
}
public static function query_module($name) {
exec(\neato::get_super_user_bin . 'a2query -m ' . safeCmdQuotes($name), $output, $exit_code);
return $exit_code;
}
public static function query_config($name) {
exec(\neato::get_super_user_bin . 'a2query -c ' . safeCmdQuotes($name), $output, $exit_code);
return $exit_code;
}
public static function ht_password($file, $user, $password, $secure = '') {
$utils = useMe("apache2-utils");
if ($utils === false) {
display("Unable to install apache2-utils");
return false;
}
$options = (!file_exists($file)) ? '-c' : '';
if ($secure == 'bcrypt' || $secure == 'high') {
$options .= ' -B';
}
exec(\neato::get_user_bin . 'htpasswd -b ' . $options . ' ' . safeCmd($file, $user) . ' ' . safeCmd($password), $output, $exit_code);
checkForError($exit_code, "Unable to add htpasswd in: {$file}");
return $exit_code;
}
}