public static function regenerate_server_config($add_responses = true) { require_once ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-config-file.php'; $result = ITSEC_Lib_Config_File::update_server_config(); $success = !is_wp_error($result); $server = ITSEC_Lib_Utility::get_web_server(); if ($add_responses) { if (is_wp_error($result)) { ITSEC_Response::add_error($result); $file = ITSEC_Lib_Config_File::get_server_config_file_path(); } else { if ('nginx' === $server) { ITSEC_Response::add_message(__('You must restart your NGINX server for the changes to take effect.', 'better-wp-security')); } } } return $success; }
/** * Saves all rewrite rules to htaccess or similar file. * * Gets a file lock for .htaccess and calls the writing function if successful. * * @since 4.0.0 * * @return mixed array or false if writing disabled or error message */ public function save_rewrites() { require_once trailingslashit($GLOBALS['itsec_globals']['plugin_dir']) . 'core/lib/class-itsec-lib-config-file.php'; $result = ITSEC_Lib_Config_File::update_server_config(); if (is_wp_error($result)) { $retval = array('success' => false, 'text' => $result->get_error_message()); } else { $server = ITSEC_Lib_Utility::get_web_server(); if ('nginx' === $server) { $retval = array('success' => true, 'text' => __('You must restart your NGINX server for the settings to take effect', 'better-wp-security')); } else { $retval = array('success' => true, 'text' => true); } } return $retval; }