check for download instead of install

This commit is contained in:
dmacias72 2017-07-08 22:54:42 -06:00
parent e0e2de6d0c
commit cb238b20cc
2 changed files with 7 additions and 6 deletions

View File

@ -60,9 +60,9 @@ foreach ($pkgs_github_array as $pkg_github) {
'pkgnver' => $pkg_nver, // add package name with underscored version 'pkgnver' => $pkg_nver, // add package name with underscored version
'pkgversion' => $pkg_version, // add package name with raw version 'pkgversion' => $pkg_version, // add package name with raw version
'size' => format_size($pkg_github['size'], 1, '?'), // add package size 'size' => format_size($pkg_github['size'], 1, '?'), // add package size
'installed' => preg_grep($pkg_pattern, $pkgs_installed) ? 'yes' : 'no', // checks if package name is installed 'installed' => !empty(preg_grep($pkg_pattern, $pkgs_installed)) ? 'yes' : 'no', // checks if package name is installed
'installeq' => in_array(pathinfo($pkg_github['name'], PATHINFO_FILENAME), $pkgs_installed) ? 'yes' : 'no', // checks if package installed equals github exactly 'installeq' => in_array(pathinfo($pkg_github['name'], PATHINFO_FILENAME), $pkgs_installed) ? 'yes' : 'no', // checks if package installed equals github exactly
'downloaded' => preg_grep($pkg_pattern, $pkgs_downloaded) ? 'yes' : 'no', // checks if package name is downloaded 'downloaded' => !empty(preg_grep($pkg_pattern, $pkgs_downloaded)) ? 'yes' : 'no', // checks if package name is downloaded
'downloadeq' => in_array($pkg_github['name'], $pkgs_downloaded) ? 'yes' : 'no', // checks if package downloaded equals github exactly 'downloadeq' => in_array($pkg_github['name'], $pkgs_downloaded) ? 'yes' : 'no', // checks if package downloaded equals github exactly
'config' => $pkg_set, // install preference 'config' => $pkg_set, // install preference
'plugins' => $pkg_plgs, // plugins dependency on package 'plugins' => $pkg_plgs, // plugins dependency on package

View File

@ -67,11 +67,12 @@ $pkg_find = '';
foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each package foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each package
$pkg_cmd = ''; $pkg_cmd = '';
$pkg_msg = '';
$pkg_name = str_replace('_', '.', $pkg_name); // replace "_" with "." in package names $pkg_name = str_replace('_', '.', $pkg_name); // replace "_" with "." in package names
$pkg_pattern = '/^'.$pkg_name.'.-*/'; // search pattern for packages $pkg_pattern = '/^'.$pkg_name.'.-*/'; // search pattern for packages
$pkg_install_status = preg_grep($pkg_pattern, $pkgs_installed); // check install status $pkg_install_status = !empty(preg_grep($pkg_pattern, $pkgs_installed)); // check install status
$pkg_download_status = preg_grep($pkg_pattern, $pkgs_downloaded); // check package download status $pkg_download_status = !empty(preg_grep($pkg_pattern, $pkgs_downloaded)); // check package download status
$pkg_online_status = preg_grep($pkg_pattern, $pkgs_github_array); $pkg_online_status = !empty(preg_grep($pkg_pattern, $pkgs_github_array));
$pkg_find .= " ! -name '".$pkg_name."*'"; $pkg_find .= " ! -name '".$pkg_name."*'";
$pkg_matches = array_filter($pkgs_github_array, function($a) use ($pkg_pattern) { $pkg_matches = array_filter($pkgs_github_array, function($a) use ($pkg_pattern) {
@ -119,7 +120,7 @@ foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each packa
$pkg_cmd = 'upgradepkg --install-new '.$pkg_path.$pkg_name.'* 2>&1'; $pkg_cmd = 'upgradepkg --install-new '.$pkg_path.$pkg_name.'* 2>&1';
} }
} else if ($pkg_pref == 'no' && $pkg_install_status && $argu) { } elseif ($pkg_pref == 'no' && $pkg_download_status && $argu) {
if($plugins){ if($plugins){
logger("$pkg_name in use by another plugin, not uninstalled.",$argq); logger("$pkg_name in use by another plugin, not uninstalled.",$argq);
}else{ }else{