diff options
author | Paul Arthur <paul.arthur@flowerysong.com> | 2013-01-25 20:35:45 -0500 |
---|---|---|
committer | Paul Arthur <paul.arthur@flowerysong.com> | 2013-01-25 20:35:45 -0500 |
commit | 80f4859712b433d8cee1158951efc19e939224f4 (patch) | |
tree | 4f95eae0397a0f6b3eb0246f79a9fc67f90ea471 | |
parent | d14b5215ebd23097f504607c1db3f653c58cf3e9 (diff) | |
download | ampache-80f4859712b433d8cee1158951efc19e939224f4.tar.gz ampache-80f4859712b433d8cee1158951efc19e939224f4.tar.bz2 ampache-80f4859712b433d8cee1158951efc19e939224f4.zip |
Move Catalog::clear_stats() to Stats::clear()
-rw-r--r-- | admin/catalog.php | 7 | ||||
-rw-r--r-- | lib/class/catalog.class.php | 22 | ||||
-rw-r--r-- | lib/class/stats.class.php | 10 |
3 files changed, 16 insertions, 23 deletions
diff --git a/admin/catalog.php b/admin/catalog.php index b8eac41b..eeb58d4c 100644 --- a/admin/catalog.php +++ b/admin/catalog.php @@ -250,13 +250,12 @@ switch ($_REQUEST['action']) { } break; case 'clear_stats': - if (Config::get('demo_mode')) { access_denied(); break; } - - Catalog::clear_stats(); + if (Config::get('demo_mode')) { access_denied(); break; } + Stats::clear(); $url = Config::get('web_path') . '/admin/catalog.php'; $title = T_('Catalog statistics cleared'); $body = ''; - show_confirmation($title,$body,$url); + show_confirmation($title, $body, $url); break; default: case 'show_catalogs': diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index fee53717..9d38fdb9 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -119,7 +119,8 @@ class Catalog extends database_object { /** * get_from_path * Try to figure out which catalog path most closely resembles this one - * This is useful when creating a new catalog to make sure we're not doubling up here + * This is useful when creating a new catalog to make sure we're not + * doubling up here. */ public static function get_from_path($path) { @@ -207,7 +208,7 @@ class Catalog extends database_object { * get_stats * This returns an hash with the #'s for the different * objects that are associated with this catalog. This is used - * to build the stats box, it also calculates time + * to build the stats box, it also calculates time. */ public static function get_stats($catalog_id = null) { @@ -235,23 +236,6 @@ class Catalog extends database_object { } // get_stats /** - * clear_stats - * This clears all stats for _everything_ - */ - public static function clear_stats() { - - /* Whip out everything */ - $sql = "TRUNCATE `object_count`"; - $db_results = Dba::write($sql); - - $sql = "UDPATE `song` SET `played`='0'"; - $db_results = Dba::write($sql); - - return true; - - } // clear_stats - - /** * create * This creates a new catalog entry and then returns the insert id * it checks to make sure this path is not already used before creating diff --git a/lib/class/stats.class.php b/lib/class/stats.class.php index fb7de902..e92ed994 100644 --- a/lib/class/stats.class.php +++ b/lib/class/stats.class.php @@ -49,6 +49,16 @@ class Stats { } // Constructor /** + * clear + * + * This clears all stats for _everything_. + */ + public static function clear() { + Dba::write('TRUNCATE `object_count`'); + Dba::write('UPDATE `song` SET `played` = 0'; + } + + /** * insert * This inserts a new record for the specified object * with the specified information, amazing! |