First draft of new CacheManager admin page. Backend is yet to be implemented.
authorDan
Mon, 07 Jul 2008 02:50:17 -0400
changeset 605 d2d4e40ecd29
parent 604 6a90893622f0
child 606 daf8c556ada7
child 607 935f3799b654
First draft of new CacheManager admin page. Backend is yet to be implemented.
images/icons/applets/cachemanager.png
includes/paths.php
index.php
language/english/admin.json
plugins/SpecialAdmin.php
plugins/admin/CacheManager.php
Binary file images/icons/applets/cachemanager.png has changed
--- a/includes/paths.php	Mon Jul 07 02:49:54 2008 -0400
+++ b/includes/paths.php	Mon Jul 07 02:50:17 2008 -0400
@@ -92,13 +92,14 @@
     $this->addAdminNode('adm_cat_general',    'adm_page_general_config', 'GeneralConfig', scriptPath . '/images/icons/applets/generalconfig.png');
     $this->addAdminNode('adm_cat_general',    'adm_page_file_uploads',   'UploadConfig', scriptPath . '/images/icons/applets/uploadconfig.png');
     $this->addAdminNode('adm_cat_general',    'adm_page_file_types',     'UploadAllowedMimeTypes', scriptPath . '/images/icons/applets/uploadallowedmimetypes.png');
-    $this->addAdminNode('adm_cat_general',    'adm_page_plugins',        'PluginManager', scriptPath . '/images/icons/applets/pluginmanager.png');
-    $this->addAdminNode('adm_cat_general',    'adm_page_db_backup',      'DBBackup', scriptPath . '/images/icons/applets/dbbackup.png');
-    $this->addAdminNode('adm_cat_general',    'adm_page_lang_manager',   'LangManager', scriptPath . '/images/icons/applets/langmanager.png');
     $this->addAdminNode('adm_cat_content',    'adm_page_manager',        'PageManager', scriptPath . '/images/icons/applets/pagemanager.png');
     $this->addAdminNode('adm_cat_content',    'adm_page_editor',         'PageEditor', scriptPath . '/images/icons/applets/pageeditor.png');
     $this->addAdminNode('adm_cat_content',    'adm_page_pg_groups',      'PageGroups', scriptPath . '/images/icons/applets/pagegroups.png');
     $this->addAdminNode('adm_cat_appearance', 'adm_page_themes',         'ThemeManager', scriptPath . '/images/icons/applets/thememanager.png');
+    $this->addAdminNode('adm_cat_appearance', 'adm_page_plugins',        'PluginManager', scriptPath . '/images/icons/applets/pluginmanager.png');
+    $this->addAdminNode('adm_cat_appearance', 'adm_page_db_backup',      'DBBackup', scriptPath . '/images/icons/applets/dbbackup.png');
+    $this->addAdminNode('adm_cat_appearance', 'adm_page_lang_manager',   'LangManager', scriptPath . '/images/icons/applets/langmanager.png');
+    $this->addAdminNode('adm_cat_appearance', 'adm_page_cache_manager',  'CacheManager', scriptPath . '/images/icons/applets/cachemanager.png');
     $this->addAdminNode('adm_cat_users',      'adm_page_users',          'UserManager', scriptPath . '/images/icons/applets/usermanager.png');
     $this->addAdminNode('adm_cat_users',      'adm_page_user_groups',    'GroupManager', scriptPath . '/images/icons/applets/groupmanager.png');
     $this->addAdminNode('adm_cat_users',      'adm_page_coppa',          'COPPA', scriptPath . '/images/icons/applets/coppa.png');
--- a/index.php	Mon Jul 07 02:49:54 2008 -0400
+++ b/index.php	Mon Jul 07 02:50:17 2008 -0400
@@ -19,7 +19,7 @@
   define('ENANO_INTERFACE_INDEX', '');
   
   // For the mighty and brave.
-  define('ENANO_DEBUG', '');
+  // define('ENANO_DEBUG', '');
  
   // Set up gzip encoding before any output is sent
   
