diff options
author | Florian Pritz <bluewind@xinu.at> | 2013-02-21 10:17:44 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2013-02-23 22:34:43 +0100 |
commit | ba099a0fe748e2ff664a4d2fd6fc6a0f5e00a9f7 (patch) | |
tree | 6ad1dbd532c3f83dbccf6f4b74e682e5c7518ad9 /application/controllers | |
parent | ce76d2db1da723a3c5c97402941a51a59529e111 (diff) |
CLI: update_file_metadata: also update mimetypes
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers')
-rw-r--r-- | application/controllers/file.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php index 429efbe6e..333602fbf 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -57,8 +57,8 @@ class File extends CI_Controller { echo " nuke_id <ID> Nukes all IDs sharing the same hash\n"; echo "\n"; echo "Functions that shouldn't have to be run:\n"; - echo " clean_stale_files Remove files without database entries\n"; - echo " update_file_sizes Update filesize in database\n"; + echo " clean_stale_files Remove files without database entries\n"; + echo " update_file_metadata Update filesize and mimetype in database\n"; exit; } // Try to guess what the user would like to do. @@ -736,7 +736,7 @@ class File extends CI_Controller { echo "removed hash \"$hash\"\n"; } - function update_file_sizes() + function update_file_metadata() { if (!$this->input->is_cli_request()) return; @@ -755,15 +755,15 @@ class File extends CI_Controller { foreach ($query as $key => $item) { $hash = $item["hash"]; $filesize = intval(filesize($this->mfile->file($hash))); + $mimetype = $this->mfile->mimetype($this->mfile->file($hash)); + $this->db->query(" UPDATE files - SET filesize = ? + SET filesize = ?, mimetype = ? WHERE hash = ? - ", array($filesize, $hash)); + ", array($filesize, $mimetype, $hash)); } } - - } } |