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