Elgg  Version 6.1
AdminControlPanel.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Menus;
4 
6 
14 
22  public static function register(\Elgg\Event $event) {
23  if (!elgg_is_admin_logged_in()) {
24  return;
25  }
26 
27  /* @var $return MenuItems */
28  $return = $event->getValue();
29 
30  $return[] = \ElggMenuItem::factory([
31  'name' => 'invalidate',
32  'text' => elgg_echo('admin:cache:invalidate'),
33  'icon' => 'sync-alt',
34  'href' => elgg_generate_action_url('admin/site/cache/invalidate'),
35  'link_class' => 'elgg-button elgg-button-action',
36  ]);
37 
38  if (!_elgg_services()->mutex->isLocked('upgrade')) {
39  $return[] = \ElggMenuItem::factory([
40  'name' => 'upgrade',
41  'text' => elgg_echo('upgrade'),
42  'icon' => 'cogs',
43  'href' => 'upgrade.php',
44  'link_class' => 'elgg-button elgg-button-action',
45  'confirm' => true,
46  ]);
47  } else {
48  $return[] = \ElggMenuItem::factory([
49  'name' => 'unlock_upgrade',
50  'text' => elgg_echo('upgrade:unlock'),
51  'icon' => 'unlock',
52  'href' => elgg_generate_action_url('admin/site/unlock_upgrade'),
53  'link_class' => 'elgg-button elgg-button-action',
54  'confirm' => elgg_echo('upgrade:unlock:confirm'),
55  ]);
56  }
57 
58  return $return;
59  }
60 }
elgg_generate_action_url(string $action, array $query=[], bool $add_csrf_tokens=true)
Generate an action URL.
elgg_is_admin_logged_in()
Returns whether or not the viewer is currently logged in and an admin user.
Definition: sessions.php:52
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
static factory(array $options)
Create an ElggMenuItem from an associative array.
Register menu items for the admin_control_panel menu.
_elgg_services()
Get the global service provider.
Definition: elgglib.php:353
Models an event passed to event handlers.
Definition: Event.php:11