1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-05 10:49:37 +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

@ -95,7 +95,7 @@ switch ($_REQUEST['action']) {
$catalog->count = 0;
$catalog->add_to_catalog();
}
Catalog::optimize_tables();
Dba::optimize_tables();
$url = Config::get('web_path') . '/admin/catalog.php';
$title = T_('Catalog Updated');
$body = '';
@ -153,7 +153,7 @@ switch ($_REQUEST['action']) {
$catalog = new Catalog($catalog_id);
$catalog->clean_catalog();
} // end foreach catalogs
Catalog::optimize_tables();
Dba::optimize_tables();
}
$url = Config::get('web_path') . '/admin/catalog.php';

View file

@ -141,7 +141,7 @@ while ($row = Dba::fetch_row($db_results)) {
} // end foreach
Catalog::optimize_tables();
Dba::optimize_tables();
ob_end_flush();
echo "\n";

View file

@ -1525,27 +1525,6 @@ class Catalog extends database_object {
}
/**
* 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);
}
} // optimize_tables;
/**
* trim_prefix
* Splits the prefix from the string

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
?>