summaryrefslogtreecommitdiffstats
path: root/lib/class/user.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-05-12 05:58:17 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-05-12 05:58:17 +0000
commit3634ba80946b818de7f0505ed44d947e70dd41ec (patch)
tree03749fb9cc1f1fc6ef157ac187cea48f1f1a7098 /lib/class/user.class.php
parent3e36e0b01e843ec8d4e8a63a72e5f7425921dab8 (diff)
downloadampache-3634ba80946b818de7f0505ed44d947e70dd41ec.tar.gz
ampache-3634ba80946b818de7f0505ed44d947e70dd41ec.tar.bz2
ampache-3634ba80946b818de7f0505ed44d947e70dd41ec.zip
added in some caching and add the database upgrade that will make the taging mostly work
Diffstat (limited to 'lib/class/user.class.php')
-rw-r--r--lib/class/user.class.php22
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index ae53038c..ef40a58f 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -24,7 +24,7 @@
* and deletion of the user objects from the database by defualt you constrcut it
* with a user_id from user.id
*/
-class User {
+class User extends database_object {
//Basic Componets
public $id;
@@ -49,8 +49,9 @@ class User {
if (!$user_id) { return false; }
- $this->id = intval($user_id);
- $info = $this->_get_info();
+ $this->id = intval($user_id);
+
+ $info = $this->_get_info();
foreach ($info as $key=>$value) {
// Let's not save the password in this object :S
@@ -69,22 +70,27 @@ class User {
*/
private function _get_info() {
+ $id = intval($this->id);
+
+ if (parent::is_cached('user',$id)) {
+ return parent::get_from_cache('user',$id);
+ }
+
// If the ID is -1 then
- if ($this->id == '-1') {
+ if ($id == '-1') {
$data['username'] = 'System';
$data['fullname'] = 'Ampache User';
$data['access'] = '25';
return $data;
}
- // Else...
- $id = Dba::escape($this->id);
-
- $sql = "SELECT * FROM `user` WHERE `id`='" . $id . "'";
+ $sql = "SELECT * FROM `user` WHERE `id`='$id'";
$db_results = Dba::query($sql);
$data = Dba::fetch_assoc($db_results);
+ parent::add_to_cache('user',$id,$data);
+
return $data;
} // _get_info