Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
install_helper
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 2
30
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 is_phpbb_installed
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
20
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 */
13
14namespace phpbb\install\helper;
15
16/**
17 * General helper functionality for the installer
18 */
19class install_helper
20{
21    /**
22     * @var string
23     */
24    protected $php_ext;
25
26    /**
27     * @var string
28     */
29    protected $phpbb_root_path;
30
31    /**
32     * Constructor
33     *
34     * @param string    $phpbb_root_path    path to phpBB's root
35     * @param string    $php_ext            Extension of PHP files
36     */
37    public function __construct($phpbb_root_path, $php_ext)
38    {
39        $this->phpbb_root_path    = $phpbb_root_path;
40        $this->php_ext            = $php_ext;
41    }
42
43    /**
44     * Check whether phpBB is installed.
45     *
46     * @return bool
47     */
48    public function is_phpbb_installed()
49    {
50        $config_path = $this->phpbb_root_path . 'config.' . $this->php_ext;
51        $install_lock_path = $this->phpbb_root_path . 'cache/install_lock';
52
53        if (file_exists($config_path) && !file_exists($install_lock_path) && filesize($config_path))
54        {
55            return true;
56        }
57
58        return false;
59    }
60}