foreach ($options as $p) { $op = $package[$p[0]] == 1 || $package[$p[0]] == '1' || $package[$p[0]] === 'enable'; $f->add(new TrFormElement($p[1], new CheckboxTpl($p[0])), array("value" => $op ? 'checked' : '')); } foreach ($cmds as $p) { $f->add(new HiddenTpl($p[0] . 'name'), array("value" => $package[$p[0]]['name'], "hide" => True)); $f->add(new TrFormElement($p[2], new TextareaTpl($p[0] . 'cmd')), array("value" => htmlspecialchars($package[$p[0]]['command']))); } /* ================= BEGIN FILE LIST ===================== */ global $conf; $maxperpage = $conf["global"]["maxperpage"]; $names = array(); $cssClasses = array(); $params = array(); // Get Papi details $papi_details = getPApiDetail($p_api_id); $pserver_base_url = ''; // Very dirty hack: TODO: read conf from package server if ($papi_details['mountpoint'] == '/package_api_get1') { $mirror = 'mirror1'; } elseif ($papi_details['mountpoint'] == '/appstream') { $mirror = 'appstream'; } $pserver_base_url = $papi_details['protocol'] . '://' . $papi_details['server'] . ':' . $papi_details['port'] . '/' . $mirror . "_files/{$pid}/"; foreach ($package['files'] as $file) { if ($file['name'] == "MD5SUMS") { continue; } $names[] = sprintf('<a href="%s">%s</a>', $pserver_base_url . $file['name'], $file['name']); $params[] = array('p_api' => $_GET['p_api'], 'pid' => $_GET['pid'], 'filename' => $file['name'], 'delete_file' => 1); //$sizes[$i] = formatFileSize($sizes[$i]);
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MMC; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once "modules/pkgs/includes/xmlrpc.php"; require_once "modules/msc/includes/package_api.php"; require_once "modules/msc/includes/utilities.php"; global $conf; $maxperpage = $conf["global"]["maxperpage"]; $filter = array('filter' => $_GET["filter"], 'location' => $_GET['location'], 'bundle' => 1); $filter1 = $_GET["filter"] . '##' . $_GET['location']; if ($_GET['location']) { $filter['packageapi'] = getPApiDetail(base64_decode($_GET['location'])); } if (isset($_GET["start"])) { $start = $_GET["start"]; } else { $start = 0; } $_SESSION['pkgs_selected'] = base64_decode($filter['location']); $packages = advGetAllPackages($filter, $start, $start + $maxperpage); $count = $packages[0]; $packages = $packages[1]; $desc = $params = $names = $versions = $licenses = $size = array(); $err = array(); foreach ($packages as $p) { $p = $p[0]; if (isset($p['ERR']) && $p['ERR'] == 'PULSE2ERROR_GETALLPACKAGE') {
function restart_active_convergence_commands($papi_id, $package) { $package = (object) $package; // Get convergence commands to restart $active_commands = xmlrpc_get_active_convergence_commands($papi_id, $package->id); if ($active_commands) { // WTF, this dyngroup function needs pkgs and msc.... if (in_array('pkgs', $_SESSION['modulesList'])) { require_once 'modules/pkgs/includes/xmlrpc.php'; } else { new NotifyWidgetWarn(_T("Failed to load some pkgs module", "pkgs")); return False; } if (in_array('msc', $_SESSION['modulesList'])) { require_once 'modules/msc/includes/commands_xmlrpc.inc.php'; } else { new NotifyWidgetWarn(_T("Failed to load some msc module", "pkgs")); return False; } // We need ServerAPI for some convergence methods... $ServerAPI = getPApiDetail($papi_id); // ... but without 'uuid' unset($ServerAPI['uuid']); $cmd_type = 2; $active = 1; $ordered_proxies = array(); $mode = 'push'; function __get_command_start_date($cmd_id) { $command_details = command_detail($cmd_id); list($year, $month, $day, $hour, $minute, $second) = $command_details['start_date']; return sprintf("%s-%s-%s %s:%s:%s", $year, $month, $day, $hour, $minute, $second); } foreach ($active_commands as $command) { $gid = $command['gid']; $cmd_id = $command['cmd_id']; /* Stop command */ stop_command($cmd_id); /* Set end date of this command to now(), don't touch to start date */ $start_date = __get_command_start_date($cmd_id); extend_command($cmd_id, $start_date, date("Y-m-d H:i:s")); /* Create new command */ $deploy_group_id = xmlrpc_get_deploy_group_id($gid, $ServerAPI, $package->id); $params = xmlrpc_get_convergence_phases($gid, $ServerAPI, $package->id); $command_id = add_command_api($package->id, NULL, $params, $ServerAPI, $mode, $deploy_group_id, $ordered_proxies, $cmd_type); /* Update convergence DB */ $updated_datas = array('active' => $active, 'commandId' => intval($command_id), 'cmdPhases' => $params); xmlrpc_edit_convergence_datas($gid, $ServerAPI, $package->id, $updated_datas); } } }