1 | <?php |
||
29 | class Plugin implements PluginInterface, EventSubscriberInterface, Capable { |
||
30 | protected $composer; |
||
31 | protected $io; |
||
32 | |||
33 | /** |
||
34 | * Apply plugin modifications to Composer |
||
35 | * |
||
36 | * @param Composer $composer |
||
37 | * @param IOInterface $io |
||
38 | */ |
||
39 | public function activate(Composer $composer, IOInterface $io) { |
||
46 | |||
47 | /** |
||
48 | * @return array |
||
|
|||
49 | */ |
||
50 | public function getCapabilities() { |
||
55 | |||
56 | /** |
||
57 | * |
||
58 | * Events |
||
59 | * |
||
60 | * Command Events Composer\Script\Event |
||
61 | * |
||
62 | * pre-install-cmd occurs before the install command is executed with a lock file present. |
||
63 | * post-install-cmd occurs after the install command has been executed with a lock file present. |
||
64 | * pre-update-cmd occurs before the update command is executed, or before the install command is executed without a lock file present. |
||
65 | * post-update-cmd occurs after the update command has been executed, or after the install command has been executed without a lock file present. |
||
66 | * post-status-cmd occurs after the status command has been executed. |
||
67 | * pre-archive-cmd occurs before the archive command is executed. |
||
68 | * post-archive-cmd occurs after the archive command has been executed. |
||
69 | * pre-autoload-dump occurs before the autoloader is dumped, either during install/update, or via the dump-autoload command. |
||
70 | * post-autoload-dump occurs after the autoloader has been dumped, either during install/update, or via the dump-autoload command. |
||
71 | * post-root-package-install occurs after the root package has been installed, during the create-project command. |
||
72 | * post-create-project-cmd occurs after the create-project command has been executed. |
||
73 | * |
||
74 | * Installer Events Composer\Installer\InstallerEvent |
||
75 | * |
||
76 | * pre-dependencies-solving occurs before the dependencies are resolved. |
||
77 | * post-dependencies-solving occurs after the dependencies have been resolved. |
||
78 | * |
||
79 | * Package Events Composer\Installer\PackageEvent |
||
80 | * |
||
81 | * pre-package-install occurs before a package is installed. |
||
82 | * post-package-install occurs after a package has been installed. |
||
83 | * pre-package-update occurs before a package is updated. |
||
84 | * post-package-update occurs after a package has been updated. |
||
85 | * pre-package-uninstall occurs before a package is uninstalled. |
||
86 | * post-package-uninstall occurs after a package has been uninstalled. |
||
87 | * |
||
88 | * Plugin Events Composer\Plugin\PluginEvents |
||
89 | * |
||
90 | * init occurs after a Composer instance is done being initialized. |
||
91 | * command occurs before any Composer Command is executed on the CLI. It provides you with access to the input and output objects of the program. |
||
92 | * pre-file-download occurs before files are downloaded and allows you to manipulate the RemoteFilesystem object prior to downloading files based on the URL to be downloaded. |
||
93 | */ |
||
94 | public static function getSubscribedEvents() { |
||
101 | |||
102 | /** |
||
103 | * @param PreFileDownloadEvent $event |
||
104 | */ |
||
105 | public function onPreFileDownload(PreFileDownloadEvent $event) { |
||
113 | |||
114 | /** |
||
115 | * An event that triggers setting writable permissions on any directories specified in the writable-dirs composer extra options |
||
116 | * |
||
117 | * @param Event $event |
||
118 | * @return void |
||
119 | */ |
||
120 | public static function setPermissions(Event $event) { |
||
140 | |||
141 | /** |
||
142 | * returns a list of writeable directories specified in the writeable-dirs composer extra options |
||
143 | * |
||
144 | * @param Event $event |
||
145 | * @return array an array of directory paths |
||
146 | */ |
||
147 | public static function getWritableDirs(Event $event) { |
||
155 | |||
156 | /** |
||
157 | * Sets Writrable Directory permissions for any directories listed in the writeable-dirs option using setfacl |
||
158 | * |
||
159 | * @param Event $event |
||
160 | */ |
||
161 | public static function setPermissionsSetfacl(Event $event) { |
||
166 | |||
167 | /** |
||
168 | * Sets Writrable Directory permissions for any directories listed in the writeable-dirs option using chmod |
||
169 | * |
||
170 | * @param Event $event |
||
171 | */ |
||
172 | public static function setPermissionsChmod(Event $event) { |
||
177 | |||
178 | /** |
||
179 | * returns the user the webserver is running as |
||
180 | * |
||
181 | * @param Event $event |
||
182 | * @return string the webserver username |
||
183 | */ |
||
184 | public static function getHttpdUser(Event $event) { |
||
193 | |||
194 | /** |
||
195 | * sets the needed permissions for the $http_user and the running user on $path using setfacl |
||
196 | * |
||
197 | * @param Event $event |
||
198 | * @param string $http_user the webserver username |
||
199 | * @param string $path the directory to set permissions on |
||
200 | */ |
||
201 | public static function SetfaclPermissionsSetter(Event $event, $http_user, $path) { |
||
206 | |||
207 | /** |
||
208 | * sets the needed permissions for the $http_user and the running user on $path using chmod |
||
209 | * |
||
210 | * @param Event $event |
||
211 | * @param string $http_user the webserver username |
||
212 | * @param string $path the directory to set permissions on |
||
213 | */ |
||
214 | public static function ChmodPermissionsSetter(Event $event, $http_user, $path) { |
||
219 | |||
220 | /** |
||
221 | * checks if the given directory exists and if not tries to create it. |
||
222 | * |
||
223 | * @param Event $event |
||
224 | * @param string $path the directory |
||
225 | * @throws \Exception |
||
226 | */ |
||
227 | public static function EnsureDirExists(Event $event, $path) { |
||
236 | |||
237 | /** |
||
238 | * runs a command process returning the output and checking return code |
||
239 | * |
||
240 | * @param Event $event |
||
241 | * @param string $commandline the command line to run |
||
242 | * @return string the output |
||
243 | * @throws \Exception |
||
244 | */ |
||
245 | public static function runProcess(Event $event, $commandline) { |
||
253 | } |
||
254 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.