mirror of
https://github.com/slawkens/myaac.git
synced 2025-06-23 21:30:14 +02:00
feature: plugin require more options with comma
This commit is contained in:
parent
577f9b7373
commit
d0c479d11d
@ -1170,7 +1170,7 @@ function clearCache()
|
||||
if (file_exists($routeCacheFile)) {
|
||||
unlink($routeCacheFile);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -330,27 +330,59 @@ class Plugins {
|
||||
}
|
||||
|
||||
if(in_array($req, array('php-ext', 'php-extension'))) { // require php extension
|
||||
if(!extension_loaded($version)) {
|
||||
self::$error = "This plugin requires php extension: " . $version . " to be installed.";
|
||||
$tmpDisplayError = false;
|
||||
$explode = explode(',', $version);
|
||||
|
||||
foreach ($explode as $item) {
|
||||
if(!extension_loaded($item)) {
|
||||
$errors[] = "This plugin requires php extension: " . $item . " to be installed.";
|
||||
$tmpDisplayError = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($tmpDisplayError) {
|
||||
self::$error = implode('<br/>', $errors);
|
||||
$continue = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if($req == 'table') {
|
||||
if(!$db->hasTable($version)) {
|
||||
self::$error = "This plugin requires table: " . $version . " to exist in the database.";
|
||||
$tmpDisplayError = false;
|
||||
$explode = explode(',', $version);
|
||||
foreach ($explode as $item) {
|
||||
if(!$db->hasTable($item)) {
|
||||
$errors[] = "This plugin requires table: " . $item . " to exist in the database.";
|
||||
$tmpDisplayError = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($tmpDisplayError) {
|
||||
self::$error = implode('<br/>', $errors);
|
||||
$continue = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if($req == 'column') {
|
||||
$tmp = explode('.', $version);
|
||||
if(count($tmp) == 2) {
|
||||
if(!$db->hasColumn($tmp[0], $tmp[1])) {
|
||||
self::$error = "This plugin requires database column: " . $tmp[0] . "." . $tmp[1] . " to exist in database.";
|
||||
$continue = false;
|
||||
break;
|
||||
$tmpDisplayError = false;
|
||||
$explode = explode(',', $version);
|
||||
foreach ($explode as $item) {
|
||||
$tmp = explode('.', $item);
|
||||
|
||||
if(count($tmp) == 2) {
|
||||
if(!$db->hasColumn($tmp[0], $tmp[1])) {
|
||||
$errors[] = "This plugin requires database column: " . $tmp[0] . "." . $tmp[1] . " to exist in database.";
|
||||
$tmpDisplayError = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
self::$warnings[] = "Invalid plugin require column: " . $item;
|
||||
}
|
||||
}
|
||||
|
||||
if ($tmpDisplayError) {
|
||||
self::$error = implode('<br/>', $errors);
|
||||
$continue = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(strpos($req, 'ext-') !== false) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user