summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-02-19 19:02:15 +0100
committerFlorian Pritz <bluewind@xinu.at>2012-02-19 19:02:15 +0100
commitc78becdb15edcef865f4a0056a3f6c03ea86a20c (patch)
tree34e9e123c8d5a8a3e9e69fdf4e49f8fc379305f5
parentcd39396bb56d3c3c042adbfad35c71cc4c302dd7 (diff)
move stale file removal to it's own function
This shouldn't be needed and it's also pretty slow. No need to run it with ever cronjob. Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--application/controllers/file.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index fb4809164..cea976dc5 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -255,12 +255,13 @@ class File extends CI_Controller {
$this->file_mod->show_url($id, $extension);
}
+ /* Functions below this comment can only be run via the CLI
+ * `php index.php file <function name>`
+ */
+
// Removes old files
function cron()
{
- /* cron can only be run via the CLI
- * `php index.php file cron`
- */
if (!$this->input->is_cli_request()) return;
if ($this->config->item('upload_max_age') == 0) return;
@@ -286,9 +287,12 @@ class File extends CI_Controller {
}
}
}
+ }
+
+ /* remove files without database entries */
+ function clean_stale_files() {
+ if (!$this->input->is_cli_request()) return;
- /* remove files without database entries */
- // TODO: put into a function
$upload_path = $this->config->item("upload_path");
$outer_dh = opendir($upload_path);