aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--command/download.php28
-rw-r--r--config.php27
-rw-r--r--index.php16
3 files changed, 70 insertions, 1 deletions
diff --git a/command/download.php b/command/download.php
new file mode 100644
index 0000000..8cc2f53
--- /dev/null
+++ b/command/download.php
@@ -0,0 +1,28 @@
+<?php
+
+$conf = $GLOBALS['CONFIG']['DOWNLOAD'];
+
+if(isset($conf['REQUIRE_USER']))
+{
+ if(get_current_user() != $conf['require-user'])
+ {
+ stderr(
+ 'Not downloading files for user %s, run this script as user %s',
+ get_current_user(),
+ $conf['require-user']
+ );
+ exit(2);
+ }
+}
+
+foreach (Conferences::getConferences() as $conference)
+{
+ stdout('== %s ==', $conference->getSlug());
+
+ if(isset($conf['MAX_CONFERENCE_AGE']))
+ {
+ date_diff()
+ return time() >= $this->endsAt();
+ }
+
+}
diff --git a/config.php b/config.php
index 1dbea27..57be966 100644
--- a/config.php
+++ b/config.php
@@ -24,7 +24,7 @@ $GLOBALS['CONFIG']['PREVIEW_DOMAIN'] = 'xlocalhost';
* Protokollfreie URLs (welche, die mit // beginnen), werden automatisch mit dem korrekten Protokoll ergänzt.
* In diesem Fall wird auch ein SSL-Umschalt-Button im Header angezeigt
*/
-if($_SERVER['SERVER_NAME'] == 'localhost')
+if(@$_SERVER['SERVER_NAME'] == 'localhost')
{
// keine Konfiguration -> BASEURL wird automatisch erraten
}
@@ -38,3 +38,28 @@ else
// Set a safe Default
$GLOBALS['CONFIG']['BASEURL'] = '//streaming.media.ccc.de/';
}
+
+
+/**
+ * Konfiguration für den Datei-Download Cronjob
+ */
+$GLOBALS['CONFIG']['DOWNLOAD'] = [
+ /**
+ * Verweigeren Download, wenn der PHP-Prozess unter einem anderen Benutzer als diesem läuft
+ * Auskommentieren um alle Benutzer zu erlauben
+ */
+ //'REQUIRE_USER' => 'www-data',
+
+ /**
+ * Wartende HTTP-Downloads nach dieser Anzahl von Sekunden abbrechen
+ */
+ 'HTTP_TIMEOUT' => 5 /* Sekunden */,
+
+ /**
+ * Nur Dateien von Konferenzen herunterladen, die weniger als
+ * diese Aanzahl von Tagen alt sind (gemessen am END_DATE)
+ *
+ * Auskommentieren, um alle Konferenzen zu beachten
+ */
+ 'MAX_CONFERENCE_AGE' => 30 /* Tage */,
+];
diff --git a/index.php b/index.php
index 6c62e34..9b4689c 100644
--- a/index.php
+++ b/index.php
@@ -27,6 +27,22 @@ require_once('model/Upcoming.php');
ob_start();
+if(isset($argv) && isset($argv[1]))
+{
+ require('lib/command-helper.php');
+
+ switch($argv[1])
+ {
+ case 'download':
+ require('command/download.php');
+ exit(0);
+ }
+
+ stderr("Unknown Command: %s", $argv[1]);
+ exit(1);
+}
+
+
try {
if(isset($_GET['htaccess']))
{