b2evolution PHP Cross Reference Blogging Systems

Source: /inc/tools/views/_misc_tools.view.php - 158 lines - 7770 bytes - Text - Print

Description: This file display the additional tools

   1  <?php
   2  /**
   3   * This file display the additional tools
   4   *
   5   * This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}.
   6   * See also {@link http://sourceforge.net/projects/evocms/}.
   7   *
   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}.
   9   * Parts of this file are copyright (c)2005 by Daniel HAHLER - {@link http://thequod.de/contact}.
  10   *
  11   * @license http://b2evolution.net/about/license.html GNU General Public License (GPL)
  12   *
  13   * @package admin
  14   *
  15   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  16   * @author blueyed: Daniel HAHLER
  17   * @author efy-asimo: Attila Simo.
  18   *
  19   * @version $Id: _misc_tools.view.php 6136 2014-03-08 07:59:48Z manuel $
  20   */
  21  
  22  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  23  
  24  global $Plugins, $template_action;
  25  
  26  $block_item_Widget = new Widget( 'block_item' );
  27  
  28  if( !empty( $template_action ) )
  29  { // Execute action inside template to display a process in real rime
  30      $block_item_Widget->title = T_('Log');
  31      $block_item_Widget->disp_template_replaced( 'block_start' );
  32  
  33      // Turn off the output buffering to do the correct work of the function flush()
  34      @ini_set( 'output_buffering', 'off' );
  35      evo_flush();
  36  
  37      switch( $template_action )
  38      {
  39          case 'optimize_tables':
  40              // Optimize MyISAM & InnoDB tables
  41              dbm_optimize_tables();
  42              break;
  43  
  44          case 'check_tables':
  45              // Check ALL database tables
  46              dbm_check_tables();
  47              break;
  48  
  49          case 'analyze_tables':
  50              // Analize ALL database tables
  51              dbm_analyze_tables();
  52              break;
  53  
  54          case 'delete_orphan_files':
  55              // delete orphan File objects with no matching file on disk
  56              dbm_delete_orphan_files();
  57              break;
  58  
  59          case 'delete_orphan_file_roots':
  60              // delete orphan file roots with no matching Blog or User entry in the database
  61              dbm_delete_orphan_file_roots();
  62              break;
  63  
  64          case 'recreate_autogenerated_excerpts':
  65              // Re-create all autogenerated excerpts
  66              dbm_recreate_autogenerated_excerpts();
  67              break;
  68      }
  69      $block_item_Widget->disp_template_raw( 'block_end' );
  70  }
  71  
  72  
  73  if( $current_User->check_perm( 'users', 'edit' ) )
  74  { // Setting to lock system
  75      global $Settings;
  76  
  77      $Form = new Form( NULL, 'settings_checkchanges' );
  78      $Form->begin_form( 'fform' );
  79  
  80      $Form->add_crumb( 'globalsettings' );
  81      $Form->hidden( 'ctrl', 'gensettings' );
  82      $Form->hidden( 'action', 'update_tools' );
  83  
  84      $Form->begin_fieldset( T_('Locking down b2evolution for maintenance, upgrade or server switching...').get_manual_link('system-lock') );
  85  
  86          $Form->checkbox_input( 'system_lock', $Settings->get('system_lock'), T_('Lock system'), array(
  87                  'note' => T_('check this to prevent login (except for admins) and sending comments/messages. This prevents the DB from receiving updates (other than logging)').'<br />'.
  88                            T_('Note: for a more complete lock down, rename the file /conf/_maintenance.html to /conf/maintenance.html (complete lock) or /conf/imaintenance.html (gives access to /install)') ) );
  89  
  90      if( $current_User->check_perm( 'options', 'edit' ) )
  91      {
  92          $Form->buttons( array( array( 'submit', 'submit', T_('Save changes!'), 'SaveButton' ) ) );
  93      }
  94  
  95      $Form->end_fieldset();
  96  
  97      $Form->end_form();
  98  }
  99  
 100  // TODO: dh> this should really be a separate permission.. ("tools", "exec") or similar!
 101  if( $current_User->check_perm('options', 'edit') )
 102  { // default admin actions:
 103      global $Settings;
 104  
 105      $block_item_Widget->title = T_('Cache management');
 106      // dh> TODO: add link to delete all caches at once?
 107      $block_item_Widget->disp_template_replaced( 'block_start' );
 108      echo '<ul>';
 109      echo '<li><a href="'.regenerate_url('action', 'action=del_itemprecache&amp;'.url_crumb('tools')).'">'.T_('Clear pre-renderered item cache (DB)').'</a></li>';
 110      echo '<li><a href="'.regenerate_url('action', 'action=del_commentprecache&amp;'.url_crumb('tools')).'">'.T_('Clear pre-renderered comment cache (DB)').'</a></li>';
 111      echo '<li><a href="'.regenerate_url('action', 'action=del_filecache&amp;'.url_crumb('tools')).'">'.T_('Clear thumbnail caches (?evocache directories)').'</a></li>';
 112      echo '<li><a href="'.regenerate_url('action', 'action=del_pagecache&amp;'.url_crumb('tools')).'">'.T_('Clear full page caches (/cache/* directories)').'</a></li>';
 113      echo '<li><a href="'.regenerate_url('action', 'action=repair_cache&amp;'.url_crumb('tools')).'">'.T_('Repair /cache/* directory structure').'</a></li>';
 114      echo '</ul>';
 115      $block_item_Widget->disp_template_raw( 'block_end' );
 116  
 117      $block_item_Widget->title = T_('Database management');
 118      $block_item_Widget->disp_template_replaced( 'block_start' );
 119      echo '<ul>';
 120      echo '<li><a href="'.regenerate_url('action', 'action=check_tables&amp;'.url_crumb('tools')).'">'.T_('CHECK database tables').'</a></li>';
 121      echo '<li><a href="'.regenerate_url('action', 'action=optimize_tables&amp;'.url_crumb('tools')).'">'.T_('OPTIMIZE database tables').'</a></li>';
 122      echo '<li><a href="'.regenerate_url('action', 'action=analyze_tables&amp;'.url_crumb('tools')).'">'.T_('ANALYZE database tables').'</a></li>';
 123      // echo '<li><a href="'.regenerate_url('action', 'action=backup_db').'">'.T_('Backup database').'</a></li>';
 124      echo '</ul>';
 125      $block_item_Widget->disp_template_raw( 'block_end' );
 126  
 127      $block_item_Widget->title = T_('Database Maintenance Tools');
 128      $block_item_Widget->disp_template_replaced( 'block_start' );
 129      echo '<ul>';
 130      echo '<li><a href="'.regenerate_url('action', 'action=del_obsolete_tags&amp;'.url_crumb('tools')).'">'.T_('Remove obsolete (unused) tag entries').'</a></li>';
 131      echo '<li><a href="'.regenerate_url('action', 'action=find_broken_posts&amp;'.url_crumb('tools')).'">'.T_('Find all broken posts that have no matching category').'</a></li>';
 132      echo '<li><a href="'.regenerate_url('action', 'action=find_broken_slugs&amp;'.url_crumb('tools')).'">'.T_('Find all broken slugs that have no matching target post').'</a></li>';
 133      echo '<li><a href="'.regenerate_url('action', 'action=delete_orphan_comment_uploads&amp;'.url_crumb('tools')).'">'.T_('Find and delete orphan comment uploads (disk &amp; DB)').'</a></li>';
 134      echo '<li><a href="'.regenerate_url('action', 'action=delete_orphan_files&amp;'.url_crumb('tools')).'">'.T_('Find and delete orphan File objects (with no matching file on disk)').'</a></li>';
 135      echo '<li><a href="'.regenerate_url('action', 'action=delete_orphan_file_roots&amp;'.url_crumb('tools')).'">'.T_('Remove orphan file roots ( with no matching Blog or User entry in the database ) recursively with all of the content').'</a></li>';
 136      echo '<li><a href="'.regenerate_url('action', 'action=prune_hits_sessions&amp;'.url_crumb('tools')).'">'.T_('Prune old hits & sessions (includes OPTIMIZE)').'</a></li>';
 137      echo '<li><a href="'.regenerate_url('action', 'action=recreate_autogenerated_excerpts&amp;'.url_crumb('tools')).'">'.T_('Recreate autogenerated excerpts').'</a></li>';
 138      echo '</ul>';
 139      $block_item_Widget->disp_template_raw( 'block_end' );
 140  
 141      $block_item_Widget->title = T_('Recreate item slugs');
 142      $block_item_Widget->disp_template_replaced( 'block_start' );
 143      echo '&raquo; <a href="'.regenerate_url('action', 'action=recreate_itemslugs&amp;'.url_crumb('tools')).'">'.T_('Recreate all item slugs (change title-[0-9] canonical slugs to a slug generated from current title). Old slugs will still work, but redirect to the new one.').'</a>';
 144      $block_item_Widget->disp_template_raw( 'block_end' );
 145  }
 146  
 147  
 148  // Event AdminToolPayload for each Plugin:
 149  $tool_plugins = $Plugins->get_list_by_event( 'AdminToolPayload' );
 150  foreach( $tool_plugins as $loop_Plugin )
 151  {
 152      $block_item_Widget->title = format_to_output($loop_Plugin->name);
 153      $block_item_Widget->disp_template_replaced( 'block_start' );
 154      $Plugins->call_method_if_active( $loop_Plugin->ID, 'AdminToolPayload', $params = array() );
 155      $block_item_Widget->disp_template_raw( 'block_end' );
 156  }
 157  
 158  ?>

title

Description

title

Description

title

Description

title

title

Body