mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
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.
This commit is contained in:
parent
6c57fc7a9e
commit
200bd3eefa
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user