addon-base-v2.php
6 years ago
addon-not-yet-present.php
6 years ago
azure.php
8 years ago
backblaze.php
8 years ago
backup-module.php
6 years ago
cloudfiles-new.php
6 years ago
cloudfiles.php
6 years ago
dreamobjects.php
7 years ago
dropbox.php
6 years ago
email.php
6 years ago
ftp.php
6 years ago
googlecloud.php
8 years ago
googledrive.php
6 years ago
insufficient.php
6 years ago
onedrive.php
8 years ago
openstack-base.php
6 years ago
openstack.php
8 years ago
openstack2.php
6 years ago
remotesend.php
6 years ago
s3.php
6 years ago
s3generic.php
7 years ago
sftp.php
8 years ago
template.php
6 years ago
updraftvault.php
6 years ago
webdav.php
8 years ago
insufficient.php
129 lines
| 1 | <?php |
| 2 | |
| 3 | if (!defined('UPDRAFTPLUS_DIR')) die('No direct access allowed.'); |
| 4 | |
| 5 | if (!class_exists('UpdraftPlus_BackupModule')) require_once(UPDRAFTPLUS_DIR.'/methods/backup-module.php'); |
| 6 | |
| 7 | class UpdraftPlus_BackupModule_insufficientphp extends UpdraftPlus_BackupModule { |
| 8 | |
| 9 | private $required_php; |
| 10 | |
| 11 | private $error_msg; |
| 12 | |
| 13 | private $method; |
| 14 | |
| 15 | public function __construct($method, $desc, $php, $image = null) { |
| 16 | $this->method = $method; |
| 17 | $this->desc = $desc; |
| 18 | $this->required_php = $php; |
| 19 | $this->image = $image; |
| 20 | $this->error_msg = 'This remote storage method ('.$this->desc.') requires PHP '.$this->required_php.' or later'; |
| 21 | $this->error_msg_trans = sprintf(__('This remote storage method (%s) requires PHP %s or later.', 'updraftplus'), $this->desc, $this->required_php); |
| 22 | } |
| 23 | |
| 24 | private function log_error() { |
| 25 | global $updraftplus; |
| 26 | $updraftplus->log($this->error_msg); |
| 27 | $updraftplus->log($this->error_msg_trans, 'error', 'insufficientphp'); |
| 28 | return false; |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * backup method: takes an array, and shovels them off to the cloud storage |
| 33 | * |
| 34 | * @param array $backup_array An array backups |
| 35 | * @return array |
| 36 | */ |
| 37 | public function backup($backup_array) {// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 38 | return $this->log_error(); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Retrieve a list of supported features for this storage method |
| 43 | * |
| 44 | * Currently known features: |
| 45 | * |
| 46 | * - multi_options : indicates that the remote storage module |
| 47 | * can handle its options being in the Feb-2017 multi-options |
| 48 | * format. N.B. This only indicates options handling, not any |
| 49 | * other multi-destination options. |
| 50 | * |
| 51 | * - multi_servers : not implemented yet: indicates that the |
| 52 | * remote storage module can handle multiple servers at backup |
| 53 | * time. This should not be specified without multi_options. |
| 54 | * multi_options without multi_servers is fine - it will just |
| 55 | * cause only the first entry in the options array to be used. |
| 56 | * |
| 57 | * - config_templates : not implemented yet: indicates that |
| 58 | * the remote storage module can output its configuration in |
| 59 | * Handlebars format via the get_configuration_template() method. |
| 60 | * |
| 61 | * @return Array - an array of supported features (any features not |
| 62 | * mentioned are assumed to not be supported) |
| 63 | */ |
| 64 | public function get_supported_features() { |
| 65 | // The 'multi_options' options format is handled via only accessing options via $this->get_options() |
| 66 | return array('multi_options', 'config_templates'); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * $match: a substring to require (tested via strpos() !== false) |
| 71 | * |
| 72 | * @param string $match THis will specify which match is used for the SQL but by default it is set to 'backup_' unless specified |
| 73 | * @return array |
| 74 | */ |
| 75 | public function listfiles($match = 'backup_') {// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 76 | return new WP_Error('insufficient_php', $this->error_msg_trans); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * delete method: takes an array of file names (base name) or a single string, and removes them from the cloud storage |
| 81 | * |
| 82 | * @param string $files List of files |
| 83 | * @param boolean $data Specifies data or not |
| 84 | * @param array $sizeinfo This is the size info on the file. |
| 85 | * @return array |
| 86 | */ |
| 87 | public function delete($files, $data = false, $sizeinfo = array()) {// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 88 | return $this->log_error(); |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * download method: takes a file name (base name), and brings it back from the cloud storage into Updraft's directory |
| 93 | * You can register errors with $updraftplus->log("my error message", 'error') |
| 94 | * |
| 95 | * @param string $file List of files |
| 96 | * @return array |
| 97 | */ |
| 98 | public function download($file) {// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 99 | return $this->log_error(); |
| 100 | } |
| 101 | |
| 102 | private function extra_config() { |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * Get the configuration template |
| 107 | * |
| 108 | * @return String - the template, ready for substitutions to be carried out |
| 109 | */ |
| 110 | public function get_configuration_template() { |
| 111 | ob_start(); |
| 112 | $this->extra_config(); |
| 113 | ?> |
| 114 | <tr class="updraftplusmethod <?php echo $this->method;?>"> |
| 115 | <th><?php echo htmlspecialchars($this->desc);?>:</th> |
| 116 | <td> |
| 117 | <em> |
| 118 | <?php echo (!empty($this->image)) ? '<p><img src="'.UPDRAFTPLUS_URL.'/images/'.$this->image.'"></p>' : ''; ?> |
| 119 | <?php echo htmlspecialchars($this->error_msg_trans);?> |
| 120 | <?php echo htmlspecialchars(__('You will need to ask your web hosting company to upgrade.', 'updraftplus'));?> |
| 121 | <?php echo sprintf(__('Your %s version: %s.', 'updraftplus'), 'PHP', phpversion());?> |
| 122 | </em> |
| 123 | </td> |
| 124 | </tr> |
| 125 | <?php |
| 126 | return ob_get_clean(); |
| 127 | } |
| 128 | } |
| 129 |