summaryrefslogtreecommitdiffstats
path: root/lib/class
diff options
context:
space:
mode:
authorPaul Arthur <paul.arthur@flowerysong.com>2013-01-26 00:29:04 -0500
committerPaul Arthur <paul.arthur@flowerysong.com>2013-01-26 00:30:26 -0500
commite2d3c948002076e73772c707b00c6c7aa6745029 (patch)
tree1200f1f6e7659efaa095d7e417c413f6b1695276 /lib/class
parentfd5b7e1b10c00738f1a27f94c5ee529352dd68ca (diff)
downloadampache-e2d3c948002076e73772c707b00c6c7aa6745029.tar.gz
ampache-e2d3c948002076e73772c707b00c6c7aa6745029.tar.bz2
ampache-e2d3c948002076e73772c707b00c6c7aa6745029.zip
Catalog::_check_ticker() -> UI::check_ticker()
Diffstat (limited to 'lib/class')
-rw-r--r--lib/class/catalog.class.php24
-rw-r--r--lib/class/ui.class.php48
2 files changed, 53 insertions, 19 deletions
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index 02aa9135..39ce9451 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -50,7 +50,6 @@ class Catalog extends database_object {
private static $artists = array();
private static $tags = array();
private static $_art_albums = array();
- private static $_ticker;
/**
* Constructor
@@ -73,19 +72,6 @@ class Catalog extends database_object {
} //constructor
- /**
- * _check_ticker
- * Stupid little cutesie thing
- */
- private static function _check_ticker() {
- if (!isset(self::$_ticker) || (time() > self::$_ticker + 1)) {
- self::$_ticker = time();
- return true;
- }
-
- return false;
- }
-
/**
* _create_filecache
* This poplates an array (filecache) on this object from the database
@@ -594,7 +580,7 @@ class Catalog extends database_object {
$this->count++;
$file = str_replace(array('(',')','\''),'',$full_file);
- if(self::_check_ticker()) {
+ if(UI::check_ticker()) {
update_text('add_count_' . $this->id, $this->count);
update_text('add_dir_' . $this->id, scrub_out($file));
} // update our current state
@@ -711,7 +697,7 @@ class Catalog extends database_object {
/* Stupid little cutesie thing */
$search_count++;
- if (self::_check_ticker()) {
+ if (UI::check_ticker()) {
update_text('count_art_' . $this->id, $search_count);
update_text('read_art_' . $this->id, scrub_out($album->name));
} //echos song count
@@ -745,7 +731,7 @@ class Catalog extends database_object {
/* Stupid little cutesie thing */
$thumb_count++;
- if (self::_check_ticker()) {
+ if (UI::check_ticker()) {
update_text('count_thumb_' . $this->id, $search_count);
} //echos thumb count
@@ -1359,7 +1345,7 @@ class Catalog extends database_object {
while ($results = Dba::fetch_assoc($db_results)) {
debug_event('clean', 'Starting work on ' . $results['file'] . '(' . $results['id'] . ')', 5, 'ampache-catalog');
$count++;
- if (self::_check_ticker()) {
+ if (UI::check_ticker()) {
$file = str_replace(array('(',')', '\''), '', $results['file']);
update_text('clean_count_' . $this->id, $count);
update_text('clean_dir_' . $this->id, scrub_out($file));
@@ -1470,7 +1456,7 @@ class Catalog extends database_object {
while ($row = Dba::fetch_assoc($db_results)) {
$count++;
- if (self::_check_ticker()) {
+ if (UI::check_ticker()) {
$file = str_replace(array('(',')','\''), '', $row['file']);
update_text('verify_count_' . $this->id, $count);
update_text('verify_dir_' . $this->id, scrub_out($file));
diff --git a/lib/class/ui.class.php b/lib/class/ui.class.php
new file mode 100644
index 00000000..6c2041f5
--- /dev/null
+++ b/lib/class/ui.class.php
@@ -0,0 +1,48 @@
+<?php
+/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */
+/**
+ *
+ * LICENSE: GNU General Public License, version 2 (GPLv2)
+ * Copyright 2001 - 2013 Ampache.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+// A collection of methods related to the user interface
+
+class UI {
+
+ private static $_ticker;
+
+ public function __construct($data) {
+ return false;
+ }
+
+ /**
+ * check_ticker
+ *
+ * Stupid little cutesie thing to ratelimit output of long-running
+ * operations.
+ */
+ public static function check_ticker() {
+ if (!isset(self::$_ticker) || (time() > self::$_ticker + 1)) {
+ self::$_ticker = time();
+ return true;
+ }
+
+ return false;
+ }
+}