summaryrefslogtreecommitdiffstats
path: root/lib/class/database_object.abstract.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-07-14 04:56:52 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-07-14 04:56:52 +0000
commit0a184d3db49a3263c1336fd679df898ca6800f4a (patch)
tree7d61e5990df4629ee8b2c3a1da722f635791896e /lib/class/database_object.abstract.php
parent5c510357a83f6a25ede6362a267c9d3569daf005 (diff)
downloadampache-0a184d3db49a3263c1336fd679df898ca6800f4a.tar.gz
ampache-0a184d3db49a3263c1336fd679df898ca6800f4a.tar.bz2
ampache-0a184d3db49a3263c1336fd679df898ca6800f4a.zip
make the disabled songs link show something, need to make a custom view for that as the song one i not really valid, also played around with the caching a bit
Diffstat (limited to 'lib/class/database_object.abstract.php')
-rw-r--r--lib/class/database_object.abstract.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/class/database_object.abstract.php b/lib/class/database_object.abstract.php
index 871232ea..2005da55 100644
--- a/lib/class/database_object.abstract.php
+++ b/lib/class/database_object.abstract.php
@@ -31,6 +31,27 @@ abstract class database_object {
// Statistics for debugging
public static $cache_hit = 0;
+ public function get_info($id,$table_name='') {
+
+ $table_name = $table_name ? Dba::escape($table_name) : Dba::escape(strtolower(get_class($this)));
+
+ if (self::is_cached($table_name,$id)) {
+ return self::get_from_cache($table_name,$id);
+ }
+
+ $sql = "SELECT * FROM `$table_name` WHERE `id`='$id'";
+ $db_results = Dba::query($sql);
+
+ if (!$db_results) { return array(); }
+
+ $row = Dba::fetch_assoc($db_results);
+
+ self::add_to_cache($table_name,$id,$row);
+
+ return $row;
+
+ } // get_info
+
/**
* is_cached
* this checks the cache to see if the specified object is there