1 | <?php |
||
22 | class Elasticdump extends Abstraction implements Executable |
||
23 | { |
||
24 | /** |
||
25 | * Host to connect to |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | private $host; |
||
30 | |||
31 | /** |
||
32 | * User to connect with |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | private $user; |
||
37 | |||
38 | /** |
||
39 | * Password to authenticate with |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | private $password; |
||
44 | |||
45 | /** |
||
46 | * Specific index to backup |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | private $index; |
||
51 | |||
52 | /** |
||
53 | * Whether to backup the mapping or data |
||
54 | * --type |
||
55 | * |
||
56 | * @var string |
||
57 | */ |
||
58 | private $type; |
||
59 | |||
60 | /** |
||
61 | * File to dump to. |
||
62 | * |
||
63 | * @var string |
||
64 | */ |
||
65 | private $dumpPathname; |
||
66 | |||
67 | /** |
||
68 | * Constructor. |
||
69 | * |
||
70 | * @param string $path |
||
71 | 12 | */ |
|
72 | public function __construct($path = null) |
||
77 | |||
78 | /** |
||
79 | * Set host to get data from. |
||
80 | * |
||
81 | * @param string $host |
||
82 | * @return \phpbu\App\Cli\Executable\Elasticdump |
||
83 | 11 | */ |
|
84 | public function useHost($host) |
||
89 | |||
90 | /** |
||
91 | * Set index to dump. |
||
92 | * |
||
93 | * @param string $index |
||
94 | * @return \phpbu\App\Cli\Executable\Elasticdump |
||
95 | 4 | */ |
|
96 | public function dumpIndex($index) |
||
101 | |||
102 | /** |
||
103 | * Set dump type. |
||
104 | * |
||
105 | * @param string $type |
||
106 | * @return \phpbu\App\Cli\Executable\Elasticdump |
||
107 | 4 | */ |
|
108 | public function dumpType($type) |
||
113 | |||
114 | /** |
||
115 | * Set file to dump to. |
||
116 | * |
||
117 | * @param string $pathname |
||
118 | * @return \phpbu\App\Cli\Executable\Elasticdump |
||
119 | 10 | */ |
|
120 | public function dumpTo($pathname) |
||
125 | |||
126 | /** |
||
127 | * Set elastic credentials. |
||
128 | * |
||
129 | * @param string $user |
||
130 | * @param string $password |
||
131 | * @return \phpbu\App\Cli\Executable\Elasticdump |
||
132 | 5 | */ |
|
133 | public function credentials($user = null, $password = null) |
||
139 | |||
140 | /** |
||
141 | * Subclass Process generator. |
||
142 | * |
||
143 | * @return \phpbu\App\Cli\Process |
||
144 | * @throws \phpbu\App\Exception |
||
145 | 12 | */ |
|
146 | protected function createProcess() |
||
165 | 10 | ||
166 | 10 | /** |
|
167 | * Create a elastic node url. |
||
168 | 10 | * |
|
169 | * @param string $host |
||
170 | * @param string $user |
||
171 | * @param string $password |
||
172 | * @param string $index |
||
173 | * @return string |
||
174 | */ |
||
175 | private function generateNodeUrl($host, $user = null, $password = null, $index = null) |
||
202 | 10 | ||
203 | 3 | /** |
|
204 | 3 | * Generate user password url snippet |
|
205 | * |
||
206 | 10 | * @param string $user |
|
207 | * @param string $password |
||
208 | 10 | * @return string |
|
209 | 10 | */ |
|
210 | 10 | protected function getAuthUrlSnippet($user, $password) |
|
224 | } |
||
225 |