-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
77 lines (60 loc) · 1.67 KB
/
index.php
File metadata and controls
77 lines (60 loc) · 1.67 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
require __DIR__ . '/vendor/autoload.php';
use Symfony\Component\Yaml\Yaml;
// Determine if script is run from the command line
$isCommandLine = false;
if(count($argv)){
$isCommandLine = true;
}
if($isCommandLine){
// Define our commands
$commandMapping = array(
'' => 'help',
'help' => 'help',
'-help' => 'help',
'--help' => 'help',
'ssh' => 'ssh',
'list' => 'list',
'updates' => 'updates',
'mod' => 'module',
'module' => 'module',
'mod_search' => 'module',
'module_search' => 'module',
);
// Decide which command we're running
$command = $commandMapping[$argv[1]];
// Help command
if($command == 'help'){
print 'php index.php ssh [site id] "[ssh command]"'."\n";
print 'php index.php list'."\n";
print 'php index.php updates [dashboard password]'."\n";
print 'php index.php module_search [module machine name] [dashboard password]'."\n";
}
// SSH command
elseif($command == 'ssh'){
$pantheonWrapper = new PantheonWrapper();
$commandResponse = $pantheonWrapper->sshCommand($argv[2],$argv[3]);
print_r($commandResponse);
}
// List command
elseif($command == 'list'){
$pantheonWrapper = new PantheonWrapper();
$sites = $pantheonWrapper->getSites();
print_r($sites);
}
// Get Updates
elseif($command == 'updates'){
$pantheonWrapper = new PantheonWrapper();
$results = $pantheonWrapper->getUpdates($argv[2]);
print_r($results);
}
// Module Search
elseif($command == 'module'){
$pantheonWrapper = new PantheonWrapper();
$results = $pantheonWrapper->getSitesWithModule($argv[2],$argv[3]);
print_r($results);
}
}else{
print 'This is a command line utility intended to be run with the php command.';
}
?>