PluginProbe
UpdraftPlus: WP Backup & Migration Plugin / 1.16.5
UpdraftPlus: WP Backup & Migration Plugin v1.16.5
1.26.7 1.26.6 1.26.5 1.26.4 1.26.3 1.9.19 1.9.25 1.9.26 1.9.30 1.9.31 1.9.32 1.9.4 1.9.40 1.9.41 1.9.42 1.9.43 1.9.44 1.9.45 1.9.46 1.9.5 1.9.50 1.9.51 1.9.60 1.9.62 1.9.63 All 371 releases
updraftplus / includes / updraftvault.php

updraftvault.php in UpdraftPlus: WP Backup & Migration Plugin 1.16.5, at includes/updraftvault.php

47 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('UPDRAFTPLUS_DIR')) die('No access.');
4
5 /**
6 * Handles UpdraftVault Commands to pull Amazon S3 Bucket credentials
7 * from user's UpdraftVault and some default filters for per page display
8 *
9 * @method array get_credentials()
10 */
11 class UpdraftCentral_UpdraftVault_Commands extends UpdraftCentral_Commands {
12
13 /**
14 * Gets the Amazon S3 Credentials
15 *
16 * Extract the needed credentials to connect to the user's Amazon S3 Bucket
17 * by pulling this info from the UpdraftVault server.
18 *
19 * @return array $result - An array containing the Amazon S3 settings/config if successful,
20 * otherwise, it will contain the error details/info of the generated error.
21 */
22 public function get_credentials() {
23 global $updraftplus;
24
25 $storage_objects_and_ids = UpdraftPlus_Storage_Methods_Interface::get_storage_objects_and_ids(array('updraftvault'));
26
27 // UpdraftVault isn't expected to have multiple options currently, so we just grab the first instance_id in the settings and use the options from that. If in future we do decide we want to make UpdraftVault multiple options then we will need to update this part of the code e.g a instance_id needs to be passed in and used by the following lines of code.
28 if (isset($storage_objects_and_ids['updraftvault']['instance_settings'])) {
29 $instance_id = key($storage_objects_and_ids['updraftvault']['instance_settings']);
30 $opts = $storage_objects_and_ids['updraftvault']['instance_settings'][$instance_id];
31 $vault = $storage_objects_and_ids['updraftvault']['object'];
32 $vault->set_options($opts, false, $instance_id);
33 } else {
34 if (!class_exists('UpdraftPlus_BackupModule_updraftvault')) include_once(UPDRAFTPLUS_DIR.'/methods/updraftvault.php');
35 $vault = new UpdraftPlus_BackupModule_updraftvault();
36 }
37
38 $result = $vault->get_config();
39
40 if (isset($result['error']) && !empty($result['error'])) {
41 $result = array('error' => true, 'message' => $result['error']['message'], 'values' => $result['error']['values']);
42 }
43
44 return $this->_response($result);
45 }
46 }
47