summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Arthur <paul.arthur@flowerysong.com>2013-01-26 00:23:12 -0500
committerPaul Arthur <paul.arthur@flowerysong.com>2013-01-26 00:23:12 -0500
commitfd5b7e1b10c00738f1a27f94c5ee529352dd68ca (patch)
tree2ec56c4f940ccfd50754aa5d250a5678c6d8e19e
parent7703c9431d6989af12e9c75a35cf8f641482a81f (diff)
downloadampache-fd5b7e1b10c00738f1a27f94c5ee529352dd68ca.tar.gz
ampache-fd5b7e1b10c00738f1a27f94c5ee529352dd68ca.tar.bz2
ampache-fd5b7e1b10c00738f1a27f94c5ee529352dd68ca.zip
Move Catalog::optimize_tables() to Dba
-rw-r--r--admin/catalog.php4
-rw-r--r--bin/catalog_update.inc2
-rw-r--r--lib/class/catalog.class.php21
-rw-r--r--lib/class/dba.class.php22
4 files changed, 25 insertions, 24 deletions
diff --git a/admin/catalog.php b/admin/catalog.php
index eeb58d4c..bcd69130 100644
--- a/admin/catalog.php
+++ b/admin/catalog.php
@@ -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';
diff --git a/bin/catalog_update.inc b/bin/catalog_update.inc
index 98e7e476..126bfb78 100644
--- a/bin/catalog_update.inc
+++ b/bin/catalog_update.inc
@@ -141,7 +141,7 @@ while ($row = Dba::fetch_row($db_results)) {
} // end foreach
-Catalog::optimize_tables();
+Dba::optimize_tables();
ob_end_flush();
echo "\n";
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index d5bea0ef..02aa9135 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -1526,27 +1526,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
*/
diff --git a/lib/class/dba.class.php b/lib/class/dba.class.php
index 8ec5eed5..ce5c38c4 100644
--- a/lib/class/dba.class.php
+++ b/lib/class/dba.class.php
@@ -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
?>