1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
pkg_mgr_installed.php
|
5
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
6
|
Copyright (C) 2004-2012 Scott Ullrich <sullrich@gmail.com>
|
7
|
All rights reserved.
|
8
|
|
9
|
Redistribution and use in source and binary forms, with or without
|
10
|
modification, are permitted provided that the following conditions are met:
|
11
|
|
12
|
1. Redistributions of source code must retain the above copyright notice,
|
13
|
this list of conditions and the following disclaimer.
|
14
|
|
15
|
2. Redistributions in binary form must reproduce the above copyright
|
16
|
notice, this list of conditions and the following disclaimer in the
|
17
|
documentation and/or other materials provided with the distribution.
|
18
|
|
19
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
20
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
21
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
22
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
23
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
POSSIBILITY OF SUCH DAMAGE.
|
29
|
*/
|
30
|
/*
|
31
|
pfSense_MODULE: pkgs
|
32
|
*/
|
33
|
|
34
|
##|+PRIV
|
35
|
##|*IDENT=page-system-packagemanager-installed
|
36
|
##|*NAME=System: Package Manager: Installed page
|
37
|
##|*DESCR=Allow access to the 'System: Package Manager: Installed' page.
|
38
|
##|*MATCH=pkg_mgr_installed.php*
|
39
|
##|-PRIV
|
40
|
|
41
|
require_once("guiconfig.inc");
|
42
|
require_once("pkg-utils.inc");
|
43
|
|
44
|
$timezone = $config['system']['timezone'];
|
45
|
if (!$timezone)
|
46
|
$timezone = "Etc/UTC";
|
47
|
|
48
|
date_default_timezone_set($timezone);
|
49
|
|
50
|
/* if upgrade in progress, alert user */
|
51
|
if(is_subsystem_dirty('packagelock')) {
|
52
|
$pgtitle = array(gettext("System"),gettext("Package Manager"));
|
53
|
include("head.inc");
|
54
|
print_info_box_np("Please wait while packages are reinstalled in the background.");
|
55
|
include("foot.inc");
|
56
|
exit;
|
57
|
}
|
58
|
|
59
|
if(is_array($config['installedpackages']['package'])) {
|
60
|
foreach($config['installedpackages']['package'] as $instpkg) {
|
61
|
$tocheck[] = $instpkg['name'];
|
62
|
}
|
63
|
$currentvers = get_pkg_info($tocheck, array('version', 'xmlver', 'pkginfolink','descr'));
|
64
|
}
|
65
|
$closehead = false;
|
66
|
$pgtitle = array(gettext("System"),gettext("Package Manager"));
|
67
|
include("head.inc");
|
68
|
|
69
|
/* Print package server mismatch warning. See https://redmine.pfsense.org/issues/484 */
|
70
|
if (!verify_all_package_servers())
|
71
|
print_info_box(package_server_mismatch_message());
|
72
|
|
73
|
/* Print package server SSL warning. See https://redmine.pfsense.org/issues/484 */
|
74
|
if (check_package_server_ssl() === false)
|
75
|
print_info_box(package_server_ssl_failure_message());
|
76
|
|
77
|
$version = file_get_contents("/etc/version");
|
78
|
$tab_array = array();
|
79
|
$tab_array[] = array(gettext("Available Packages"), false, "pkg_mgr.php");
|
80
|
// $tab_array[] = array("{$version} " . gettext("packages"), false, "pkg_mgr.php");
|
81
|
// $tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none");
|
82
|
// $tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other");
|
83
|
$tab_array[] = array(gettext("Installed Packages"), true, "pkg_mgr_installed.php");
|
84
|
display_top_tabs($tab_array);
|
85
|
|
86
|
if(!is_array($config['installedpackages']['package'])):?>
|
87
|
<div class="alert alert-warning">
|
88
|
<?=gettext("There are no packages currently installed.")?>
|
89
|
</div>
|
90
|
<?php else: ?>
|
91
|
<div class="table-responsive">
|
92
|
<table class="table table-striped table-hover">
|
93
|
<thead>
|
94
|
<tr>
|
95
|
<th><span class="sr-only"><?=gettext("Status")?></span></th>
|
96
|
<th><?=gettext("Name")?></th>
|
97
|
<th><?=gettext("Category")?></th>
|
98
|
<th><?=gettext("Version")?></th>
|
99
|
<th><?=gettext("Description")?></th>
|
100
|
</tr>
|
101
|
</thead>
|
102
|
<tbody>
|
103
|
<?php
|
104
|
$instpkgs = array();
|
105
|
foreach($config['installedpackages']['package'] as $instpkg) {
|
106
|
$instpkgs[] = $instpkg['name'];
|
107
|
}
|
108
|
natcasesort($instpkgs);
|
109
|
|
110
|
foreach ($instpkgs as $index => $pkgname):
|
111
|
$pkg = $config['installedpackages']['package'][$index];
|
112
|
if(!$pkg['name'])
|
113
|
continue;
|
114
|
|
115
|
// get history/changelog git dir
|
116
|
$commit_dir=explode("/",$pkg['config_file']);
|
117
|
$changeloglink ="https://github.com/pfsense/pfsense-packages/commits/master/config/".$commit_dir[(count($commit_dir)-2)];
|
118
|
#check package version
|
119
|
$latest_package = $currentvers[$pkg['name']]['version'];
|
120
|
if ($latest_package) {
|
121
|
// we're running a newer version of the package
|
122
|
if(strcmp($pkg['version'], $latest_package) > 0) {
|
123
|
$status = 'Newer then available ('. $latest_package .')';
|
124
|
$statusicon = 'exclamation';
|
125
|
}
|
126
|
// we're running an older version of the package
|
127
|
if(strcmp($pkg['version'], $latest_package) < 0) {
|
128
|
$status = 'Upgrade available to '.$latest_package;
|
129
|
$statusicon = 'plus';
|
130
|
}
|
131
|
// we're running the current version
|
132
|
if(!strcmp($pkg['version'], $latest_package)) {
|
133
|
$status = 'Up-to-date';
|
134
|
$statusicon = 'ok';
|
135
|
}
|
136
|
$pkgdescr = $currentvers[$pkg['name']]['descr'];
|
137
|
} else {
|
138
|
// unknown available package version
|
139
|
$status = 'Unknown';
|
140
|
$statusicon = 'question';
|
141
|
$pkgdescr = $pkg['descr'];
|
142
|
}
|
143
|
?>
|
144
|
<tr>
|
145
|
<td>
|
146
|
<i title="<?=$status?>" class="icon icon-<?=$statusicon?>-sign"></i>
|
147
|
</td>
|
148
|
<td>
|
149
|
<?=$pkg['name']?>
|
150
|
</td>
|
151
|
<td>
|
152
|
<?=$pkg['category']?>
|
153
|
</td>
|
154
|
<td>
|
155
|
<?php if (!$g['disablepackagehistory']):?>
|
156
|
<a target="_blank" title="<?=gettext("View changelog")?>" href="<?=htmlspecialchars($changeloglink)?>">
|
157
|
<?php endif;?>
|
158
|
<?=htmlspecialchars($pkg['version'])?>
|
159
|
</a>
|
160
|
</td>
|
161
|
<td>
|
162
|
<?=$pkgdescr?>
|
163
|
</td>
|
164
|
<td>
|
165
|
<a href="pkg_mgr_install.php?mode=delete&pkg=<?=$pkg['name']?>" class="btn btn-danger">remove</a>
|
166
|
<a href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?=$pkg['name']?>" class="btn btn-info">reinstall</a>
|
167
|
<a href="pkg_mgr_install.php?mode=reinstallxml&pkg=<?=$pkg['name']?>" class="btn btn-info"><?=gettext("reinstall GUI")?></a>
|
168
|
<?php if(!$g['disablepackageinfo'] && $pkg['pkginfolink'] && $pkg['pkginfolink'] != $pkg['website']):?>
|
169
|
<a target="_blank" title="<?=gettext("View more inforation")?>" href="<?=htmlspecialchars($pkg['pkginfolink'])?>" class="btn btn-default">info</a>
|
170
|
<?php endif;?>
|
171
|
</td>
|
172
|
</tr>
|
173
|
<?php endforeach;?>
|
174
|
</tbody>
|
175
|
</table>
|
176
|
</div>
|
177
|
<?php endif; ?>
|
178
|
<?php include("foot.inc")?>
|