--- a/language/english/admin.json	Mon Jul 07 02:49:54 2008 -0400
+++ b/language/english/admin.json	Mon Jul 07 02:50:17 2008 -0400
@@ -14,7 +14,7 @@
   categories: [
     'meta', 'adm', 'acl', 'adminusers',
     'acphome', 'acpgc', 'acpup', 'acpft', 'acppl', 'acppm', 'acped', 'acpdb', 'acplm', 'acppg', 'acpum', 'acpug', 'acpcp', 'acpmm', 'acpsl',
-    'acpbc', 'acplo', 'acptm', 'acpur', 'sbedit',
+    'acpcm', 'acpbc', 'acplo', 'acptm', 'acpur', 'sbedit',
   ],
   strings: {
     meta: {
@@ -24,12 +24,13 @@
       acpgc: 'ACP: General configuration',
       acpup: 'ACP: File uploads',
       acpft: 'ACP: Allowed file types',
+      acppm: 'ACP: Manage pages',
+      acped: 'ACP: Edit page content',
+      acptm: 'ACP: Theme manager',
       acppl: 'ACP: Manage plugins',
       acpdb: 'ACP: Database backup',
       acplm: 'ACP: Language manager',
-      acppm: 'ACP: Manage pages',
-      acped: 'ACP: Edit page content',
-      acptm: 'ACP: Theme manager',
+      acpcm: 'ACP: Cache settings',
       acppg: 'ACP: Page groups',
       acpum: 'ACP: User management',
       acpur: 'ACP: User rank management',
@@ -46,7 +47,7 @@
       
       cat_general: 'General',
       cat_content: 'Content',
-      cat_appearance: 'Appearance',
+      cat_appearance: 'System and maintenance',
       cat_users: 'Users',
       cat_security: 'Security',
       cat_plugins: 'Plugin configuration',
@@ -54,15 +55,16 @@
       page_general_config: 'General configuration',
       page_file_uploads: 'File uploads',
       page_file_types: 'Allowed file types',
-      page_plugins: 'Manage plugins',
-      page_db_backup: 'Backup database',
-      page_lang_manager: 'Language manager',
       
       page_manager: 'Manage pages',
       page_editor: 'Edit page content',
       page_pg_groups: 'Manage page groups',
       
       page_themes: 'Manage themes',
+      page_plugins: 'Manage plugins',
+      page_db_backup: 'Backup database',
+      page_lang_manager: 'Language manager',
+      page_cache_manager: 'Cache settings',
       
       page_users: 'Manage users',
       page_user_groups: 'Edit user groups',
@@ -539,6 +541,17 @@
       msg_save_success: 'Your changes to this theme have been saved.',
       msg_uninstall_success: 'The selected theme has been uninstalled.',
     },
+    acpcm: {
+      heading_main: 'Performance and caching settings',
+      intro: 'From this page you can control what information on your site is stored in cache files. Caching speeds up Enano performance by allowing data to be retrieved from the disk instead of querying the database. Sometimes the cache isn\'t updated immediately when the database is. From this page you can control what is cached, and you can clear specific caches to force them to refresh.',
+      table_header: 'Cache settings',
+      lbl_enable_cache: 'Enable the cache (recommended)',
+      hint_enable_cache: 'To use the cache, the folder "cache" in the Enano root directory needs to be writable by the server. You can usually accomplish this by using your FTP client\'s CHMOD feature to set the permissions on this folder to 777. Learn more <a href="http://en.wikipedia.org/wiki/Chmod" onclick="window.open(this.href); return false;">about UNIX permissions</a>.',
+      btn_clear_all: 'Clear all caches',
+      hint_clear_all: 'To force all caches (except image thumbnails) on the site to empty, click this button. Certain caches, such as language data, must be regenerated in order to fully refresh the cache. It is recommended that you use "%this.acpcm_btn_refresh_all%" below to clear all caches and then regenerate them.',
+      btn_refresh_all: 'Refresh all caches',
+      hint_refresh_all: 'This will clear all caches (except image thumbnails) on the site to empty and then regenerate, except templates, which are cached on demand.',
+    },
     acpdb: {
       err_not_supported_title: 'Not supported',
       err_not_supported_desc: 'This function is only supported under the MySQL database driver.',
--- a/plugins/SpecialAdmin.php	Mon Jul 07 02:49:54 2008 -0400
+++ b/plugins/SpecialAdmin.php	Mon Jul 07 02:50:17 2008 -0400
@@ -65,7 +65,7 @@
     require(ENANO_ROOT . '/plugins/admin/LangManager.php');
     require(ENANO_ROOT . '/plugins/admin/ThemeManager.php');
     require(ENANO_ROOT . '/plugins/admin/PluginManager.php');
-    // require(ENANO_ROOT . '/plugins/admin/CacheManager.php');
+    require(ENANO_ROOT . '/plugins/admin/CacheManager.php');
     
     // Set the theme
     $session->theme = 'admin';
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/admin/CacheManager.php	Mon Jul 07 02:50:17 2008 -0400
@@ -0,0 +1,90 @@
+<?php
+
+/*
+ * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
+ * Version 1.1.4 (Caoineag alpha 4)
+ * Copyright (C) 2006-2008 Dan Fuhry
+ *
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ */
+
+// Cache manager - regenerate and clear various cached values
+
+function page_Admin_CacheManager()
+{
+  global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
+  if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
+  {
+    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
+    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
+    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
+    return;
+  }
+  
+  echo '<h3><img alt=" " src="' . scriptPath . '/images/icons/applets/cachemanager.png" />&nbsp;&nbsp;&nbsp;' . $lang->get('acpcm_heading_main') . '</h3>';
+  echo '<p>' . $lang->get('acpcm_intro') . '</p>';
+  
+  acp_start_form();
+  ?>
+  <div class="tblholder">
+    <table border="0" cellspacing="1" cellpadding="4">
+      <!-- HEADER -->
+      <tr>
+        <th colspan="2">
+          <?php echo $lang->get('acpcm_table_header'); ?>
+        </th>
+      </tr>
+      
+      <!-- ENABLE CACHE -->
+      <tr>
+        <td class="row1" colspan="2">
+          <label>
+            <input type="checkbox" name="cache_thumbs"<?php if ( getConfig('cache_thumbs') == '1' ) echo ' checked="checked"'; ?> />
+            <?php echo $lang->get('acpcm_lbl_enable_cache'); ?>
+          </label>
+          <br />
+          <small>
+            <?php echo $lang->get('acpcm_hint_enable_cache'); ?>
+          </small>
+        </td>
+      </tr>
+      
+      <!-- CLEAR ALL -->
+      <tr>
+        <td class="row2">
+          <input type="submit" name="clear_all" value="<?php echo $lang->get('acpcm_btn_clear_all'); ?>" />
+        </td>
+        <td class="row2">
+          <?php echo $lang->get('acpcm_hint_clear_all'); ?>
+        </td>
+      </tr>
+      
+      <!-- REFRESH ALL -->
+      <tr>
+        <td class="row1">
+          <input type="submit" name="refresh_all" value="<?php echo $lang->get('acpcm_btn_refresh_all'); ?>" />
+        </td>
+        <td class="row1">
+          <?php echo $lang->get('acpcm_hint_refresh_all'); ?>
+        </td>
+      </tr>
+      
+      <!-- SAVE CHANGES -->
+      <tr>
+        <th colspan="2" class="subhead">
+          <input type="submit" name="save" value="<?php echo $lang->get('etc_save_changes'); ?>" style="font-weight: bold;" />
+          <input type="submit" name="cancel" value="<?php echo $lang->get('etc_cancel'); ?>" />
+        </th>
+      </tr>
+    </table>
+  </div>
+  <?php
+  echo '</form>';
+}
+
+?>