listUpdates(); if (is_array($updates) === false) { return false; } return (count($updates) > 0); } /** * Returns current update manager url. * * @return string */ function update_manager_get_url() { global $config; $url_update_manager = $config['url_update_manager']; if ((bool) is_metaconsole() === false) { if ((bool) $config['node_metaconsole'] === true) { $url_update_manager = $config['metaconsole_base_url']; $url_update_manager .= 'godmode/um_client/api.php'; } } return $url_update_manager; } /** * Prepare configuration values. * * @return array UM Configuration tokens. */ function update_manager_get_config_values() { global $config; global $build_version; global $pandora_version; static $historical_dbh; enterprise_include_once('include/functions_license.php'); $license = db_get_value( db_escape_key_identifier('value'), 'tupdate_settings', db_escape_key_identifier('key'), 'customer_key' ); $data = enterprise_hook('license_get_info'); if ($data === ENTERPRISE_NOT_HOOK) { $limit_count = db_get_value_sql('SELECT count(*) FROM tagente'); } else { $limit_count = $data['count_enabled']; } if ($historical_dbh === null && isset($config['history_db_enabled']) === true && (bool) $config['history_db_enabled'] === true ) { $dbm = new \PandoraFMS\Core\DBMaintainer( [ 'host' => $config['history_db_host'], 'port' => $config['history_db_port'], 'name' => $config['history_db_name'], 'user' => $config['history_db_user'], 'pass' => $config['history_db_pass'], ] ); $historical_dbh = $dbm->getDBH(); } $insecure = false; if ($config['secure_update_manager'] === '' || $config['secure_update_manager'] === null ) { $insecure = false; } else { // Directive defined. $insecure = !$config['secure_update_manager']; } return [ 'url' => update_manager_get_url(), 'insecure' => $insecure, 'license' => $license, 'current_package' => update_manager_get_current_package(), 'MR' => (int) $config['MR'], 'limit_count' => $limit_count, 'build' => $build_version, 'version' => $pandora_version, 'registration_code' => $config['pandora_uid'], 'homedir' => $config['homedir'], 'remote_config' => $config['remote_config'], 'dbconnection' => $config['dbconnection'], 'historydb' => $historical_dbh, 'language' => $config['language'], 'timezone' => $config['timezone'], 'proxy' => [ 'host' => $config['update_manager_proxy_host'], 'port' => $config['update_manager_proxy_port'], 'user' => $config['update_manager_proxy_user'], 'password' => $config['update_manager_proxy_password'], ], ]; } /** * Return ad campaigns messages from UMS. * * @return array|null */ function update_manager_get_messages() { $settings = update_manager_get_config_values(); $umc = new UpdateManager\Client($settings); return $umc->getMessages(); } /** * Function to remove dir and files inside. * * @param string $dir Path to dir. * * @return void */ function rrmdir($dir) { if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != '.' && $object != '..') { if (filetype($dir.'/'.$object) == 'dir') { rrmdir($dir.'/'.$object); } else { unlink($dir.'/'.$object); } } } reset($objects); rmdir($dir); } else { unlink($dir); } }