static function getPackages($nocache = false) { $cmd = self::getYumCommand(); $file = fix_nname_to_be_variable(implode(" ", $cmd)); $file = "__path_program_root/cache/{$file}"; if ($nocache) { $val = `{$cmd}`; } else { $val = get_with_cache($file, $cmd); } $list = explode("\n", $val); dprintr($list); $match = false; $res = null; foreach ($list as $l) { $l = trim($l); if (strstr($l, "---------------------")) { $match = true; continue; } if ($match) { if (!$l) { break; } } if (!$match) { continue; } $l = trimSpaces($l); $l = trim($l); if (!$l) { continue; } $v = explode(" ", $l); $out['nname'] = $v[0]; //$out['arch'] = $v[1]; $out['update_version'] = $v[1]; $out['kloxo_status'] = 'dull'; if ($v[3] === 'lxlabs-updates') { $out['kloxo_status'] = 'on'; } $out['repo'] = $v[3]; $res[] = $out; } //dprintr($res); return $res; }
static function getListVersion($syncserver, $list) { $list[]['componentname'] = 'mysql'; $list[]['componentname'] = 'perl'; //$list[]['componentname'] = 'postgresql'; $list[]['componentname'] = 'httpd'; $list[]['componentname'] = 'qmail'; $list[]['componentname'] = 'courier-imap-toaster'; $list[]['componentname'] = 'php'; $list[]['componentname'] = 'lighttpd'; $list[]['componentname'] = 'djbdns'; $list[]['componentname'] = 'bind'; $list[]['componentname'] = 'spamassassin'; $list[]['componentname'] = 'pure-ftpd'; foreach ($list as $l) { $nlist[] = $l['componentname']; } $complist = implode(" ", $nlist); $file = fix_nname_to_be_variable("rpm -q {$complist}"); $file = "__path_program_root/cache/{$file}"; $cmdlist = lx_array_merge(array(array("rpm", "-q"), $nlist)); $val = get_with_cache($file, $cmdlist); $res = explode("\n", $val); $ret = null; foreach ($list as $k => $l) { $name = $list[$k]['componentname']; $sing['nname'] = $name . "___" . $syncserver; $sing['componentname'] = $name; $sing['version'] = self::getVersion($res, $name); $status = strstr($sing['version'], "not installed"); $sing['status'] = $status ? 'off' : 'on'; /* if (isOn($sing['status'])) { $sing['full_version'] = `rpm -qi $name`; } else { $sing['full_version'] = $sing['version']; } */ $ret[] = $sing; } return $ret; }