diff options
-rw-r--r-- | src/etc/inc/pkg-utils.inc | 7 | ||||
-rw-r--r-- | src/usr/local/www/pkg_mgr.php | 16 | ||||
-rw-r--r-- | src/usr/local/www/pkg_mgr_install.php | 6 | ||||
-rw-r--r-- | src/usr/local/www/pkg_mgr_installed.php | 4 |
4 files changed, 23 insertions, 10 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc index a3b5e2a..3e0fd7a 100644 --- a/src/etc/inc/pkg-utils.inc +++ b/src/etc/inc/pkg-utils.inc @@ -232,7 +232,7 @@ function is_pkg_installed($pkg_name) { pkg_remove_prefix($pkg_name); - return pkg_call("info -e " . $g['pkg_prefix'] . $pkg_name, true); + return pkg_call("info " . $g['pkg_prefix'] . $pkg_name, true); } /* Install package, $pkg_name should not contain prefix */ @@ -305,7 +305,7 @@ function get_package_internal_name($package_data) { /* Get information about packages */ function get_pkg_info($pkgs = 'all', $info = 'all') { - global $g, $static_output; + global $g, $static_output, $input_errors; $out = ''; $err = ''; @@ -318,6 +318,7 @@ function get_pkg_info($pkgs = 'all', $info = 'all') { $static_output .= "\n" . gettext("Updating package repository metadada...") . "\n"; update_status($static_output); if (!pkg_call("update")) { + $input_errors[] = gettext("ERROR: An error occurred when updating packages repository. Aborting...") . "\n"; $static_output .= "\n" . gettext("ERROR: An error occurred when updating packages repository. Aborting...") . "\n"; update_status($static_output); return array(); @@ -328,6 +329,8 @@ function get_pkg_info($pkgs = 'all', $info = 'all') { if ($rc != 0) { $static_output .= "\n" . gettext("ERROR: Error trying to get packages list. Aborting...") . "\n"; $static_output .= $err; + $input_errors[] = gettext("ERROR: Error trying to get packages list. Aborting...") . "\n"; + $input_errors[] = $err; update_status($static_output); return array(); } diff --git a/src/usr/local/www/pkg_mgr.php b/src/usr/local/www/pkg_mgr.php index f23d981..66bf800 100644 --- a/src/usr/local/www/pkg_mgr.php +++ b/src/usr/local/www/pkg_mgr.php @@ -88,11 +88,14 @@ if(is_subsystem_dirty('packagelock')) { exit; } +include("head.inc"); + //get_pkg_info only if cache file has more then $g[min_pkg_cache_file_time] seconds $pkg_cache_file_time=($g['min_pkg_cache_file_time'] ? $g['min_pkg_cache_file_time'] : 120); $xmlrpc_base_url = get_active_xml_rpc_base_url(); if (!file_exists("{$g['tmp_path']}/pkg_info.cache") || (time() - filemtime("{$g['tmp_path']}/pkg_info.cache")) > $pkg_cache_file_time) { + unset($input_errors); $pkg_info = get_pkg_info('all', array("noembedded", "name", "category", "website", "version", "status", "descr", "maintainer", "required_version", "maximum_version", "pkginfolink", "config_file")); //create cache file after get_pkg_info if($pkg_info) { @@ -118,18 +121,20 @@ if (! empty($_GET)) $requested_version = htmlspecialchars($_GET['ver']); $pgtitle = array(gettext("System"),gettext("Package Manager")); -include("head.inc"); /* Print package server mismatch warning. See https://redmine.pfsense.org/issues/484 */ if (!verify_all_package_servers()) - print_info_box(package_server_mismatch_message()); + print_info_box(package_server_mismatch_message(), 'danger'); /* Print package server SSL warning. See https://redmine.pfsense.org/issues/484 */ if (check_package_server_ssl() === false) print_info_box(package_server_ssl_failure_message()); +if ($input_errors) + print_input_errors($input_errors); + if ($savemsg) - print_info_box($savemsg); + print_info_box($savemsg, 'success'); $version = rtrim(file_get_contents("/etc/version")); @@ -138,7 +143,6 @@ $tab_array[] = array(gettext("Available Packages"), $requested_version <> "" ? f $tab_array[] = array(gettext("Installed Packages"), false, "pkg_mgr_installed.php"); display_top_tabs($tab_array); -$version = rtrim(file_get_contents("/etc/version")); if($pkg_info) { $pkg_keys = array_keys($pkg_info); natcasesort($pkg_keys); @@ -150,6 +154,7 @@ if($pkg_info) { $categories[$pkg_info[$key]['category']]++; } } + ksort($categories); $cm_count=0; $tab_array = array(); @@ -176,6 +181,7 @@ if($pkg_info) { $cm_count++; } } + $tab_array[] = array(gettext("Other Categories"), $menu_category=="Other" ? true : false, "pkg_mgr.php?category=Other"); if (count($categories) > 1) display_top_tabs($tab_array); @@ -200,12 +206,12 @@ if(!$pkg_info || !is_array($pkg_keys)):?> </thead> <tbody> <?php + foreach($pkg_keys as $key): $index = &$pkg_info[$key]; if(get_pkg_id($index['name']) >= 0 ) continue; - continue; /* get history/changelog git dir */ $commit_dir=explode("/",$index['config_file']); diff --git a/src/usr/local/www/pkg_mgr_install.php b/src/usr/local/www/pkg_mgr_install.php index afad62f..450f80b 100644 --- a/src/usr/local/www/pkg_mgr_install.php +++ b/src/usr/local/www/pkg_mgr_install.php @@ -130,6 +130,8 @@ display_top_tabs($tab_array); <div class="panel-footer"> <input type="hidden" name="id" value="<?=$pkgname;?>" /> <input type="hidden" name="mode" value="<?=$pkgmode;?>" /> + <input type="submit" class="btn btn-success" name="pkgconfirm" id="pkgconfirm" value="Confirm"/> + <input type="submit" class="btn btn-default" name="pkgcancel" id="pkgcancel" value="Cancel"/> </div> </div> <?php endif;?> @@ -137,7 +139,7 @@ display_top_tabs($tab_array); <?php if (!empty($_POST['id']) || $_GET['mode'] == 'showlog' || ($_GET['mode'] == 'installedinfo' && !empty($_GET['pkg']))):?> <div class="panel panel-default"> <div class="panel-heading"> - <h2 id="status"><?=gettext("Beginning package installation.")?></h2> + <h4 id="status"><?=gettext("Beginning package installation.")?></h4> </div> <div class="panel-body"> @@ -242,7 +244,7 @@ if ($_GET) { default: $status = install_package($pkgid); if ($status != 0) { - update_status(gettext("Installation of") . " {$pkgid} " . gettext("FAILED!")); + update_status(gettext("Installation of") . " {$pkgid} " . gettext("FAILED! ")); $static_output .= "\n" . gettext("Installation halted."); update_output_window($static_output); } else { diff --git a/src/usr/local/www/pkg_mgr_installed.php b/src/usr/local/www/pkg_mgr_installed.php index 91c90be..b47357b 100644 --- a/src/usr/local/www/pkg_mgr_installed.php +++ b/src/usr/local/www/pkg_mgr_installed.php @@ -57,15 +57,17 @@ if (is_subsystem_dirty('packagelock')) { exit; } +include("head.inc"); + if(is_array($config['installedpackages']['package'])) { foreach($config['installedpackages']['package'] as $instpkg) { $tocheck[] = $instpkg['name']; } + $currentvers = get_pkg_info($tocheck, array('version', 'xmlver', 'pkginfolink', 'descr')); } $closehead = false; $pgtitle = array(gettext("System"), gettext("Package Manager")); -include("head.inc"); /* Print package server mismatch warning. See https://redmine.pfsense.org/issues/484 */ if (!verify_all_package_servers()) |