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