[ Index ]
 

Code source de PHP NUKE 7.9

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/admin/modules/ -> optimize.php (source)

   1  <?php
   2  
   3  /************************************************************************/
   4  /* PHP-NUKE: Web Portal System                                          */
   5  /* ===========================                                          */
   6  /*                                                                      */
   7  /* Copyright (c) 2005 by Francisco Burzi                                */
   8  /* http://phpnuke.org                                                   */
   9  /*                                                                      */
  10  /* Based on Database Optimization                                       */
  11  /* Copyright (c) 2001 by Xavier JULIE (webmaster@securite-internet.org  */
  12  /* http://www.securite-internet.org                                     */
  13  /*                                                                        */
  14  /* This program is free software. You can redistribute it and/or modify */
  15  /* it under the terms of the GNU General Public License as published by */
  16  /* the Free Software Foundation; either version 2 of the License.       */
  17  /************************************************************************/
  18  
  19  if (!defined('ADMIN_FILE')) {
  20      die ("Access Denied");
  21  }
  22  
  23  global $prefix, $db, $admin_file;
  24  $aid = substr("$aid", 0,25);
  25  $row = $db->sql_fetchrow($db->sql_query("SELECT radminsuper FROM " . $prefix . "_authors WHERE aid='$aid'"));
  26  if ($row['radminsuper'] == 1) {
  27  
  28      include ("header.php");
  29      GraphicAdmin();
  30      title("" . _DBOPTIMIZATION . "");
  31      OpenTable();
  32      echo "<center><font class=\"title\">" . _OPTIMIZINGDB . " $dbname</font></center><br><br>"
  33      ."<table border=1 align=\"center\"><tr><td><div align=center>" . _TABLE . "</div></td><td><div align=center>" . _SIZE . "</div></td><td><div align=center>" . _STATUS . "</div></td><td><div align=center>" . _SPACESAVED . "</div></td></tr>";
  34      $db_clean = $dbname;
  35      $tot_data = 0;
  36      $tot_idx = 0;
  37      $tot_all = 0;
  38      $local_query = 'SHOW TABLE STATUS FROM '.$dbname;
  39      $result = $db->sql_query($local_query);
  40      if ($db->sql_numrows($result)) {
  41          while ($row = $db->sql_fetchrow($result)) {
  42              $tot_data = $row['Data_length'];
  43              $tot_idx  = $row['Index_length'];
  44              $total = $tot_data + $tot_idx;
  45              $total = $total / 1024 ;
  46              $total = round ($total,3);
  47              $gain= $row['Data_free'];
  48              $gain = $gain / 1024 ;
  49              $total_gain += $gain;
  50              $gain = round ($gain,3);
  51              $local_query = 'OPTIMIZE TABLE '.$row[0];
  52              $resultat  = $db->sql_query($local_query);
  53              if ($gain == 0) {
  54                  echo "<tr><td>"."$row[0]"."</td>"."<td>"."$total"." Kb"."</td>"."<td>" . _ALREADYOPTIMIZED . "</td><td>0 Kb</td></tr>";
  55              } else {
  56                  echo "<tr><td><b>"."$row[0]"."</b></td>"."<td><b>"."$total"." Kb"."</b></td>"."<td><b>" . _OPTIMIZED . "</b></td><td><b>"."$gain"." Kb</b></td></tr>";
  57              }
  58          }
  59      }
  60      echo "</table>";
  61      echo "</center>";
  62      CloseTable();
  63      echo "<br>";
  64      OpenTable();
  65      $total_gain = round ($total_gain,3);
  66      echo "<center><b>" . _OPTIMIZATIONRESULTS . "</b><br><br>"
  67      ."" . _TOTALSPACESAVED . " "."$total_gain"." Kb<br>";
  68      $sql_query = "CREATE TABLE IF NOT EXISTS ".$prefix."_optimize_gain(gain decimal(10,3))";
  69      $result = $db->sql_query($sql_query);
  70      $sql_query = "INSERT INTO ".$prefix."_optimize_gain (gain) VALUES ('$total_gain')";
  71      $result = $db->sql_query($sql_query);
  72      $sql_query = "SELECT * FROM ".$prefix."_optimize_gain";
  73      $result = $db->sql_query ($sql_query);
  74      while ($row = $db->sql_fetchrow($result)) {
  75          $histo += $row[0];
  76          $cpt += 1;
  77      }
  78      echo "" . _YOUHAVERUNSCRIPT . " $cpt " . _TIMES . "<br>"
  79      ."$histo " . _KBSAVED . "</center>";
  80      CloseTable();
  81      include ("footer.php");
  82  
  83  } else {
  84      echo "Access Denied";
  85  }
  86  
  87  ?>


Généré le : Sun Apr 1 11:11:59 2007 par Balluche grâce à PHPXref 0.7