-
Notifications
You must be signed in to change notification settings - Fork 0
/
core-version.php
36 lines (29 loc) · 1.13 KB
/
core-version.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
* @author Taras Shkodenko <[email protected]>
* @copyright Shkodenko V. Taras, https://www.shkodenko.com/
*/
namespace podlom\wpCliUpdater;
require_once 'src/_autoload.php';
$environents = require_once 'config/environments.php';
if (empty($environents) && !is_array($environents)) {
echo 'Error: empty config/environments.php' . PHP_EOL;
exit(1);
}
$envId = 0;
if (isset($argv[1]) && !empty($argv[1])) {
$envId = intval($argv[1]);
}
if ($envId > 0) {
echo __FILE__ . ' +' . __LINE__ . ' $envId: ' . var_export($envId, true) . ' (' . $environents[$envId][1] . ')' . PHP_EOL;
if (isset($environents[$envId])) {
$env = new Environment($environents[$envId][0], $environents[$envId][1], $environents[$envId][2], $environents[$envId][3], $environents[$envId][4], $environents[$envId][5]);
$command = new ShellCoreVersionCommand("/usr/local/bin/wp core version", $env);
$command->execute();
} else {
echo 'Error: requested evirontment ID was not found in config/environments.php' . PHP_EOL;
exit(2);
}
} else {
echo 'Usage: php ' . $argv[0] . ' envID' . PHP_EOL;
}