mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
plugins: allow to search for a plugin withing plugins_scan()
PR: https://github.com/opnsense/core/pull/1388
This commit is contained in:
parent
a0689d4f41
commit
42d13b904c
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 Franco Fichtner <franco@opnsense.org>
|
||||
* Copyright (C) 2016-2017 Franco Fichtner <franco@opnsense.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -30,7 +30,7 @@
|
||||
* scan plugins for legacy system
|
||||
* @return array
|
||||
*/
|
||||
function plugins_scan()
|
||||
function plugins_scan($search = '')
|
||||
{
|
||||
$path = '/usr/local/etc/inc/plugins.inc.d/';
|
||||
$ext = '.inc';
|
||||
@ -47,6 +47,9 @@ function plugins_scan()
|
||||
foreach ($plugins as $plugin) {
|
||||
$name = preg_replace('/' . preg_quote($path, '/') . '/', '', $plugin);
|
||||
$name = preg_replace('/' . preg_quote($ext, '/') . '/', '', $name);
|
||||
if (!empty($search) && $search !== $name) {
|
||||
continue;
|
||||
}
|
||||
$ret[$name] = $plugin;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user