summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-02-19 18:04:37 +0100
committerFlorian Pritz <bluewind@xinu.at>2012-02-19 18:04:37 +0100
commitcd39396bb56d3c3c042adbfad35c71cc4c302dd7 (patch)
treeb6dab5d272caf5079a141a4eb14f20485fddf702 /application
parent79c687a7dd93e89be141e33d9f0de72461ae2802 (diff)
file/cron: make accessible via CLI only
In production environments the cronjob might run quite some time and could be used to overload the server. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r--application/controllers/file.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index cb2a27a9d..fb4809164 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -34,7 +34,7 @@ class File extends CI_Controller {
// official client uses "fb-client/$version" as useragent
$clients = array("fb-client", "libcurl", "pyfb");
foreach ($clients as $client) {
- if (strpos($_SERVER['HTTP_USER_AGENT'], $client) !== false) {
+ if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], $client) !== false) {
$this->var->cli_client = true;
break;
}
@@ -258,6 +258,11 @@ class File extends CI_Controller {
// 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;
$oldest_time = (time()-$this->config->item('upload_max_age'));