29 $this->session_manager = $session_manager;
49 $ia = $this->session_manager->getIgnoreAccess();
51 $this->session_manager->setIgnoreAccess(
true);
53 $this->session_manager->setIgnoreAccess(
false);
56 $ha = $this->session_manager->getDisabledEntityVisibility();
58 $this->session_manager->setDisabledEntityVisibility(
true);
60 $this->session_manager->setDisabledEntityVisibility(
false);
63 $system_log_enabled = null;
64 $system_log_service = null;
67 $system_log_service = \Elgg\SystemLog\SystemLog::instance();
68 $system_log_enabled = $system_log_service->isLoggingEnabled();
70 if ($flags & ELGG_ENABLE_SYSTEM_LOG) {
71 $system_log_service->enableLogging();
72 }
elseif ($flags & ELGG_DISABLE_SYSTEM_LOG) {
73 $system_log_service->disableLogging();
75 }
catch (\DI\NotFoundException $e) {
80 $restore =
function () use ($ia, $ha, $system_log_service, $system_log_enabled) {
81 $this->session_manager->setIgnoreAccess($ia);
82 $this->session_manager->setDisabledEntityVisibility($ha);
84 if (isset($system_log_service)) {
85 if ($system_log_enabled) {
86 $system_log_service->enableLogging();
88 $system_log_service->disableLogging();
94 $result = $this->dic->call($closure);
95 }
catch (\Throwable $e) {
const ELGG_DISABLE_SYSTEM_LOG
const ELGG_ENFORCE_ACCESS
call(int $flags,\Closure $closure)
Calls a callable autowiring the arguments using public DI services and applying logic based on flags...
__construct(SessionManagerService $session_manager, PublicContainer $dic)
Constructor.
if($item instanceof\ElggEntity) elseif($item instanceof\ElggRiverItem) elseif($item instanceof\ElggRelationship) elseif(is_callable([$item, 'getType']))
const ELGG_HIDE_DISABLED_ENTITIES
const ELGG_IGNORE_ACCESS
elgg_call() flags
const ELGG_SHOW_DISABLED_ENTITIES
const ELGG_ENABLE_SYSTEM_LOG
elgg_is_active_plugin(string $plugin_id)
Returns if a plugin is active for a current site.