phpbb-extensions /
mediaembed
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * |
||
| 4 | * phpBB Media Embed PlugIn extension for the phpBB Forum Software package. |
||
| 5 | * |
||
| 6 | * @copyright (c) 2020 phpBB Limited <https://www.phpbb.com> |
||
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
||
| 8 | * |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace phpbb\mediaembed\cron; |
||
| 12 | |||
| 13 | use phpbb\config\config; |
||
|
0 ignored issues
–
show
|
|||
| 14 | use phpbb\mediaembed\cache\cache; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Media Embed cron task. |
||
| 18 | */ |
||
| 19 | class purge_cache 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 20 | { |
||
| 21 | /** @var config $config */ |
||
| 22 | protected $config; |
||
| 23 | |||
| 24 | /** @var cache $cache */ |
||
| 25 | protected $cache; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Constructor |
||
| 29 | * |
||
| 30 | * @param config $config Config object |
||
| 31 | * @param cache $cache MediaEmbed cache object |
||
| 32 | */ |
||
| 33 | public function __construct(config $config, cache $cache) |
||
| 34 | { |
||
| 35 | $this->config = $config; |
||
| 36 | $this->cache = $cache; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * {@inheritDoc} |
||
| 41 | */ |
||
| 42 | public function run() |
||
| 43 | { |
||
| 44 | $this->cache->purge_mediaembed_cache(); |
||
| 45 | $this->config->set('mediaembed_last_gc', time(), false); |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * {@inheritDoc} |
||
| 50 | */ |
||
| 51 | public function is_runnable() |
||
| 52 | { |
||
| 53 | return (bool) $this->config['media_embed_enable_cache']; |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * {@inheritDoc} |
||
| 58 | */ |
||
| 59 | public function should_run() |
||
| 60 | { |
||
| 61 | return $this->config['mediaembed_last_gc'] < strtotime('24 hours ago'); |
||
| 62 | } |
||
| 63 | } |
||
| 64 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths