Issues (72)

cron/autogroups_check.php (2 issues)

Labels
Severity
1
<?php
2
/**
3
*
4
* Auto Groups extension for the phpBB Forum Software package.
5
*
6
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
7
* @license GNU General Public License, version 2 (GPL-2.0)
8
*
9
*/
10
11
namespace phpbb\autogroups\cron;
12
13
/**
14
 * Auto groups cron task.
15
 */
16
class autogroups_check extends \phpbb\cron\task\base
0 ignored issues
show
The type phpbb\cron\task\base 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...
17
{
18
	/** @var \phpbb\config\config */
0 ignored issues
show
The type phpbb\config\config 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...
19
	protected $config;
20
21
	/** @var \phpbb\autogroups\conditions\manager */
22
	protected $manager;
23
24
	/**
25
	 * Constructor
26
	 *
27
	 * @param \phpbb\config\config                 $config  Config object
28
	 * @param \phpbb\autogroups\conditions\manager $manager Auto groups condition manager object
29
	 * @access public
30
	 */
31
	public function __construct(\phpbb\config\config $config, \phpbb\autogroups\conditions\manager $manager)
32
	{
33
		$this->config = $config;
34
		$this->manager = $manager;
35
	}
36
37
	/**
38
	 * Runs this cron task.
39
	 *
40
	 * @return void
41
	 */
42
	public function run()
43
	{
44
		$this->manager->check_conditions();
45
		$this->config->set('autogroups_last_run', time(), false);
46
	}
47
48
	/**
49
	 * Returns whether this cron task should run now, because enough time
50
	 * has passed since it was last run (24 hours).
51
	 *
52
	 * @return bool
53
	 */
54
	public function should_run()
55
	{
56
		return $this->config['autogroups_last_run'] < strtotime('24 hours ago');
57
	}
58
}
59