-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclass-backupflow.php
More file actions
65 lines (53 loc) · 1.71 KB
/
Copy pathclass-backupflow.php
File metadata and controls
65 lines (53 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* Main plugin container.
*
* @package BackupFlow
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class BackupFlow {
private static $instance = null;
public $jobs;
public $database;
public $files;
public $storage;
public $backup_manager;
public $restore_manager;
public $migrator;
public $preflight;
public $admin;
public static function instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
public static function activate() {
backupflow_ensure_storage_dirs();
if ( false === get_option( 'backupflow_settings', false ) ) {
backupflow_update_settings( backupflow_default_settings() );
}
if ( false === get_option( 'backupflow_backups', false ) ) {
add_option( 'backupflow_backups', array(), '', false );
}
set_transient( 'backupflow_activation_redirect', 1, 60 );
}
public static function deactivate() {
delete_transient( 'backupflow_activation_redirect' );
}
private function __construct() {
$this->jobs = new BackupFlow_Job_Store();
$this->database = new BackupFlow_Database();
$this->files = new BackupFlow_File_System();
$this->storage = new BackupFlow_Storage();
$this->backup_manager = new BackupFlow_Backup_Manager( $this->jobs, $this->database, $this->files, $this->storage );
$this->restore_manager = new BackupFlow_Restore_Manager( $this->jobs, $this->database, $this->files );
$this->migrator = new BackupFlow_Migrator();
$this->preflight = new BackupFlow_Preflight();
if ( is_admin() ) {
$this->admin = new BackupFlow_Admin( $this->backup_manager, $this->restore_manager, $this->jobs, $this->storage, $this->migrator, $this->preflight );
}
}
}