1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Apps\Model\Install\Main; |
4
|
|
|
|
5
|
|
|
use Apps\Controller\Console\Main; |
6
|
|
|
use Ffcms\Core\Arch\Model; |
7
|
|
|
use Ffcms\Core\Helper\FileSystem\Directory; |
8
|
|
|
use Ffcms\Core\Helper\FileSystem\File; |
9
|
|
|
use Ffcms\Core\Helper\Type\Arr; |
10
|
|
|
use Ffcms\Core\Helper\Type\Str; |
11
|
|
|
|
12
|
|
|
class EntityCheck extends Model |
13
|
|
|
{ |
14
|
|
|
public $phpVersion; |
15
|
|
|
public $pdo; |
16
|
|
|
public $gd; |
17
|
|
|
|
18
|
|
|
private $_chmodDirs = []; |
19
|
|
|
|
20
|
|
|
public $chmodCheck = []; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Get default server information and prepare chmod info |
24
|
|
|
*/ |
25
|
|
|
public function before() |
26
|
|
|
{ |
27
|
|
|
$this->phpVersion = phpversion(); |
28
|
|
|
$this->pdo = extension_loaded('pdo'); |
29
|
|
|
$this->gd = extension_loaded('gd') && function_exists('gd_info'); |
30
|
|
|
|
31
|
|
|
// autoload is disabled, lets get chmod file & dirs from console app data |
32
|
|
|
File::inc('/Apps/Controller/Console/Main.php'); |
|
|
|
|
33
|
|
|
$this->_chmodDirs = Main::$installDirs; |
34
|
|
|
// for each file or directory in list - check permissions |
35
|
|
|
foreach ($this->_chmodDirs as $object) { |
36
|
|
|
if (Str::endsWith('.php', $object)) { // sounds like a file |
37
|
|
|
$this->chmodCheck[$object] = (File::exist($object) && File::writable($object)); |
38
|
|
|
} else { |
39
|
|
|
$this->chmodCheck[$object] = (Directory::exist($object) && Directory::writable($object)); |
|
|
|
|
40
|
|
|
} |
41
|
|
|
} |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Check php version |
46
|
|
|
* @return bool |
47
|
|
|
*/ |
48
|
|
|
public function checkPhpVersion() |
49
|
|
|
{ |
50
|
|
|
return version_compare($this->phpVersion, '5.4', '>='); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Check all params |
55
|
|
|
* @return bool |
56
|
|
|
*/ |
57
|
|
|
public function checkAll() |
58
|
|
|
{ |
59
|
|
|
return $this->checkPhpVersion() && $this->pdo && $this->gd && !Arr::in(false, $this->chmodCheck); |
|
|
|
|
60
|
|
|
} |
61
|
|
|
} |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.