Commit a1ded289 authored by Franco Fichtner's avatar Franco Fichtner

plugins: allow to search for a plugin withing plugins_scan()

PR: https://github.com/opnsense/core/pull/1388
parent 5b698d60
<?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;
}
......
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