| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('UPDRAFTPLUS_DIR')) die('No direct access allowed.'); |
| 4 |
|
| 5 |
class UpdraftPlus_BackupModule_insufficientphp { |
| 6 |
|
| 7 |
private $required_php; |
| 8 |
private $error_msg; |
| 9 |
private $method; |
| 10 |
|
| 11 |
public function __construct($method, $desc, $php, $image = null) { |
| 12 |
$this->method = $method; |
| 13 |
$this->desc = $desc; |
| 14 |
$this->required_php = $php; |
| 15 |
$this->image = $image; |
| 16 |
$this->error_msg = 'This remote storage method ('.$this->desc.') requires PHP '.$this->required_php.' or later'; |
| 17 |
$this->error_msg_trans = sprintf(__('This remote storage method (%s) requires PHP %s or later.', 'updraftplus'), $this->desc, $this->required_php); |
| 18 |
} |
| 19 |
|
| 20 |
private function log_error() { |
| 21 |
global $updraftplus; |
| 22 |
$updraftplus->log($this->error_msg); |
| 23 |
$updraftplus->log($this->error_msg_trans, 'error', 'insufficientphp'); |
| 24 |
return false; |
| 25 |
} |
| 26 |
|
| 27 |
// backup method: takes an array, and shovels them off to the cloud storage |
| 28 |
public function backup($backup_array) { |
| 29 |
return $this->log_error(); |
| 30 |
} |
| 31 |
|
| 32 |
# $match: a substring to require (tested via strpos() !== false) |
| 33 |
public function listfiles($match = 'backup_') { |
| 34 |
return new WP_Error('insufficient_php', $this->error_msg_trans); |
| 35 |
} |
| 36 |
|
| 37 |
// delete method: takes an array of file names (base name) or a single string, and removes them from the cloud storage |
| 38 |
public function delete($files, $data = false) { |
| 39 |
return $this->log_error(); |
| 40 |
} |
| 41 |
|
| 42 |
// download method: takes a file name (base name), and brings it back from the cloud storage into Updraft's directory |
| 43 |
// You can register errors with $updraftplus->log("my error message", 'error') |
| 44 |
public function download($file) { |
| 45 |
return $this->log_error(); |
| 46 |
} |
| 47 |
|
| 48 |
private function extra_config() { |
| 49 |
} |
| 50 |
|
| 51 |
// config_print: prints out table rows for the configuration screen |
| 52 |
// Your rows need to have a class exactly matching your method (in this example, insufficientphp), and also a class of updraftplusmethod |
| 53 |
// Note that logging is not available from this context; it will do nothing. |
| 54 |
public function config_print() { |
| 55 |
|
| 56 |
$this->extra_config(); |
| 57 |
?> |
| 58 |
<tr class="updraftplusmethod <?php echo $this->method;?>"> |
| 59 |
<th><?php echo htmlspecialchars($this->desc);?>:</th> |
| 60 |
<td> |
| 61 |
<em> |
| 62 |
<?php echo ((!empty($this->image)) ? '<p><img src="'.UPDRAFTPLUS_URL.'/images/'.$this->image.'"></p>' : ''); ?> |
| 63 |
<?php echo htmlspecialchars($this->error_msg_trans);?> |
| 64 |
<?php echo htmlspecialchars(__('You will need to ask your web hosting company to upgrade.', 'updraftplus'));?> |
| 65 |
<?php echo sprintf(__('Your %s version: %s.', 'updraftplus'), 'PHP', phpversion());?> |
| 66 |
</em> |
| 67 |
</td> |
| 68 |
</tr> |
| 69 |
<?php |
| 70 |
|
| 71 |
} |
| 72 |
|
| 73 |
} |
| 74 |
|