Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
command
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 2
20
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
 check_apcu_cache
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13namespace phpbb\console\command\extension;
14
15use Symfony\Component\Console\Style\SymfonyStyle;
16
17abstract class command extends \phpbb\console\command\command
18{
19    /** @var \phpbb\extension\manager */
20    protected $manager;
21
22    /** @var \phpbb\log\log */
23    protected $log;
24
25    /** @var string Cache driver class */
26    protected $cache_driver_class;
27
28    /**
29     * Constructor.
30     *
31     * @param \phpbb\user                $user                User object
32     * @param \phpbb\extension\manager    $manager            Extension manager object
33     * @param \phpbb\log\log            $log                Log object
34     * @param string                    $cache_driver_class    Cache driver class
35     */
36    public function __construct(\phpbb\user $user, \phpbb\extension\manager $manager, \phpbb\log\log $log, $cache_driver_class)
37    {
38        $this->manager = $manager;
39        $this->log = $log;
40        $this->cache_driver_class = $cache_driver_class;
41
42        parent::__construct($user);
43    }
44
45    /**
46     * Check if APCu cache driver is used and enabled for CLI, otherwise display a notice.
47     *
48     * @param SymfonyStyle $io
49     * @return void
50     */
51    protected function check_apcu_cache(SymfonyStyle $io)
52    {
53        if ($this->cache_driver_class === 'phpbb\\cache\\driver\\apcu' && !@ini_get('apc.enable_cli'))
54        {
55            $io->note($this->user->lang('CLI_APCU_CACHE_NOTICE'));
56        }
57    }
58}