[ Index ] |
|
Code source de Dotclear 2.0-beta6 |
1 <?php 2 # ***** BEGIN LICENSE BLOCK ***** 3 # This file is part of DotClear. 4 # Copyright (c) 2005 Olivier Meunier and contributors. All rights 5 # reserved. 6 # 7 # DotClear is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # DotClear is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with DotClear; if not, write to the Free Software 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 # 21 # ***** END LICENSE BLOCK ***** 22 23 if (!defined('DC_CONTEXT_ADMIN')) { exit; } 24 25 $action = !empty($_REQUEST['action']) ? $_REQUEST['action'] : null; 26 $start = !empty($_GET['start']) ? abs((integer) $_GET['start']) : 0; 27 28 if ($action == 'vacuum') 29 { 30 try 31 { 32 foreach ($core->con->getTables() as $t) { 33 if (strpos($t,$core->prefix) === 0) { 34 $core->con->vacuum($t); 35 } 36 } 37 http::redirect($p_url.'&vacuum=1'); 38 } 39 catch (Exception $e) 40 { 41 $core->error->add($e->getMessage()); 42 } 43 } 44 elseif ($action == 'commentscount') 45 { 46 try { 47 $core->countAllComments(); 48 http::redirect($p_url.'&commentscount=1'); 49 } catch (Exception $e) { 50 $core->error->add($e->getMessage()); 51 } 52 } 53 54 ?> 55 <html> 56 <head> 57 <title><?php echo __('Maintenance'); ?></title> 58 </head> 59 60 <body> 61 <h2><?php echo __('Maintenance'); ?></h2> 62 63 <?php 64 if (!empty($_GET['vacuum'])) { 65 echo '<p class="message">'.__('Optimization successful.').'</p>'; 66 } 67 if (!empty($_GET['commentscount'])) { 68 echo '<p class="message">'.__('Comments and trackback counted.').'</p>'; 69 } 70 71 if ($action == 'index' && !empty($_GET['indexposts'])) 72 { 73 $limit = 1000; 74 echo '<p>'.sprintf(__('Indexing entry %d to %d.'),$start,$start+$limit).'</p>'; 75 76 $new_start = $core->indexAllPosts($start,$limit); 77 78 if ($new_start) 79 { 80 $new_url = $p_url.'&action=index&indexposts=1&start='.$new_start; 81 echo 82 '<script type="text/javascript">'."\n". 83 "//<![CDATA\n". 84 "window.location = '".$new_url."'\n". 85 "//]]>\n". 86 '</script>'. 87 '<noscript><p><a href="'.html::escapeURL($new_url).'">'.__('next').'</a></p></noscript>'; 88 } 89 else 90 { 91 echo '<p class="message">'.__('Entries index done.').'</p>'; 92 echo '<p><a href="'.$p_url.'">'.__('Back').'</a></p>'; 93 } 94 } 95 elseif ($action == 'index' && !empty($_GET['indexcomments'])) 96 { 97 $limit = 1000; 98 echo '<p>'.sprintf(__('Indexing comment %d to %d.'),$start,$start+$limit).'</p>'; 99 100 $new_start = $core->indexAllComments($start,$limit); 101 102 if ($new_start) 103 { 104 $new_url = $p_url.'&action=index&indexcomments=1&start='.$new_start; 105 echo 106 '<script type="text/javascript">'."\n". 107 "//<![CDATA\n". 108 "window.location = '".$new_url."'\n". 109 "//]]>\n". 110 '</script>'. 111 '<noscript><p><a href="'.html::escapeURL($new_url).'">'.__('next').'</a></p></noscript>'; 112 } 113 else 114 { 115 echo '<p class="message">'.__('Comments index done.').'</p>'; 116 echo '<p><a href="'.$p_url.'">'.__('Back').'</a></p>'; 117 } 118 } 119 else 120 { 121 echo 122 '<h3>'.__('Optimize database room').'</h3>'. 123 '<form action="plugin.php" method="post">'. 124 '<p><input type="submit" value="'.__('Vacuum tables').'" /> '. 125 form::hidden(array('action'),'vacuum'). 126 form::hidden(array('p'),'maintenance').'</p>'. 127 '</form>'; 128 129 echo 130 '<h3>'.__('Counters').'</h3>'. 131 '<form action="plugin.php" method="post">'. 132 '<p><input type="submit" value="'.__('Reset comments and ping counters').'" /> '. 133 form::hidden(array('action'),'commentscount'). 134 form::hidden(array('p'),'maintenance').'</p>'. 135 '</form>'; 136 137 echo 138 '<h3>'.__('Search engine index').' ('.__('This may take a very long time').')</h3>'. 139 '<form action="plugin.php" method="get">'. 140 '<p><input type="submit" name="indexposts" value="'.__('Index all posts').'" /> '. 141 '<input type="submit" name="indexcomments" value="'.__('Index all comments').'" /> '. 142 form::hidden(array('action'),'index'). 143 form::hidden(array('p'),'maintenance').'</p>'. 144 '</form>'; 145 146 147 } 148 ?> 149 150 </body> 151 </html>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Feb 23 22:16:06 2007 | par Balluche grâce à PHPXref 0.7 |