PluginProbe
JetBackup – Backup, Restore & Migrate / 3.1.21.3
JetBackup – Backup, Restore & Migrate v3.1.21.3
3.1.23.6 3.1.23.5 3.1.23.3 3.1.22.4 3.1.22.3 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.8.1 1.4.9 1.5.0 1.5.1 1.5.1.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 1.6.10 All 82 releases
backup / src / JetBackup / Wordpress / Blog.php
Blog.php
47 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace JetBackup\Wordpress;
4
5 use JetBackup\Data\ArrayData;
6
7 if (!defined( '__JETBACKUP__')) die('Direct access is not allowed');
8
9 class Blog extends ArrayData {
10
11 const ID = 'id';
12 const DOMAIN = 'domain';
13 const DATABASE_TABLES = 'database_tables';
14
15 const MAIN_BLOG_ID = 1;
16
17 public function __construct($data=[]) {
18 $this->setData($data);
19 }
20
21 public function setId(int $id):void { $this->set(self::ID, $id); }
22 public function getId():int { return $this->get(self::ID, 0); }
23
24 public function setDomain(string $domain):void { $this->set(self::DOMAIN, $domain); }
25 public function getDomain():string { return $this->get(self::DOMAIN); }
26
27 public function setDatabaseTables(array $tables):void { $this->set(self::DATABASE_TABLES, $tables); }
28 public function getDatabaseTables():array { return $this->get(self::DATABASE_TABLES, []); }
29 public function addDatabaseTable(string $table):void {
30 $tables = $this->getDatabaseTables();
31 $tables[] = $table;
32 $this->setDatabaseTables($tables);
33 }
34
35 public function getPaths():array {
36 if(!$this->isMain()) return [];
37 return [
38 "wp-content/blogs.dir/{$this->getId()}/files", // Legacy
39 "wp-content/uploads/sites/{$this->getId()}",
40 "wp-content/uploads/{$this->getId()}",
41 "wp-content/{$this->getId()}",
42 ];
43 }
44
45 public function isMain():bool { return $this->getId() == self::MAIN_BLOG_ID; }
46 }
47