<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
} else {
// remove orphan hooks
$condition = ['hook' => $name, 'file' => $hook[0], 'function' => $hook[1]];
- self::delete($condition, ['cascade' => false]);
+ self::delete($condition);
}
}
/**
* Deletes one or more hook records
*
+ * We have to clear the cached routerDispatchData because addons can provide routes
+ *
* @param array $condition
- * @param array $options
* @return bool
* @throws \Exception
*/
- public static function delete(array $condition, array $options = [])
+ public static function delete(array $condition)
{
- $result = DBA::delete('hook', $condition, $options);
+ $result = DBA::delete('hook', $condition);
+
+ if ($result) {
+ DI::cache()->delete('routerDispatchData');
+ }
return $result;
}
/**
* Inserts a hook record
*
+ * We have to clear the cached routerDispatchData because addons can provide routes
+ *
* @param array $condition
* @return bool
* @throws \Exception
{
$result = DBA::insert('hook', $condition);
+ if ($result) {
+ DI::cache()->delete('routerDispatchData');
+ }
+
return $result;
}
}