firmware: prepare for our new "-devel" plugin suffix

This commit is contained in:
Franco Fichtner 2017-02-07 09:58:57 +01:00
parent 012d0b9053
commit 27f3a1be2a

View File

@ -1,7 +1,7 @@
<?php
/**
* Copyright (c) 2015-2016 Franco Fichtner <franco@opnsense.org>
* Copyright (c) 2015-2017 Franco Fichtner <franco@opnsense.org>
* Copyright (c) 2015-2016 Deciso B.V.
* All rights reserved.
*
@ -519,8 +519,24 @@ class FirmwareController extends ApiControllerBase
/* figure out local and remote plugins */
$plugin = explode('-', $translated['name']);
if (count($plugin)) {
if ($plugin[0] == 'os' || ($type == 'local' && $plugin[0] == 'ospriv') ||
($devel && $type == 'remote' && $plugin[0] == 'ospriv')) {
$visible = 0;
/* "os" is our common prefix, "devel" the development suffix */
if ($plugin[0] == 'os') {
if ($type = 'local') {
$visible = 1;
} elseif ($type = 'remote') {
if (count($plugin) < 3 || end($plugin) != 'devel') {
$visible = 1;
} elseif ($devel) {
$visible = 1;
}
}
}
/* "ospriv" is our historic development prefix */
if ($plugin[0] == 'ospriv' && ($type == 'local' || ($devel && $type == 'remote'))) {
$visible = 1;
}
if ($visible) {
$plugins[$translated['name']] = $translated;
}
}