|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Created by PhpStorm. |
|
4
|
|
|
* User: jgulledge |
|
5
|
|
|
* Date: 11/10/2017 |
|
6
|
|
|
* Time: 5:49 AM |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace LCI\Blend; |
|
10
|
|
|
|
|
11
|
|
|
abstract class Migrations |
|
12
|
|
|
{ |
|
13
|
|
|
/** @var \modX */ |
|
|
|
|
|
|
14
|
|
|
protected $modx; |
|
15
|
|
|
|
|
16
|
|
|
/** @var Blender */ |
|
17
|
|
|
protected $blender; |
|
18
|
|
|
|
|
19
|
|
|
/** @var string ~ a description of what this migration will do */ |
|
20
|
|
|
protected $description = ''; |
|
21
|
|
|
|
|
22
|
|
|
/** @var string ~ a version number if you choose */ |
|
23
|
|
|
protected $version = ''; |
|
24
|
|
|
|
|
25
|
|
|
/** @var string ~ master|staging|dev|local */ |
|
26
|
|
|
protected $type = 'master'; |
|
27
|
|
|
|
|
28
|
|
|
/** @var string ~ will be for any seeds to find their related directory */ |
|
29
|
|
|
protected $seeds_dir = ''; |
|
30
|
|
|
|
|
31
|
|
|
/** @var string name of Author of the Migration */ |
|
32
|
|
|
protected $author = ''; |
|
33
|
|
|
|
|
34
|
|
|
/** @var string */ |
|
35
|
|
|
protected $method = 'up'; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Migrations constructor. |
|
39
|
|
|
* |
|
40
|
|
|
* @param $modx |
|
41
|
|
|
* @param Blender $blender |
|
42
|
|
|
*/ |
|
43
|
|
|
public function __construct(\modX &$modx, Blender $blender) |
|
44
|
|
|
{ |
|
45
|
|
|
$this->modx = $modx; |
|
46
|
|
|
$this->blender = $blender; |
|
47
|
|
|
|
|
48
|
|
|
$this->assignDescription(); |
|
49
|
|
|
$this->assignVersion(); |
|
50
|
|
|
$this->assignType(); |
|
51
|
|
|
$this->assignSeedsDir(); |
|
52
|
|
|
} |
|
53
|
|
|
/** |
|
54
|
|
|
* Run the migrations. |
|
55
|
|
|
* |
|
56
|
|
|
* @return void |
|
57
|
|
|
*/ |
|
58
|
|
|
public function up() |
|
59
|
|
|
{ |
|
60
|
|
|
// Child class needs to override and implement this |
|
61
|
|
|
$this->modx->log( |
|
62
|
|
|
modX::LOG_LEVEL_ERROR, |
|
|
|
|
|
|
63
|
|
|
get_class($this).'::'.__METHOD__.PHP_EOL. |
|
64
|
|
|
'Did not implement up()' |
|
65
|
|
|
); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* Reverse the migrations. |
|
70
|
|
|
* |
|
71
|
|
|
* @return void |
|
72
|
|
|
*/ |
|
73
|
|
|
public function down() |
|
74
|
|
|
{ |
|
75
|
|
|
$this->method = 'down'; |
|
76
|
|
|
|
|
77
|
|
|
// Child class needs to override and implement this |
|
78
|
|
|
$this->modx->log( |
|
79
|
|
|
modX::LOG_LEVEL_ERROR, |
|
80
|
|
|
get_class($this).'::'.__METHOD__.PHP_EOL. |
|
81
|
|
|
'Did not implement down()' |
|
82
|
|
|
); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* @return string |
|
87
|
|
|
*/ |
|
88
|
|
|
public function getAuthor() |
|
89
|
|
|
{ |
|
90
|
|
|
return $this->author; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* @return string |
|
95
|
|
|
*/ |
|
96
|
|
|
public function getDescription() |
|
97
|
|
|
{ |
|
98
|
|
|
return (string)$this->description; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* @return string |
|
103
|
|
|
*/ |
|
104
|
|
|
public function getVersion() |
|
105
|
|
|
{ |
|
106
|
|
|
return (string)$this->version; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* @return string |
|
111
|
|
|
*/ |
|
112
|
|
|
public function getType() |
|
113
|
|
|
{ |
|
114
|
|
|
return $this->type; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* @return string use setSeedsDir |
|
119
|
|
|
*/ |
|
120
|
|
|
public function getSeedsDir() |
|
121
|
|
|
{ |
|
122
|
|
|
return $this->seeds_dir; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* Method is called on construct, Child class needs to override and implement this |
|
127
|
|
|
*/ |
|
128
|
|
|
protected function assignDescription() |
|
129
|
|
|
{ |
|
130
|
|
|
$this->description = ''; |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
/** |
|
134
|
|
|
* Method is called on construct, Child class needs to override and implement this |
|
135
|
|
|
*/ |
|
136
|
|
|
protected function assignVersion() |
|
137
|
|
|
{ |
|
138
|
|
|
$this->version = ''; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
/** |
|
142
|
|
|
* Method is called on construct, Child class can override and implement this |
|
143
|
|
|
*/ |
|
144
|
|
|
protected function assignType() |
|
145
|
|
|
{ |
|
146
|
|
|
$this->type = 'master'; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* Method is called on construct, Child class can override and implement this |
|
151
|
|
|
*/ |
|
152
|
|
|
protected function assignSeedsDir() |
|
153
|
|
|
{ |
|
154
|
|
|
$this->seeds_dir = ''; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
} |
|
158
|
|
|
|
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