*/
namespace Friendica\Core;
-use Friendica\App;
use Friendica\BaseObject;
use Friendica\Database\DBA;
* @brief uninstalls an addon.
*
* @param string $addon name of the addon
- * @return boolean
+ * @return void
+ * @throws \Exception
*/
public static function uninstall($addon)
{
- logger("Addons: uninstalling " . $addon);
+ Logger::notice("Addon {addon}: {action}", ['action' => 'uninstall', 'addon' => $addon]);
DBA::delete('addon', ['name' => $addon]);
@include_once('addon/' . $addon . '/' . $addon . '.php');
$func();
}
- unset(self::$addons[$idx]);
+ unset(self::$addons[array_search($addon, self::$addons)]);
}
/**
*
* @param string $addon name of the addon
* @return bool
+ * @throws \Exception
*/
public static function install($addon)
{
if (!file_exists('addon/' . $addon . '/' . $addon . '.php')) {
return false;
}
- logger("Addons: installing " . $addon);
+ Logger::notice("Addon {addon}: {action}", ['action' => 'install', 'addon' => $addon]);
$t = @filemtime('addon/' . $addon . '/' . $addon . '.php');
@include_once('addon/' . $addon . '/' . $addon . '.php');
if (function_exists($addon . '_install')) {
}
return true;
} else {
- logger("Addons: FAILED installing " . $addon);
+ Logger::error("Addon {addon}: {action} failed", ['action' => 'uninstall', 'addon' => $addon]);
return false;
}
}
$t = @filemtime($fname);
foreach ($installed as $i) {
if (($i['name'] == $addon) && ($i['timestamp'] != $t)) {
- logger('Reloading addon: ' . $i['name']);
+
+ Logger::notice("Addon {addon}: {action}", ['action' => 'reload', 'addon' => $i['name']]);
@include_once($fname);
if (function_exists($addon . '_uninstall')) {
* *\endcode
* @param string $addon the name of the addon
* @return array with the addon information
+ * @throws \Exception
*/
public static function getInfo($addon)
{
return in_array($addon, self::$addons);
}
+ /**
+ * Returns a list of the enabled addon names
+ *
+ * @return array
+ */
public static function getEnabledList()
{
return self::$addons;
* Saves the current enabled addon list in the system.addon config key
*
* @return boolean
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function saveEnabledList()
{
* Returns the list of non-hidden enabled addon names
*
* @return array
+ * @throws \Exception
*/
public static function getVisibleList()
{
/**
* Shim of Hook::register left for backward compatibility purpose.
*
- * @see Hook::register
+ * @see Hook::register
* @deprecated since version 2018.12
* @param string $hook the name of the hook
* @param string $file the name of the file that hooks into
* @param string $function the name of the function that the hook will call
* @param int $priority A priority (defaults to 0)
* @return mixed|bool
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function registerHook($hook, $file, $function, $priority = 0)
{
/**
* Shim of Hook::unregister left for backward compatibility purpose.
*
- * @see Hook::unregister
+ * @see Hook::unregister
* @deprecated since version 2018.12
* @param string $hook the name of the hook
* @param string $file the name of the file that hooks into
* @param string $function the name of the function that the hook called
* @return boolean
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function unregisterHook($hook, $file, $function)
{
/**
* Shim of Hook::callAll left for backward-compatibility purpose.
*
- * @see Hook::callAll
+ * @see Hook::callAll
* @deprecated since version 2018.12
- * @param string $name of the hook to call
+ * @param string $name of the hook to call
* @param string|array &$data to transmit to the callback handler
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function callHooks($name, &$data = null)
{