| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPDataAccess\Drive { |
| 4 |
|
| 5 |
abstract class WPDA_Drive { |
| 6 |
|
| 7 |
protected $drive_type = null; // must be defined in constructor |
| 8 |
|
| 9 |
protected $drive_name = null; |
| 10 |
protected $drive = array(); |
| 11 |
protected $enabled = false; |
| 12 |
|
| 13 |
public function __construct( $drive_name, $drive = array(), $enabled = false ) { |
| 14 |
|
| 15 |
$this->drive_name = $drive_name; |
| 16 |
$this->drive = $drive; |
| 17 |
$this->enabled = $enabled; |
| 18 |
|
| 19 |
} |
| 20 |
|
| 21 |
final public function save() { |
| 22 |
|
| 23 |
if ( |
| 24 |
$this->drive_name !== null && |
| 25 |
$this->drive_type !== null |
| 26 |
) { |
| 27 |
WPDA_Drives::set_drive($this->drive_name, $this->drive, $this->drive_type, $this->enabled); |
| 28 |
WPDA_Drives::save(); |
| 29 |
|
| 30 |
return true; |
| 31 |
} else { |
| 32 |
return false; |
| 33 |
} |
| 34 |
|
| 35 |
} |
| 36 |
|
| 37 |
public abstract function authorize( $authorization, $enabled = true ); |
| 38 |
public abstract function refresh_token(); |
| 39 |
public abstract function connect(); |
| 40 |
public abstract function close(); |
| 41 |
public abstract function upload_file( $local_file, $remote_file ); |
| 42 |
public abstract function cleanup( $query, $keep ); |
| 43 |
|
| 44 |
} |
| 45 |
|
| 46 |
} |