<?php
require'fun.php';
require'f_admin.php';
if($perm<2)
require'interzis.php';
$titlu='Optimizeaza baza de date';
require'f_sus.php';
if(!in_array($de,$id_proprietari))
{
echo$div[4].'<img src="'.$domenii_statice[2].'actiune_delete.png" alt="" width="16" height="16" />Eroare!'.$div[5].$div[7].'Nu ai privilegiul de a accesa această pagină, păstrează distanța!'.$div[0];
require'f_jos.php';
}
$total_size=0;
$optimise_total_size=0;
$rows=$conn->query('SHOW TABLE STATUS');
while($row=$rows->fetch_assoc())
{
$table_size=$row['Data_length']+$row['Index_length'];
$tables[$row['Name']]=sprintf('%.2f',$table_size);
$total_size+=round($table_size,2);
$conn->query('OPTIMIZE TABLE '.$row['Name']);
}
$rows=$conn->query('SHOW TABLE STATUS');
while($row=$rows->fetch_assoc())
{
$table_size=$row['Data_length']+$row['Index_length'];
$optimised_tables[$row['Name']]=sprintf('%.2f',$table_size);
$optimise_total_size+=round($table_size,2);
}
require'f_dimensiune.php';
echo'<table><thead><tr><th>Tabel</th><th>Dimensiune</th><th>Dimensiune după optimizare</th><th>Dimensiune optimizata</th></tr></thead><tbody>';
foreach($tables AS$table=>$size)
{
echo'<tr><td>'.$table.'</td><td>'.dimensiune($size).'</td><td>'.dimensiune($optimised_tables[$table]).'</td><td>';
if($size>$optimised_tables[$table])
echo dimensiune($size-$optimised_tables[$table]);
echo'</td></tr>';
}
echo'<tr><td><strong>Total</strong></td><td><strong>'.dimensiune($total_size).'</strong></td><td><strong>'.dimensiune($optimise_total_size).'</strong></td><td><strong>'.dimensiune(round($total_size-$optimise_total_size,2)).'</strong></td></tr></tbody></table>';
require'f_jos.php';