1 | <?php |
||
20 | class Mongodump extends Abstraction implements Executable |
||
21 | { |
||
22 | /** |
||
23 | * Dump Directory |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | private $dumpDir; |
||
28 | |||
29 | /** |
||
30 | * Use IPv6 |
||
31 | * --ipv6 |
||
32 | * |
||
33 | * @var boolean |
||
34 | */ |
||
35 | private $useIPv6; |
||
36 | |||
37 | /** |
||
38 | * Host to connect to |
||
39 | * --host <hostname:port> |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | private $host; |
||
44 | |||
45 | /** |
||
46 | * User to connect with |
||
47 | * --user <username> |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | private $user; |
||
52 | |||
53 | /** |
||
54 | * Password to authenticate with |
||
55 | * --password <password> |
||
56 | * |
||
57 | * @var string |
||
58 | */ |
||
59 | private $password; |
||
60 | |||
61 | /** |
||
62 | * Database to use for authentication |
||
63 | * --authenticationDatabase <dbname> |
||
64 | * |
||
65 | * @var string |
||
66 | */ |
||
67 | private $authenticationDatabase; |
||
68 | |||
69 | /** |
||
70 | * List of databases to backup |
||
71 | * --db <database> |
||
72 | * |
||
73 | * @var array |
||
74 | */ |
||
75 | private $databases; |
||
76 | |||
77 | /** |
||
78 | * List of collections to backup |
||
79 | * --collection <collection> |
||
80 | * |
||
81 | * @var array |
||
82 | */ |
||
83 | private $collections; |
||
84 | |||
85 | /** |
||
86 | * List of collections to ignore |
||
87 | * --excludeCollections array of strings |
||
88 | * |
||
89 | * @var array |
||
90 | */ |
||
91 | private $excludeCollections; |
||
92 | |||
93 | /** |
||
94 | * List of prefixes to exclude collections |
||
95 | * --excludeCollectionWithPrefix array of strings |
||
96 | * |
||
97 | * @var array |
||
98 | */ |
||
99 | private $excludeCollectionsWithPrefix; |
||
100 | |||
101 | /** |
||
102 | * Constructor. |
||
103 | * |
||
104 | * @param string $path |
||
105 | */ |
||
106 | 12 | public function __construct($path = null) |
|
111 | |||
112 | /** |
||
113 | * Set path to dump to. |
||
114 | * |
||
115 | * @param string $path |
||
116 | * @return \phpbu\App\Cli\Executable\Mongodump |
||
117 | */ |
||
118 | 11 | public function dumpToDirectory($path) |
|
123 | |||
124 | /** |
||
125 | * Use ipv6 to connect. |
||
126 | * |
||
127 | * @param boolean $bool |
||
128 | * @return \phpbu\App\Cli\Executable\Mongodump |
||
129 | */ |
||
130 | 2 | public function useIpv6($bool) |
|
135 | |||
136 | /** |
||
137 | * Set host to dump from. |
||
138 | * |
||
139 | * @param string $host |
||
140 | * @return \phpbu\App\Cli\Executable\Mongodump |
||
141 | */ |
||
142 | 2 | public function useHost($host) |
|
147 | |||
148 | /** |
||
149 | * Set credentials. |
||
150 | * |
||
151 | * @param string $user |
||
152 | * @param string $password |
||
153 | * @param string $authDatabase |
||
154 | * @return \phpbu\App\Cli\Executable\Mongodump |
||
155 | */ |
||
156 | 3 | public function credentials($user = null, $password = null, $authDatabase = null) |
|
163 | |||
164 | /** |
||
165 | * Dump only given databases. |
||
166 | * |
||
167 | * @param array $databases |
||
168 | * @return \phpbu\App\Cli\Executable\Mongodump |
||
169 | */ |
||
170 | 2 | public function dumpDatabases(array $databases) |
|
175 | |||
176 | /** |
||
177 | * Dump only given collections. |
||
178 | * |
||
179 | * @param array $collections |
||
180 | * @return \phpbu\App\Cli\Executable\Mongodump |
||
181 | */ |
||
182 | 2 | public function dumpCollections(array $collections) |
|
187 | |||
188 | /** |
||
189 | * Exclude collections. |
||
190 | * |
||
191 | * @param array $collections |
||
192 | * @return \phpbu\App\Cli\Executable\Mongodump |
||
193 | */ |
||
194 | 2 | public function excludeCollections(array $collections) |
|
199 | |||
200 | /** |
||
201 | * Exclude collections with given prefixes. |
||
202 | * |
||
203 | * @param array $prefixes |
||
204 | * @return \phpbu\App\Cli\Executable\Mongodump |
||
205 | */ |
||
206 | 2 | public function excludeCollectionsWithPrefix(array $prefixes) |
|
211 | |||
212 | /** |
||
213 | * Subclass Process generator. |
||
214 | * |
||
215 | * @return \phpbu\App\Cli\Process |
||
216 | * @throws \phpbu\App\Exception |
||
217 | */ |
||
218 | 12 | protected function createProcess() |
|
251 | } |
||
252 |