PluginProbe
UpdraftPlus: WP Backup & Migration Plugin / 1.12.4
UpdraftPlus: WP Backup & Migration Plugin v1.12.4
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 / methods / s3generic.php

s3generic.php in UpdraftPlus: WP Backup & Migration Plugin 1.12.4, at methods/s3generic.php

57 lines 2.2 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 direct access allowed.');
4
5 require_once(UPDRAFTPLUS_DIR.'/methods/s3.php');
6
7 # Migrate options to new-style storage - Jan 2014
8 if (!is_array(UpdraftPlus_Options::get_updraft_option('updraft_s3generic')) && '' != UpdraftPlus_Options::get_updraft_option('updraft_s3generic_login', '')) {
9 $opts = array(
10 'accesskey' => UpdraftPlus_Options::get_updraft_option('updraft_s3generic_login'),
11 'secretkey' => UpdraftPlus_Options::get_updraft_option('updraft_s3generic_pass'),
12 'path' => UpdraftPlus_Options::get_updraft_option('updraft_s3generic_remote_path'),
13 'endpoint' => UpdraftPlus_Options::get_updraft_option('updraft_s3generic_endpoint')
14 );
15 UpdraftPlus_Options::update_updraft_option('updraft_s3generic', $opts);
16 UpdraftPlus_Options::delete_updraft_option('updraft_s3generic_login');
17 UpdraftPlus_Options::delete_updraft_option('updraft_s3generic_pass');
18 UpdraftPlus_Options::delete_updraft_option('updraft_s3generic_remote_path');
19 UpdraftPlus_Options::delete_updraft_option('updraft_s3generic_endpoint');
20 }
21
22 class UpdraftPlus_BackupModule_s3generic extends UpdraftPlus_BackupModule_s3 {
23
24 protected function set_region($obj, $region = '', $bucket_name = '') {
25 $config = $this->get_config();
26 $endpoint = ($region != '' && $region != 'n/a') ? $region : $config['endpoint'];
27 global $updraftplus;
28 $updraftplus->log("Set endpoint: $endpoint");
29 $obj->setEndpoint($endpoint);
30 }
31
32 public function get_credentials() {
33 return array('updraft_s3generic');
34 }
35
36 protected function get_config() {
37 global $updraftplus;
38 $opts = $updraftplus->get_job_option('updraft_s3generic');
39 if (!is_array($opts)) $opts = array('accesskey' => '', 'secretkey' => '', 'path' => '');
40 $opts['whoweare'] = 'S3';
41 $opts['whoweare_long'] = __('S3 (Compatible)', 'updraftplus');
42 $opts['key'] = 's3generic';
43 return $opts;
44 }
45
46 public function config_print() {
47 // 5th parameter = control panel URL
48 // 6th = image HTML
49 $this->config_print_engine('s3generic', 'S3', __('S3 (Compatible)', 'updraftplus'), 'S3', '', '', true);
50 }
51
52 public function credentials_test($posted_settings) {
53 $this->credentials_test_engine($this->get_config(), $posted_settings);
54 }
55
56 }
57