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.
68 lines
2.5 KiB
68 lines
2.5 KiB
<?php
|
|
|
|
namespace utils;
|
|
|
|
class apache {
|
|
|
|
public static function enable_site($site) {
|
|
exec(\neato::get_super_user_bin . 'a2ensite ' . safe_cmd_quotes($site), $output, $exit_code);
|
|
check_for_error($exit_code, "Apache Unable to enable site: {$site}");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function disable_site($site) {
|
|
exec(\neato::get_super_user_bin . 'a2dissite ' . safe_cmd_quotes($site), $output, $exit_code);
|
|
check_for_error($exit_code, "Apache Unable to disable site: {$site}");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function enable_module($name) {
|
|
exec(\neato::get_super_user_bin . 'a2enmod ' . safe_cmd_quotes($name), $output, $exit_code);
|
|
check_for_error($exit_code, "Apache Unable to enable module: {$name}");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function disable_module($name) {
|
|
exec(\neato::get_super_user_bin . 'a2dismod ' . safe_cmd_quotes($name), $output, $exit_code);
|
|
check_for_error($exit_code, "Apache Unable to disable site: {$name}");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function enable_config($name) {
|
|
exec(\neato::get_super_user_bin . 'a2enconf ' . safe_cmd_quotes($name), $output, $exit_code);
|
|
check_for_error($exit_code, "Apache Unable to enable config: {$name}");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function disable_config($name) {
|
|
exec(\neato::get_super_user_bin . 'a2disconf ' . safe_cmd_quotes($name), $output, $exit_code);
|
|
check_for_error($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 ' . safe_cmd_quotes($name), $output, $exit_code);
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function query_module($name) {
|
|
exec(\neato::get_super_user_bin . 'a2query -m ' . safe_cmd_quotes($name), $output, $exit_code);
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function query_config($name) {
|
|
exec(\neato::get_super_user_bin . 'a2query -c ' . safe_cmd_quotes($name), $output, $exit_code);
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function ht_password($file, $user, $password, $secure = '') {
|
|
$options = (!file_exists($file)) ? '-c' : '';
|
|
if ($secure == 'bcrypt' || $secure == 'high') {
|
|
$options .= ' -B';
|
|
}
|
|
exec(\neato::get_user_bin . 'htpasswd -b ' . $options . ' ' . safe_cmd($file, $user) . ' ' . safe_cmd($password), $output, $exit_code);
|
|
check_for_error($exit_code, "Unable to add htpasswd in: {$file}");
|
|
return $exit_code;
|
|
}
|
|
|
|
} |