diff options
author | Florian Pritz <bluewind@xinu.at> | 2013-08-13 00:00:58 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2013-08-13 00:00:58 +0200 |
commit | 73ab75b3e0b5da26203e275c6641eacef0531729 (patch) | |
tree | b46c78bfd8fccc89e32d7ed6c1add847355b60b3 /application/controllers | |
parent | 2e5f4af90d44b568cb98f221ad0a68667edd862c (diff) |
remove caching code from history
Simply enabling it again would cause breakage (json handling). Just get
rid of it.
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers')
-rw-r--r-- | application/controllers/file.php | 113 |
1 files changed, 52 insertions, 61 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php index 7629b809b..e931e4078 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -448,77 +448,68 @@ class File extends CI_Controller { $user = $this->muser->get_userid(); - $this->load->library("MemcacheLibrary"); - if (! $cached = $this->memcachelibrary->get("history_".$this->var->view_dir."_".$user)) { - $query = array(); - $lengths = array(); - - // key: database field name; value: display name - $fields = array( - "id" => "ID", - "filename" => "Filename", - "mimetype" => "Mimetype", - "date" => "Date", - "hash" => "Hash", - "filesize" => "Size" - ); - - $this->data['title'] .= ' - Upload history'; - foreach($fields as $length_key => $value) { - $lengths[$length_key] = mb_strlen($value); - } + $query = array(); + $lengths = array(); + + // key: database field name; value: display name + $fields = array( + "id" => "ID", + "filename" => "Filename", + "mimetype" => "Mimetype", + "date" => "Date", + "hash" => "Hash", + "filesize" => "Size" + ); - $order = is_cli_client() ? "ASC" : "DESC"; + $this->data['title'] .= ' - Upload history'; + foreach($fields as $length_key => $value) { + $lengths[$length_key] = mb_strlen($value); + } - $query = $this->db->query(" - SELECT ".implode(",", array_keys($fields))." - FROM files - WHERE user = ? - ORDER BY date $order - ", array($user))->result_array(); + $order = is_cli_client() ? "ASC" : "DESC"; - if ($this->input->get("json") !== false) { - return send_json_reply($query); - } + $query = $this->db->query(" + SELECT ".implode(",", array_keys($fields))." + FROM files + WHERE user = ? + ORDER BY date $order + ", array($user))->result_array(); - foreach($query as $key => $item) { - $query[$key]["filesize"] = format_bytes($item["filesize"]); - if (is_cli_client()) { - // Keep track of longest string to pad plaintext output correctly - foreach($fields as $length_key => $value) { - $len = mb_strlen($query[$key][$length_key]); - if ($len > $lengths[$length_key]) { - $lengths[$length_key] = $len; - } + if ($this->input->get("json") !== false) { + return send_json_reply($query); + } + + foreach($query as $key => $item) { + $query[$key]["filesize"] = format_bytes($item["filesize"]); + if (is_cli_client()) { + // Keep track of longest string to pad plaintext output correctly + foreach($fields as $length_key => $value) { + $len = mb_strlen($query[$key][$length_key]); + if ($len > $lengths[$length_key]) { + $lengths[$length_key] = $len; } } } + } - $total_size = $this->db->query(" - SELECT sum(filesize) sum - FROM ( - SELECT filesize - FROM files - WHERE user = ? - GROUP BY hash - ) sub - ", array($user))->row_array(); - - $this->data["query"] = $query; - $this->data["lengths"] = $lengths; - $this->data["fields"] = $fields; - $this->data["total_size"] = format_bytes($total_size["sum"]); - - $cached = ""; - $cached .= $this->load->view('header', $this->data, true); - $cached .= $this->load->view($this->var->view_dir.'/upload_history', $this->data, true); - $cached .= $this->load->view('footer', $this->data, true); + $total_size = $this->db->query(" + SELECT sum(filesize) sum + FROM ( + SELECT filesize + FROM files + WHERE user = ? + GROUP BY hash + ) sub + ", array($user))->row_array(); - // disable for now. reenable if it causes too much load - //$this->memcachelibrary->set('history_'.$this->var->view_dir."_".$user, $cached, 42); - } + $this->data["query"] = $query; + $this->data["lengths"] = $lengths; + $this->data["fields"] = $fields; + $this->data["total_size"] = format_bytes($total_size["sum"]); - echo $cached; + $this->load->view('header', $this->data); + $this->load->view($this->var->view_dir.'/upload_history', $this->data); + $this->load->view('footer', $this->data); } function do_delete() |