|
1
|
|
|
<?php namespace Comodojo\Installer\Actions; |
|
2
|
|
|
|
|
3
|
|
|
use Composer\Composer; |
|
4
|
|
|
use Composer\IO\IOInterface; |
|
5
|
|
|
use Comodojo\Configuration\Installer as PackageInstaller; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* |
|
9
|
|
|
* |
|
10
|
|
|
* @package Comodojo Framework |
|
11
|
|
|
* @author Marco Giovinazzi <[email protected]> |
|
12
|
|
|
* @author Marco Castiello <[email protected]> |
|
13
|
|
|
* @license GPL-3.0+ |
|
14
|
|
|
* |
|
15
|
|
|
* LICENSE: |
|
16
|
|
|
* |
|
17
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
18
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
19
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
20
|
|
|
* License, or (at your option) any later version. |
|
21
|
|
|
* |
|
22
|
|
|
* This program is distributed in the hope that it will be useful, |
|
23
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
24
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
25
|
|
|
* GNU Affero General Public License for more details. |
|
26
|
|
|
* |
|
27
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
28
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
29
|
|
|
*/ |
|
30
|
|
|
|
|
31
|
|
|
abstract class AbstractAction implements ActionInterface { |
|
32
|
|
|
|
|
33
|
|
|
private $composer; |
|
34
|
|
|
|
|
35
|
|
|
private $io; |
|
36
|
|
|
|
|
37
|
|
|
private $path; |
|
38
|
|
|
|
|
39
|
|
|
private $package_installer; |
|
40
|
|
|
|
|
41
|
|
|
public function __construct(Composer $composer, IOInterface $io, $package_path, PackageInstaller $package_installer) { |
|
42
|
|
|
|
|
43
|
|
|
$this->composer = $composer; |
|
44
|
|
|
|
|
45
|
|
|
$this->io = $io; |
|
46
|
|
|
|
|
47
|
|
|
$this->path = $package_path; |
|
48
|
|
|
|
|
49
|
|
|
$this->package_installer = $package_installer; |
|
50
|
|
|
|
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
abstract public function install($package_name, $package_extra); |
|
54
|
|
|
|
|
55
|
|
|
abstract public function update($package_name, $initial_extra, $target_extra); |
|
56
|
|
|
|
|
57
|
|
|
abstract public function uninstall($package_name, $package_extra); |
|
58
|
|
|
|
|
59
|
|
|
public function getIO() { |
|
60
|
|
|
|
|
61
|
|
|
return $this->io; |
|
62
|
|
|
|
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function getComposer() { |
|
66
|
|
|
|
|
67
|
|
|
return $this->composer; |
|
68
|
|
|
|
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function getPath() { |
|
72
|
|
|
|
|
73
|
|
|
return $this->path; |
|
74
|
|
|
|
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function getPackageInstaller() { |
|
78
|
|
|
|
|
79
|
|
|
return $this->package_installer; |
|
80
|
|
|
|
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
} |
|
84
|
|
|
|