1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Sunnysideup\UpgradeToSilverstripe4\Tasks\IndividualTasks; |
4
|
|
|
|
5
|
|
|
use Sunnysideup\UpgradeToSilverstripe4\Tasks\Task; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Runs the silverstripe/upgrade task "inspect". See: |
9
|
|
|
* https://github.com/silverstripe/silverstripe-upgrader#inspect. |
10
|
|
|
* Once a project has all class names migrated, and is brought up to a |
11
|
|
|
* "loadable" state (that is, where all classes reference or extend real classes) |
12
|
|
|
* then the inspect command can be run to perform additional automatic code rewrites. |
13
|
|
|
* This step will also warn of any upgradable code issues that may prevent a succesful upgrade. |
14
|
|
|
*/ |
15
|
|
|
class InspectAPIChanges extends Task |
16
|
|
|
{ |
17
|
|
|
protected $taskStep = 's50'; |
18
|
|
|
|
19
|
|
|
protected $param1 = ''; |
20
|
|
|
|
21
|
|
|
protected $param2 = ''; |
22
|
|
|
|
23
|
|
|
protected $rootDirForCommand = ''; |
24
|
|
|
|
25
|
|
|
protected $settings = ''; |
26
|
|
|
|
27
|
|
|
public function getTitle() |
28
|
|
|
{ |
29
|
|
|
return 'After load fixes (inspect)'; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function getDescription() |
33
|
|
|
{ |
34
|
|
|
return ' |
35
|
|
|
Runs the silverstripe/upgrade task "inspect". See: |
36
|
|
|
https://github.com/silverstripe/silverstripe-upgrader#inspect. |
37
|
|
|
Once a project has all class names migrated, and is brought up to a |
38
|
|
|
"loadable" state (that is, where all classes reference or extend real classes) |
39
|
|
|
then the inspect command can be run to perform additional automatic code rewrites. |
40
|
|
|
This step will also warn of any upgradable code issues that may prevent a succesful upgrade.'; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function runActualTask($params = []): ?string |
44
|
|
|
{ |
45
|
|
|
$this->mu()->execMe( |
|
|
|
|
46
|
|
|
$this->mu()->getWebRootDirLocation(), |
|
|
|
|
47
|
|
|
'composer dump-autoload', |
48
|
|
|
'run composer dump-autoload to create autoload classes', |
49
|
|
|
false |
50
|
|
|
); |
51
|
|
|
|
52
|
|
|
$this->mu()->setBreakOnAllErrors(true); |
53
|
|
|
|
54
|
|
|
foreach ($this->mu()->findNameSpaceAndCodeDirs() as $codeDir) { |
55
|
|
|
$rootDir = ''; |
56
|
|
|
if ($this->mu()->getIsModuleUpgrade()) { |
57
|
|
|
$dirToRun = $codeDir; |
58
|
|
|
} else { |
59
|
|
|
$dirToRun = dirname($codeDir); |
60
|
|
|
} |
61
|
|
|
$this->runSilverstripeUpgradeTask( |
62
|
|
|
'inspect', |
63
|
|
|
$this->param1 = $dirToRun, |
64
|
|
|
$this->param2 = '', |
65
|
|
|
$rootDir, |
66
|
|
|
$this->settings |
67
|
|
|
); |
68
|
|
|
$this->setCommitMessage('API: core upgrade to SS4: running INSPECT on ' . $this->param1); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
$this->mu()->setBreakOnAllErrors(false); |
72
|
|
|
return null; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
protected function hasCommitAndPush() |
76
|
|
|
{ |
77
|
|
|
return true; |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|