1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-05 02:39:47 +02:00

Move Catalog::optimize_tables() to Dba

This commit is contained in:
Paul Arthur 2013-01-26 00:23:12 -05:00
parent 7703c9431d
commit fd5b7e1b10
4 changed files with 25 additions and 24 deletions

View file

@ -506,6 +506,28 @@ class Dba {
} // reset_db_charset
/**
* optimize_tables
*
* This runs an optimize on the tables and updates the stats to improve
* join speed.
* This can be slow, but is a good idea to do from time to time. We do
* it in case the dba isn't doing it... which we're going to assume they
* aren't.
*/
public static function optimize_tables() {
$sql = "SHOW TABLES";
$db_results = Dba::read($sql);
while($row = Dba::fetch_row($db_results)) {
$sql = "OPTIMIZE TABLE `" . $row[0] . "`";
$db_results_inner = Dba::write($sql);
$sql = "ANALYZE TABLE `" . $row[0] . "`";
$db_results_inner = Dba::write($sql);
}
}
} // dba class
?>