summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/pfsense-utils.inc
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-10-20 09:09:39 -0200
committerRenato Botelho <renato@netgate.com>2015-10-20 09:12:35 -0200
commit0cdb94e1cbf726063d1e9be30782c0fbe4c8fdc4 (patch)
treecbce26ac6d6e1377c0321b3ada82fa41b62e2da8 /src/etc/inc/pfsense-utils.inc
parent232263ecc1bae4466fe56f468598cf406750e846 (diff)
downloadpfsense-0cdb94e1cbf726063d1e9be30782c0fbe4c8fdc4.zip
pfsense-0cdb94e1cbf726063d1e9be30782c0fbe4c8fdc4.tar.gz
Cleanup unused code:
- Remove xmlrpcbaseurl from globals - Remove xmlrpcpath from globals - Remove embeddedbootupslice from globals - Remove call_pfsense_method() - Remove check_firmware_version() - Remove get_active_xml_rpc_base_url() - Remove zeromq.inc - Remove pkg_mgr_settings.php - Remove pkg_mgr_settings.php privilege definitions - Bump config version to 12.3 - Write upgrade code to cleanup $config['altpkgrepo'] - Remove check_firmware_version method from xmlrpc.php - Fix pfSense_firmware_version_doc text
Diffstat (limited to 'src/etc/inc/pfsense-utils.inc')
-rw-r--r--src/etc/inc/pfsense-utils.inc108
1 files changed, 0 insertions, 108 deletions
diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc
index 4eefaa0..80a17d3 100644
--- a/src/etc/inc/pfsense-utils.inc
+++ b/src/etc/inc/pfsense-utils.inc
@@ -740,103 +740,6 @@ function rmdir_recursive($path, $follow_links=false) {
}
/*
- * call_pfsense_method(): Call a method exposed by the pfsense.org XMLRPC server.
- */
-function call_pfsense_method($method, $params, $timeout = 0) {
- global $g, $config;
-
- $xmlrpc_base_url = get_active_xml_rpc_base_url();
- $xmlrpc_path = $g['xmlrpcpath'];
-
- $xmlrpcfqdn = preg_replace("(https?://)", "", $xmlrpc_base_url);
- $ip = gethostbyname($xmlrpcfqdn);
- if ($ip == $xmlrpcfqdn) {
- return false;
- }
-
- $msg = new XML_RPC_Message($method, array(XML_RPC_Encode($params)));
- $port = 0;
- $proxyurl = "";
- $proxyport = 0;
- $proxyuser = "";
- $proxypass = "";
- if (!empty($config['system']['proxyurl'])) {
- $proxyurl = $config['system']['proxyurl'];
- }
- if (!empty($config['system']['proxyport']) && is_numeric($config['system']['proxyport'])) {
- $proxyport = $config['system']['proxyport'];
- }
- if (!empty($config['system']['proxyuser'])) {
- $proxyuser = $config['system']['proxyuser'];
- }
- if (!empty($config['system']['proxypass'])) {
- $proxypass = $config['system']['proxypass'];
- }
- $cli = new XML_RPC_Client($xmlrpc_path, $xmlrpc_base_url, $port, $proxyurl, $proxyport, $proxyuser, $proxypass);
- // If the ALT PKG Repo has a username/password set, use it.
- if ($config['system']['altpkgrepo']['username'] &&
- $config['system']['altpkgrepo']['password']) {
- $username = $config['system']['altpkgrepo']['username'];
- $password = $config['system']['altpkgrepo']['password'];
- $cli->setCredentials($username, $password);
- }
- $resp = $cli->send($msg, $timeout);
- if (!is_object($resp)) {
- log_error(sprintf(gettext("XMLRPC communication error: %s"), $cli->errstr));
- return false;
- } elseif ($resp->faultCode()) {
- log_error(sprintf(gettext('XMLRPC request failed with error %1$s: %2$s'), $resp->faultCode(), $resp->faultString()));
- return false;
- } else {
- return XML_RPC_Decode($resp->value());
- }
-}
-
-/*
- * check_firmware_version(): Check whether the current firmware installed is the most recently released.
- */
-function check_firmware_version($tocheck = "all", $return_php = true) {
- global $g, $config;
-
- $xmlrpc_base_url = get_active_xml_rpc_base_url();
- $xmlrpcfqdn = preg_replace("(https?://)", "", $xmlrpc_base_url);
- $ip = gethostbyname($xmlrpcfqdn);
- if ($ip == $xmlrpcfqdn) {
- return false;
- }
- $version = php_uname('r');
- $version = explode('-', $version);
- $rawparams = array("firmware" => array("version" => $g['product_version']),
- "kernel" => array("version" => $version[0]),
- "base" => array("version" => $version[0]),
- "platform" => trim(file_get_contents('/etc/platform')),
- "config_version" => $config['version']
- );
- unset($version);
-
- if ($tocheck == "all") {
- $params = $rawparams;
- } else {
- foreach ($tocheck as $check) {
- $params['check'] = $rawparams['check'];
- $params['platform'] = $rawparams['platform'];
- }
- }
- if ($config['system']['firmware']['branch']) {
- $params['branch'] = $config['system']['firmware']['branch'];
- }
-
- /* XXX: What is this method? */
- if (!($versions = call_pfsense_method('pfsense.get_firmware_version', $params))) {
- return false;
- } else {
- $versions["current"] = $params;
- }
-
- return $versions;
-}
-
-/*
* host_firmware_version(): Return the versions used in this install
*/
function host_firmware_version($tocheck = "") {
@@ -3183,15 +3086,4 @@ function pkg_call_plugins($plugin_type, $plugin_params) {
return $results;
}
-/* Function to find and return the active XML RPC base URL to avoid code duplication */
-function get_active_xml_rpc_base_url() {
- global $config, $g;
- /* If the user has activated the option to enable an alternate xmlrpcbaseurl, and it's not empty, then use it */
- if (isset($config['system']['altpkgrepo']['enable']) && !empty($config['system']['altpkgrepo']['xmlrpcbaseurl'])) {
- return $config['system']['altpkgrepo']['xmlrpcbaseurl'];
- } else {
- return $g['xmlrpcbaseurl'];
- }
-}
-
?>
OpenPOWER on IntegriCloud