X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FAddon.php;h=4c20c96ad4705546ed0ab6c429c0e64351a74f9b;hb=505350c9fb9b16dde6c86d418947592ab3720282;hp=a663cff5041647cfd474f8a7b4bc200e8e9232e7;hpb=af6dbc654f82225cfc647fe2072662acae388e47;p=friendica.git diff --git a/src/Core/Addon.php b/src/Core/Addon.php index a663cff504..4c20c96ad4 100644 --- a/src/Core/Addon.php +++ b/src/Core/Addon.php @@ -6,7 +6,6 @@ namespace Friendica\Core; use Friendica\App; use Friendica\Database\DBA; -use Friendica\Database\DBM; require_once 'include/dba.php'; @@ -80,8 +79,8 @@ class Addon $addons = Config::get('system', 'addon'); if (strlen($addons)) { $r = DBA::select('addon', [], ['installed' => 1]); - if (DBM::is_result($r)) { - $installed = DBA::inArray($r); + if (DBA::isResult($r)) { + $installed = DBA::toArray($r); } else { $installed = []; } @@ -140,6 +139,8 @@ class Addon */ public static function registerHook($hook, $file, $function, $priority = 0) { + $file = str_replace(get_app()->get_basepath() . DIRECTORY_SEPARATOR, '', $file); + $condition = ['hook' => $hook, 'file' => $file, 'function' => $function]; $exists = DBA::exists('hook', $condition); if ($exists) { @@ -161,7 +162,13 @@ class Addon */ public static function unregisterHook($hook, $file, $function) { + $relative_file = str_replace(get_app()->get_basepath() . DIRECTORY_SEPARATOR, '', $file); + + // This here is only needed for fixing a problem that existed on the develop branch $condition = ['hook' => $hook, 'file' => $file, 'function' => $function]; + DBA::delete('hook', $condition); + + $condition = ['hook' => $hook, 'file' => $relative_file, 'function' => $function]; $r = DBA::delete('hook', $condition); return $r; } @@ -312,7 +319,12 @@ class Addon foreach ($ll as $l) { $l = trim($l, "\t\n\r */"); if ($l != "") { - list($type, $v) = array_map("trim", explode(":", $l, 2)); + $addon_info = array_map("trim", explode(":", $l, 2)); + if (count($addon_info) < 2) { + continue; + } + + list($type, $v) = $addon_info; $type = strtolower($type); if ($type == "author" || $type == "maintainer") { $r = preg_match("|([^<]+)<([^>]+)>|", $v, $m);