Issues (165)

src/data/cron/cron.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 Copyright (C) 2018-2020 KANOUN Salim
4
 This program is free software; you can redistribute it and/or modify
5
 it under the terms of the Affero GNU General Public v.3 License as published by
6
 the Free Software Foundation;
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
 Affero GNU General Public Public for more details.
11
 You should have received a copy of the Affero GNU General Public Public along
12
 with this program; if not, write to the Free Software Foundation, Inc.,
13
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
14
 */
15
16
/**
17
 * This files is called from the crontab container every minute
18
 * Add your cron action following 
19
 * https://github.com/peppeocchi/php-cron-scheduler
20
 */
21
22
require_once(__DIR__.'/../../vendor/autoload.php');
23
24
use GO\Scheduler;
0 ignored issues
show
The type GO\Scheduler was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
26
// Create a new scheduler
27
$scheduler=new Scheduler();
28
29
//Define action and timing
30
31
//Execute each hour TUS script to remove expired incomplete upload
32
$tusConfigFile = dirname(__DIR__, 1).'/data/_config/tus_server.php';
33
$rootPath = dirname(__DIR__, 2);
34
$scheduler->raw($rootPath.'/vendor/bin/tus tus:expired --config='.$tusConfigFile)->hourly()->output('/var/log/tus_cron.log');
35
36
37
// Let the scheduler execute jobs which are due.
38
$scheduler->run();
39
40
function scheduleWorkindDays(String $scriptName, array $arugments, int $hour, int $min) {
41
	global $scheduler;
42
	$scheduler->php(__DIR__.'/'.$scriptName, null, $arugments)->monday($hour, $min)->output('/var/log/gaelo_cron.log');
43
	$scheduler->php(__DIR__.'/'.$scriptName, null, $arugments)->tuesday($hour, $min)->output('/var/log/gaelo_cron.log');
44
	$scheduler->php(__DIR__.'/'.$scriptName, null, $arugments)->wednesday($hour, $min)->output('/var/log/gaelo_cron.log');
45
	$scheduler->php(__DIR__.'/'.$scriptName, null, $arugments)->thursday($hour, $min)->output('/var/log/gaelo_cron.log');
46
	$scheduler->php(__DIR__.'/'.$scriptName, null, $arugments)->friday($hour, $min)->output('/var/log/gaelo_cron.log');
47
}
48
49
function scheduleSundays(String $scriptName, array $arugments, int $hour, int $min) {
50
	global $scheduler;
51
	$scheduler->php(__DIR__.'/'.$scriptName, null, $arugments)->sunday($hour, $min)->output('/var/log/gaelo_cron.log');
52
}