|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Created by PhpStorm. |
|
4
|
|
|
* User: joshgulledge |
|
5
|
|
|
* Date: 2/15/18 |
|
6
|
|
|
* Time: 2:21 PM |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace LCI\Blend\Console; |
|
10
|
|
|
|
|
11
|
|
|
use modX; |
|
|
|
|
|
|
12
|
|
|
use LCI\Blend\Blender; |
|
13
|
|
|
use LCI\MODX\Console\Command\BaseCommand as Command; |
|
14
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
15
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Class BaseCommand |
|
19
|
|
|
* |
|
20
|
|
|
* @package LCI\Blend\Console\BaseCommand |
|
21
|
|
|
*/ |
|
22
|
|
|
abstract class BaseCommand extends Command |
|
23
|
|
|
{ |
|
24
|
|
|
/** @var \modX $modx */ |
|
25
|
|
|
protected $modx; |
|
26
|
|
|
|
|
27
|
|
|
/** @var \LCI\Blend\Blender */ |
|
28
|
|
|
protected $blender; |
|
29
|
|
|
|
|
30
|
|
|
protected $loadMODX = true; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Initializes the command just after the input has been validated. |
|
34
|
|
|
* |
|
35
|
|
|
* This is mainly useful when a lot of commands extends one main command |
|
36
|
|
|
* where some things need to be initialized based on the input arguments and options. |
|
37
|
|
|
* |
|
38
|
|
|
* @param InputInterface $input An InputInterface instance |
|
39
|
|
|
* @param OutputInterface $output An OutputInterface instance |
|
40
|
|
|
*/ |
|
41
|
|
|
public function initialize(InputInterface $input, OutputInterface $output) |
|
42
|
|
|
{ |
|
43
|
|
|
parent::initialize($input, $output); |
|
44
|
|
|
|
|
45
|
|
|
if ($this->loadMODX) { |
|
46
|
|
|
$this->modx = $this->console->loadMODX(); |
|
47
|
|
|
|
|
48
|
|
|
$this->blender = new Blender( |
|
49
|
|
|
$this->modx, |
|
50
|
|
|
$this->consoleUserInteractionHandler, |
|
51
|
|
|
[ |
|
52
|
|
|
// @TODO rename: |
|
53
|
|
|
'blend_modx_migration_dir' => BLEND_MY_MIGRATION_PATH, |
|
|
|
|
|
|
54
|
|
|
] |
|
55
|
|
|
); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
|
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
// @TODO remove |
|
62
|
|
|
public function loadModxInstall() |
|
63
|
|
|
{ |
|
64
|
|
|
/* to validate installation, instantiate the modX class and run a few tests */ |
|
65
|
|
|
if (include_once (M_CORE_PATH . 'model/modx/modx.class.php')) { |
|
|
|
|
|
|
66
|
|
|
$modx = new modX(M_CORE_PATH . 'config/', [ |
|
67
|
|
|
\xPDO::OPT_SETUP => true, |
|
|
|
|
|
|
68
|
|
|
]); |
|
69
|
|
|
|
|
70
|
|
|
if (!is_object($modx) || !($modx instanceof modX)) { |
|
71
|
|
|
$errors[] = '<p>'.$this->lexicon('modx_err_instantiate').'</p>'; |
|
|
|
|
|
|
72
|
|
|
} else { |
|
73
|
|
|
$modx->setLogTarget(array( |
|
74
|
|
|
'target' => 'FILE', |
|
75
|
|
|
'options' => array( |
|
76
|
|
|
'filename' => 'install.' . MODX_CONFIG_KEY . '.' . strftime('%Y%m%dT%H%M%S') . '.log' |
|
|
|
|
|
|
77
|
|
|
) |
|
78
|
|
|
)); |
|
79
|
|
|
|
|
80
|
|
|
/* try to initialize the mgr context */ |
|
81
|
|
|
$modx->initialize('mgr'); |
|
82
|
|
|
if (!$modx->isInitialized()) { |
|
83
|
|
|
$errors[] = '<p>'.$this->lexicon('modx_err_instantiate_mgr').'</p>'; |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
} else { |
|
87
|
|
|
$errors[] = '<p>'.$this->lexicon('modx_class_err_nf').'</p>'; |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|
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