From c78becdb15edcef865f4a0056a3f6c03ea86a20c Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 19 Feb 2012 19:02:15 +0100 Subject: 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 --- application/controllers/file.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'application/controllers') 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 ` + */ + // 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); -- cgit v1.2.3-24-g4f1b