Commit 200bd3ee authored by Franco Fichtner's avatar Franco Fichtner

plugins: protect against faulty updates

Switching the tty causes the terminal to exit, which means
the package upgrade jobs are not done, leaving files in the
system that shouldn't be there.

The $search parameter is unused.
parent 6c57fc7a
......@@ -30,9 +30,10 @@
* scan plugins for legacy system
* @return array
*/
function plugins_scan($search = '')
function plugins_scan()
{
$path = '/usr/local/etc/inc/plugins.inc.d/';
$clash = '/usr/local/etc/inc/';
$ext = '.inc';
$ret = array();
......@@ -47,7 +48,8 @@ function plugins_scan($search = '')
foreach ($plugins as $plugin) {
$name = preg_replace('/' . preg_quote($path, '/') . '/', '', $plugin);
$name = preg_replace('/' . preg_quote($ext, '/') . '/', '', $name);
if (!empty($search) && $search !== $name) {
/* if the old file still exists upgrade went wrong */
if (file_exists($clash . $name . $ext)) {
continue;
}
$ret[$name] = $plugin;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment