aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/admin/site/flush_cache.php10
-rw-r--r--engine/lib/admin.php5
-rw-r--r--languages/en.php6
-rw-r--r--views/default/widgets/control_panel/content.php24
4 files changed, 43 insertions, 2 deletions
diff --git a/actions/admin/site/flush_cache.php b/actions/admin/site/flush_cache.php
new file mode 100644
index 000000000..b81f5fc83
--- /dev/null
+++ b/actions/admin/site/flush_cache.php
@@ -0,0 +1,10 @@
+<?php
+/**
+ * Flush all the caches
+ */
+
+elgg_invalidate_simplecache();
+elgg_filepath_cache_reset();
+
+system_message(elgg_echo('admin:cache:flushed'));
+forward(REFERER); \ No newline at end of file
diff --git a/engine/lib/admin.php b/engine/lib/admin.php
index 3baf2ff61..a191d740b 100644
--- a/engine/lib/admin.php
+++ b/engine/lib/admin.php
@@ -225,6 +225,7 @@ function admin_init() {
elgg_register_action('admin/site/update_basic', '', 'admin');
elgg_register_action('admin/site/update_advanced', '', 'admin');
+ elgg_register_action('admin/site/flush_cache', '', 'admin');
elgg_register_action('admin/menu/save', '', 'admin');
@@ -301,7 +302,7 @@ function admin_init() {
}
// widgets
- $widgets = array('online_users', 'new_users', 'content_stats', 'admin_welcome');
+ $widgets = array('online_users', 'new_users', 'content_stats', 'admin_welcome', 'control_panel');
foreach ($widgets as $widget) {
elgg_register_widget_type(
$widget,
@@ -616,7 +617,7 @@ function elgg_add_admin_widgets($event, $type, $user) {
// In the form column => array of handlers in order, top to bottom
$adminWidgets = array(
- 1 => array('admin_welcome'),
+ 1 => array('control_panel', 'admin_welcome'),
2 => array('online_users', 'new_users', 'content_stats'),
);
diff --git a/languages/en.php b/languages/en.php
index 036ca8883..a2e6e152e 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -610,6 +610,12 @@ $english = array(
// argh, this is ugly
'admin:widget:admin_welcome:outro' => '<br />Be sure to check out the resources available through the footer links and thank you for using Elgg!',
+ 'admin:widget:control_panel' => 'Control panel',
+ 'admin:widget:control_panel:help' => "Provides easy access to common controls",
+
+ 'admin:cache:flush' => 'Flush the caches',
+ 'admin:cache:flushed' => "The site's caches have been flushed",
+
'admin:footer:faq' => 'Administration FAQ',
'admin:footer:manual' => 'Administration Manual',
'admin:footer:community_forums' => 'Elgg Community Forums',
diff --git a/views/default/widgets/control_panel/content.php b/views/default/widgets/control_panel/content.php
new file mode 100644
index 000000000..d2db54bc6
--- /dev/null
+++ b/views/default/widgets/control_panel/content.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Admin control panel widget
+ */
+
+elgg_register_menu_item('admin_control_panel', array(
+ 'name' => 'flush',
+ 'text' => elgg_echo('admin:cache:flush'),
+ 'href' => 'action/admin/site/flush_cache',
+ 'is_action' => true,
+ 'link_class' => 'elgg-button elgg-button-action',
+));
+
+elgg_register_menu_item('admin_control_panel', array(
+ 'name' => 'upgrade',
+ 'text' => elgg_echo('upgrade'),
+ 'href' => 'upgrade.php',
+ 'link_class' => 'elgg-button elgg-button-action',
+));
+
+echo elgg_view_menu('admin_control_panel', array(
+ 'class' => 'elgg-menu-hz',
+ 'item_class' => 'mrm',
+));