summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/file.php12
-rw-r--r--application/controllers/tools.php45
-rw-r--r--application/controllers/user.php5
3 files changed, 52 insertions, 10 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index bb06e17d4..51d6cf156 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -31,16 +31,8 @@ class File extends MY_Controller {
function index()
{
if ($this->input->is_cli_request()) {
- echo "php index.php file <function> [arguments]\n";
- echo "\n";
- echo "Functions:\n";
- echo " cron Cronjob\n";
- 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_metadata Update filesize and mimetype in database\n";
- exit;
+ $this->load->library("../controllers/tools");
+ return $this->tools->index();
}
// Try to guess what the user would like to do.
$id = $this->uri->segment(1);
diff --git a/application/controllers/tools.php b/application/controllers/tools.php
new file mode 100644
index 000000000..b80dc5024
--- /dev/null
+++ b/application/controllers/tools.php
@@ -0,0 +1,45 @@
+<?php
+/*
+ * Copyright 2014 Florian "Bluewind" Pritz <bluewind@server-speed.net>
+ *
+ * Licensed under AGPLv3
+ * (see COPYING for full license text)
+ *
+ */
+
+class Tools extends MY_Controller {
+
+ function __construct()
+ {
+ parent::__construct();
+
+ $this->load->model('mfile');
+ if (!$this->input->is_cli_request()) {
+ show_error("This can only be called via CLI");
+ }
+ }
+
+ function index()
+ {
+ echo "php index.php <controller> <function> [arguments]\n";
+ echo "\n";
+ echo "Functions:\n";
+ echo " file cron Cronjob\n";
+ echo " file nuke_id <ID> Nukes all IDs sharing the same hash\n";
+ echo " user cron Cronjob\n";
+ echo " tools update_database Update/Initialise the database\n";
+ echo "\n";
+ echo "Functions that shouldn't have to be run:\n";
+ echo " file clean_stale_files Remove files without database entries\n";
+ echo " file update_file_metadata Update filesize and mimetype in database\n";
+ exit;
+ }
+
+ function update_database()
+ {
+ $this->load->library('migration');
+ if ( ! $this->migration->current()) {
+ show_error($this->migration->error_string());
+ }
+ }
+}
diff --git a/application/controllers/user.php b/application/controllers/user.php
index b4e2613ac..079f1665c 100644
--- a/application/controllers/user.php
+++ b/application/controllers/user.php
@@ -23,6 +23,11 @@ class User extends MY_Controller {
function index()
{
+ if ($this->input->is_cli_request()) {
+ $this->load->library("../controllers/tools");
+ return $this->tools->index();
+ }
+
$this->data["username"] = $this->muser->get_username();
$this->load->view('header', $this->data);