use Friendica\App;
use Friendica\Database\DBA;
-use Friendica\Database\DBM;
require_once 'include/dba.php';
$addons = Config::get('system', 'addon');
if (strlen($addons)) {
$r = DBA::select('addon', [], ['installed' => 1]);
- if (DBM::is_result($r)) {
+ if (DBA::isResult($r)) {
$installed = DBA::toArray($r);
} else {
$installed = [];
*/
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) {
*/
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;
}
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);