xref: /plugin/bez/cron-daily.php (revision 53df74e7ac5ae4234aac1fa716a33878a039026f)
1<?php
2
3function usage() {
4    echo "usage: cron-daily.php url user\n";
5    exit(1);
6}
7
8if (count($argv) < 3) {
9    usage();
10}
11
12$url = $argv[1];
13
14$dw_user = $argv[2];
15
16$url_p = parse_url($url);
17
18if (!isset($url_p['scheme'])) {
19    $_SERVER['HTTPS'] = 'on';
20
21    $ex = explode('/', $url_p['path'], 2);
22
23    $_SERVER['SERVER_NAME'] = $ex[0];
24    if (isset($ex[1])) {
25        $_SERVER['DOCUMENT_ROOT'] = $ex[1] . '/';
26    } else {
27        $_SERVER['DOCUMENT_ROOT'] = '/';
28    }
29
30} else {
31    if ($url_p['scheme'] === 'https') {
32        $_SERVER['HTTPS'] = 'on';
33    } else {
34        $_SERVER['HTTPS'] = 'off';
35    }
36    $_SERVER['SERVER_NAME'] = $url_p['host'];
37    $_SERVER['DOCUMENT_ROOT'] = $url_p['path'] . '/';
38}
39
40//in case of $conf['basedir'] is empty
41$_SERVER['SCRIPT_NAME'] = $_SERVER['DOCUMENT_ROOT'].'doku.php';
42
43$inc = realpath(__DIR__.'/../../..');
44define('DOKU_INC', $inc.'/');
45
46// load and initialize the core system
47require_once(DOKU_INC.'inc/init.php');
48require_once 'cron/functions.php';
49
50if (date('l') === $conf['plugin']['bez']['weekly_cron_day_of_the_week']) {
51    //send_weekly_message(false);
52}
53
54send_one_day_task_reminder();
55
56send_inactive_issue();
57