37 public function call(
int $flags, \Closure $closure) {
39 $access = $this->session_manager->getIgnoreAccess();
41 $this->session_manager->setIgnoreAccess(
true);
43 $this->session_manager->setIgnoreAccess(
false);
46 $disabled = $this->session_manager->getDisabledEntityVisibility();
48 $this->session_manager->setDisabledEntityVisibility(
true);
50 $this->session_manager->setDisabledEntityVisibility(
false);
53 $deleted = $this->session_manager->getDeletedEntityVisibility();
55 $this->session_manager->setDeletedEntityVisibility(
true);
57 $this->session_manager->setDeletedEntityVisibility(
false);
60 $system_log_enabled =
null;
61 $system_log_service =
null;
64 $system_log_service = \Elgg\SystemLog\SystemLog::instance();
65 $system_log_enabled = $system_log_service->isLoggingEnabled();
68 $system_log_service->enableLogging();
70 $system_log_service->disableLogging();
72 }
catch (\DI\NotFoundException $e) {
77 $restore =
function () use (
$access, $disabled,
$deleted, $system_log_service, $system_log_enabled) {
78 $this->session_manager->setIgnoreAccess(
$access);
79 $this->session_manager->setDisabledEntityVisibility($disabled);
80 $this->session_manager->setDeletedEntityVisibility(
$deleted);
82 if (isset($system_log_service)) {
83 if ($system_log_enabled) {
84 $system_log_service->enableLogging();
86 $system_log_service->disableLogging();
92 $result = $this->dic->call($closure);
93 }
catch (\Throwable $e) {
call(int $flags, \Closure $closure)
Calls a callable autowiring the arguments using public DI services and applying logic based on flags.
__construct(protected SessionManagerService $session_manager, protected PublicContainer $dic)
Constructor.
const ELGG_IGNORE_ACCESS
elgg_call() flags
const ELGG_HIDE_DISABLED_ENTITIES
const ELGG_ENABLE_SYSTEM_LOG
const ELGG_SHOW_DISABLED_ENTITIES
const ELGG_DISABLE_SYSTEM_LOG
const ELGG_SHOW_DELETED_ENTITIES
const ELGG_ENFORCE_ACCESS
const ELGG_HIDE_DELETED_ENTITIES
if($item instanceof \ElggEntity) elseif($item instanceof \ElggRiverItem) elseif($item instanceof \ElggRelationship) elseif(is_callable([ $item, 'getType']))
elgg_is_active_plugin(string $plugin_id)
Returns if a plugin is active for a current site.