Revision c29a1fe9
Added by Steve Beaver about 7 years ago
src/usr/local/www/pkg_mgr_install.php | ||
---|---|---|
62 | 62 |
$pidfile = $g['varrun_path'] . '/' . $g['product_name'] . '-upgrade.pid'; |
63 | 63 |
$repos = pkg_list_repos(); |
64 | 64 |
|
65 |
$pkgname = ''; |
|
66 |
if (!empty($_REQUEST['pkg'])) { |
|
67 |
$pkgname = $_REQUEST['pkg']; |
|
68 |
} |
|
69 |
|
|
65 | 70 |
if ($_REQUEST['ajax']) { |
66 | 71 |
$response = ""; |
67 | 72 |
$code = 0; |
73 |
$postlog = ""; |
|
74 |
|
|
75 |
if(isset($_REQUEST['logfilename'])) { |
|
76 |
if ($_REQUEST['logfilename'] == "UPGR") { |
|
77 |
$postlog = $g['cf_conf_path'] . '/upgrade_log'; |
|
78 |
} |
|
79 |
|
|
80 |
if ($_REQUEST['logfilename'] == "PKG") { |
|
81 |
$postlog = $g['cf_conf_path'] . '/pkg_log_' . $pkgname; |
|
82 |
} |
|
83 |
} |
|
68 | 84 |
|
69 | 85 |
// If this is an ajax call to get the installed and newest versions, call that function, |
70 | 86 |
// JSON encode the result, print it and exit |
... | ... | |
87 | 103 |
$running = "stopped"; |
88 | 104 |
// The log files may not be complete when the process terminates so we need wait until we see the |
89 | 105 |
// exit status (__RC=x) |
90 |
waitfor_string_in_file($_REQUEST['logfilename'] . '.txt', "__RC=", 10);
|
|
106 |
waitfor_string_in_file($postlog . '.txt', "__RC=", 10);
|
|
91 | 107 |
filter_configure(); |
92 | 108 |
send_event("service restart packages"); |
93 | 109 |
} |
... | ... | |
95 | 111 |
$pidarray = array('pid' => $running); |
96 | 112 |
|
97 | 113 |
// Process log file ----------------------------------------------------------------------------------------------- |
98 |
$logfile = @fopen($_REQUEST['logfilename'] . '.txt', "r");
|
|
114 |
$logfile = @fopen($postlog . '.txt', "r");
|
|
99 | 115 |
|
100 | 116 |
if ($logfile != FALSE) { |
101 | 117 |
$resparray = array(); |
... | ... | |
143 | 159 |
$progress = ""; |
144 | 160 |
$progarray = array(); |
145 | 161 |
|
146 |
$JSONfile = @fopen($_REQUEST['logfilename'] . '.json', "r");
|
|
162 |
$JSONfile = @fopen($postlog . '.json', "r");
|
|
147 | 163 |
|
148 | 164 |
if ($JSONfile != FALSE) { |
149 | 165 |
while (($logline = fgets($JSONfile)) !== false) { |
... | ... | |
247 | 263 |
return; |
248 | 264 |
} |
249 | 265 |
|
250 |
$pkgname = ''; |
|
251 | 266 |
if (!empty($_REQUEST['pkg'])) { |
252 |
$pkgname = $_REQUEST['pkg']; |
|
253 |
|
|
254 | 267 |
if (!pkg_valid_name($pkgname)) { |
255 | 268 |
header("Location: pkg_mgr_installed.php"); |
256 | 269 |
return; |
... | ... | |
415 | 428 |
</div> |
416 | 429 |
<?php |
417 | 430 |
|
431 |
$postlog = ""; |
|
432 |
|
|
418 | 433 |
if ($_POST) { |
419 | 434 |
if ($firmwareupdate) { |
420 | 435 |
$logfilename = $g['cf_conf_path'] . '/upgrade_log'; |
436 |
$postlog = "UPGR"; |
|
421 | 437 |
} else { |
422 | 438 |
$logfilename = $g['cf_conf_path'] . '/pkg_log_' . $pkgname; |
439 |
$postlog = "PKG"; |
|
423 | 440 |
} |
424 | 441 |
} |
425 | 442 |
|
... | ... | |
680 | 697 |
url: "pkg_mgr_install.php", |
681 | 698 |
type: "post", |
682 | 699 |
data: { ajax: "ajax", |
683 |
logfilename: "<?=$logfilename?>", |
|
684 |
next_log_line: "0" |
|
700 |
logfilename: "<?=$postlog?>", |
|
701 |
next_log_line: "0", |
|
702 |
pkg: "<?=$pkgname?>" |
|
685 | 703 |
} |
686 | 704 |
}); |
687 | 705 |
|
Also available in: Unified diff
Fixed #8485 by POSTing fixed string and looking up the required file name