AbstractBackupMetadata.php
1 day ago
BackupMetadata.php
1 day ago
FileBeingExtracted.php
1 day ago
ListableBackup.php
1 day ago
MultipartMetadata.php
1 day ago
AbstractBackupMetadata.php
1287 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPStaging\Backup\Entity; |
| 4 | |
| 5 | use WPStaging\Backup\BackupHeader; |
| 6 | use WPStaging\Backup\Dto\Traits\IsExportingTrait; |
| 7 | use WPStaging\Backup\Dto\Traits\WithPluginsThemesMuPluginsTrait; |
| 8 | use WPStaging\Backup\Service\BackupMetadataReader; |
| 9 | use WPStaging\Framework\Filesystem\FileObject; |
| 10 | use WPStaging\Framework\Job\Dto\Traits\DateCreatedTrait; |
| 11 | use WPStaging\Framework\Traits\HydrateTrait; |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | abstract class AbstractBackupMetadata implements \JsonSerializable |
| 25 | { |
| 26 | use HydrateTrait { |
| 27 | hydrate as traitHydrate; |
| 28 | } |
| 29 | |
| 30 | use IsExportingTrait; |
| 31 | use DateCreatedTrait; |
| 32 | use WithPluginsThemesMuPluginsTrait; |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | const FILTER_BACKUP_FORMAT_V1 = 'wpstg.backup.format_v1'; |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | const BACKUP_TYPE_SINGLE = 'single'; |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | const BACKUP_TYPE_MULTISITE = 'multi'; |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | const BACKUP_TYPE_NETWORK_SUBSITE = 'network-subsite'; |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | const BACKUP_TYPE_MAIN_SITE = 'main-network-site'; |
| 63 | |
| 64 | |
| 65 | private $id = ''; |
| 66 | |
| 67 | |
| 68 | private $headerStart; |
| 69 | |
| 70 | |
| 71 | private $headerEnd; |
| 72 | |
| 73 | |
| 74 | private $backupVersion = ''; |
| 75 | |
| 76 | |
| 77 | private $wpstgVersion = ''; |
| 78 | |
| 79 | |
| 80 | private $totalFiles; |
| 81 | |
| 82 | |
| 83 | private $totalDirectories; |
| 84 | |
| 85 | |
| 86 | private $siteUrl; |
| 87 | |
| 88 | |
| 89 | private $homeUrl; |
| 90 | |
| 91 | |
| 92 | private $absPath; |
| 93 | |
| 94 | |
| 95 | private $prefix; |
| 96 | |
| 97 | |
| 98 | private $backupType = ''; |
| 99 | |
| 100 | |
| 101 | private $name = ''; |
| 102 | |
| 103 | |
| 104 | private $note; |
| 105 | |
| 106 | |
| 107 | private $isAutomatedBackup = false; |
| 108 | |
| 109 | |
| 110 | private $isBeforeUpdateBackup = false; |
| 111 | |
| 112 | |
| 113 | private $databaseFile; |
| 114 | |
| 115 | |
| 116 | private $uploadedOn; |
| 117 | |
| 118 | |
| 119 | private $maxTableLength; |
| 120 | |
| 121 | |
| 122 | private $databaseFileSize; |
| 123 | |
| 124 | |
| 125 | private $phpVersion = ''; |
| 126 | |
| 127 | |
| 128 | private $wpVersion = ''; |
| 129 | |
| 130 | |
| 131 | private $wpDbVersion = ''; |
| 132 | |
| 133 | |
| 134 | private $dbCollate = ''; |
| 135 | |
| 136 | |
| 137 | private $dbCharset = ''; |
| 138 | |
| 139 | |
| 140 | private $sqlServerVersion = ''; |
| 141 | |
| 142 | |
| 143 | private $backupSize = ''; |
| 144 | |
| 145 | |
| 146 | private $blogId; |
| 147 | |
| 148 | |
| 149 | private $networkId; |
| 150 | |
| 151 | |
| 152 | private $networkAdmins; |
| 153 | |
| 154 | |
| 155 | private $uploadsPath; |
| 156 | |
| 157 | |
| 158 | private $uploadsUrl; |
| 159 | |
| 160 | |
| 161 | private $phpShortOpenTags; |
| 162 | |
| 163 | |
| 164 | private $wpBakeryActive; |
| 165 | |
| 166 | |
| 167 | private $isJetpackActive; |
| 168 | |
| 169 | |
| 170 | private $isCreatedOnWordPressCom; |
| 171 | |
| 172 | |
| 173 | private $scheduleId; |
| 174 | |
| 175 | |
| 176 | private $scheduleRecurrence; |
| 177 | |
| 178 | |
| 179 | private $sites; |
| 180 | |
| 181 | |
| 182 | private $subdomainInstall; |
| 183 | |
| 184 | |
| 185 | private $createdOnPro; |
| 186 | |
| 187 | |
| 188 | private $nonWpTables; |
| 189 | |
| 190 | |
| 191 | private $logFile = ''; |
| 192 | |
| 193 | |
| 194 | private $multipartMetadata = null; |
| 195 | |
| 196 | |
| 197 | private $indexPartSize = []; |
| 198 | |
| 199 | |
| 200 | private $isZlibCompressed = false; |
| 201 | |
| 202 | |
| 203 | private $totalChunks = 0; |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | |
| 209 | private $hostingType; |
| 210 | |
| 211 | |
| 212 | private $isContaining2GBFile = false; |
| 213 | |
| 214 | |
| 215 | private $phpArchitecture; |
| 216 | |
| 217 | |
| 218 | private $osArchitecture; |
| 219 | |
| 220 | #[\ReturnTypeWillChange] |
| 221 | public function jsonSerialize(): array |
| 222 | { |
| 223 | return $this->toArray(); |
| 224 | } |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | public function toArray(): array |
| 230 | { |
| 231 | $array = get_object_vars($this); |
| 232 | |
| 233 | return [ |
| 234 | 'networks' => [ |
| 235 | $this->getNetworkId() => [ |
| 236 | 'blogs' => [ |
| 237 | $this->getBlogId() => $array, |
| 238 | ], |
| 239 | ], |
| 240 | ], |
| 241 | ]; |
| 242 | } |
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | public function hydrate(array $data = []): BackupMetadata |
| 249 | { |
| 250 | if (key($data) === 'networks') { |
| 251 | if (array_key_exists($this->networkId, $data['networks'])) { |
| 252 | $data = $data['networks'][$this->networkId]; |
| 253 | } else { |
| 254 | $data = array_shift($data['networks']); |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | if (key($data) === 'blogs') { |
| 259 | if (array_key_exists($this->blogId, $data['blogs'])) { |
| 260 | $data = $data['blogs'][$this->blogId]; |
| 261 | } else { |
| 262 | $data = array_shift($data['blogs']); |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | $this->setBackupVersion(''); |
| 271 | |
| 272 | $this->traitHydrate($data); |
| 273 | |
| 274 | return $this; // @phpstan-ignore-line |
| 275 | } |
| 276 | |
| 277 | |
| 278 | |
| 279 | |
| 280 | |
| 281 | public function hydrateByFile(FileObject $file): BackupMetadata |
| 282 | { |
| 283 | $reader = new BackupMetadataReader($file); |
| 284 | |
| 285 | $backupMetadataArray = $reader->readBackupMetadata(); |
| 286 | |
| 287 | return (new static())->hydrate($backupMetadataArray); // @phpstan-ignore-line |
| 288 | } |
| 289 | |
| 290 | |
| 291 | |
| 292 | |
| 293 | |
| 294 | public function hydrateByFilePath($filePath): BackupMetadata |
| 295 | { |
| 296 | return $this->hydrateByFile(new FileObject($filePath)); |
| 297 | } |
| 298 | |
| 299 | |
| 300 | |
| 301 | |
| 302 | public function getId(): string |
| 303 | { |
| 304 | return $this->id; |
| 305 | } |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 | |
| 311 | public function setId(string $id) |
| 312 | { |
| 313 | $this->id = $id; |
| 314 | } |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | public function getHeader(string $backupPath) |
| 323 | { |
| 324 | if (!isset($this->headerStart)) { |
| 325 | return ''; |
| 326 | } |
| 327 | |
| 328 | $backupFile = new FileObject($backupPath); |
| 329 | $backupFile->fseek($this->headerStart); |
| 330 | return $backupFile->fread($this->headerEnd - $this->headerStart); |
| 331 | } |
| 332 | |
| 333 | |
| 334 | |
| 335 | |
| 336 | public function getHeaderStart() |
| 337 | { |
| 338 | return $this->headerStart; |
| 339 | } |
| 340 | |
| 341 | |
| 342 | |
| 343 | |
| 344 | |
| 345 | public function setHeaderStart($headerStart) |
| 346 | { |
| 347 | $this->headerStart = $headerStart; |
| 348 | } |
| 349 | |
| 350 | |
| 351 | |
| 352 | |
| 353 | public function getHeaderEnd() |
| 354 | { |
| 355 | return $this->headerEnd; |
| 356 | } |
| 357 | |
| 358 | |
| 359 | |
| 360 | |
| 361 | |
| 362 | public function setHeaderEnd($headerEnd) |
| 363 | { |
| 364 | $this->headerEnd = $headerEnd; |
| 365 | } |
| 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | public function getWpstgVersion(): string |
| 371 | { |
| 372 | return $this->wpstgVersion; |
| 373 | } |
| 374 | |
| 375 | |
| 376 | |
| 377 | |
| 378 | |
| 379 | public function setWpstgVersion(string $wpstgVersion) |
| 380 | { |
| 381 | $this->wpstgVersion = $wpstgVersion; |
| 382 | } |
| 383 | |
| 384 | |
| 385 | |
| 386 | |
| 387 | |
| 388 | |
| 389 | |
| 390 | public function setVersion(string $version) |
| 391 | { |
| 392 | $this->setWpstgVersion($version); |
| 393 | } |
| 394 | |
| 395 | |
| 396 | |
| 397 | |
| 398 | public function getBackupVersion(): string |
| 399 | { |
| 400 | return $this->backupVersion; |
| 401 | } |
| 402 | |
| 403 | |
| 404 | |
| 405 | |
| 406 | |
| 407 | public function setBackupVersion(string $backupVersion) |
| 408 | { |
| 409 | $this->backupVersion = $backupVersion; |
| 410 | } |
| 411 | |
| 412 | |
| 413 | |
| 414 | |
| 415 | public function getTotalFiles() |
| 416 | { |
| 417 | return $this->totalFiles; |
| 418 | } |
| 419 | |
| 420 | |
| 421 | |
| 422 | |
| 423 | |
| 424 | public function setTotalFiles($totalFiles) |
| 425 | { |
| 426 | $this->totalFiles = $totalFiles; |
| 427 | } |
| 428 | |
| 429 | |
| 430 | |
| 431 | |
| 432 | public function getTotalDirectories() |
| 433 | { |
| 434 | return $this->totalDirectories; |
| 435 | } |
| 436 | |
| 437 | |
| 438 | |
| 439 | |
| 440 | |
| 441 | public function setTotalDirectories($totalDirectories) |
| 442 | { |
| 443 | $this->totalDirectories = $totalDirectories; |
| 444 | } |
| 445 | |
| 446 | |
| 447 | |
| 448 | |
| 449 | public function getSiteUrl(): string |
| 450 | { |
| 451 | return $this->siteUrl; |
| 452 | } |
| 453 | |
| 454 | |
| 455 | |
| 456 | |
| 457 | |
| 458 | |
| 459 | |
| 460 | public function setSiteUrl(string $siteUrl) |
| 461 | { |
| 462 | |
| 463 | $siteUrl = rtrim($siteUrl, '/'); |
| 464 | |
| 465 | |
| 466 | if (!preg_match('#http(s?)://(.+)#i', $siteUrl)) { |
| 467 | throw new \RuntimeException('Please check the Site URL option of this WordPress installation. Contact WP STAGING support if you need assistance.'); |
| 468 | } |
| 469 | |
| 470 | if (!parse_url($siteUrl, PHP_URL_HOST)) { |
| 471 | throw new \RuntimeException('Please check the Site URL option of this WordPress installation. Contact WP STAGING support if you need assistance.'); |
| 472 | } |
| 473 | |
| 474 | $this->siteUrl = $siteUrl; |
| 475 | } |
| 476 | |
| 477 | |
| 478 | |
| 479 | |
| 480 | public function getHomeUrl(): string |
| 481 | { |
| 482 | return $this->homeUrl; |
| 483 | } |
| 484 | |
| 485 | |
| 486 | |
| 487 | |
| 488 | |
| 489 | |
| 490 | |
| 491 | public function setHomeUrl(string $homeUrl) |
| 492 | { |
| 493 | |
| 494 | $homeUrl = rtrim($homeUrl, '/'); |
| 495 | |
| 496 | |
| 497 | if (!preg_match('#http(s?)://(.+)#i', $homeUrl)) { |
| 498 | throw new \RuntimeException('Please check the Site URL option of this WordPress installation. Contact WP STAGING support if you need assistance.'); |
| 499 | } |
| 500 | |
| 501 | if (!parse_url($homeUrl, PHP_URL_HOST)) { |
| 502 | throw new \RuntimeException('Please check the Home URL option of this WordPress installation. Contact WP STAGING support if you need assistance.'); |
| 503 | } |
| 504 | |
| 505 | $this->homeUrl = $homeUrl; |
| 506 | } |
| 507 | |
| 508 | |
| 509 | |
| 510 | |
| 511 | public function getPrefix() |
| 512 | { |
| 513 | return $this->prefix; |
| 514 | } |
| 515 | |
| 516 | |
| 517 | |
| 518 | |
| 519 | |
| 520 | public function setPrefix($prefix) |
| 521 | { |
| 522 | $this->prefix = $prefix; |
| 523 | } |
| 524 | |
| 525 | |
| 526 | |
| 527 | |
| 528 | |
| 529 | |
| 530 | |
| 531 | public function setSingleOrMulti(string $singleOrMulti) |
| 532 | { |
| 533 | $this->setBackupType($singleOrMulti); |
| 534 | } |
| 535 | |
| 536 | |
| 537 | |
| 538 | |
| 539 | public function getBackupType(): string |
| 540 | { |
| 541 | return $this->backupType; |
| 542 | } |
| 543 | |
| 544 | |
| 545 | |
| 546 | |
| 547 | |
| 548 | public function setBackupType(string $backupType) |
| 549 | { |
| 550 | $this->backupType = $backupType; |
| 551 | } |
| 552 | |
| 553 | |
| 554 | |
| 555 | |
| 556 | public function getName(): string |
| 557 | { |
| 558 | return $this->name; |
| 559 | } |
| 560 | |
| 561 | |
| 562 | |
| 563 | |
| 564 | |
| 565 | public function setName(string $name) |
| 566 | { |
| 567 | $this->name = $name; |
| 568 | } |
| 569 | |
| 570 | |
| 571 | |
| 572 | |
| 573 | public function getNote() |
| 574 | { |
| 575 | return $this->note; |
| 576 | } |
| 577 | |
| 578 | |
| 579 | |
| 580 | |
| 581 | |
| 582 | public function setNote($note) |
| 583 | { |
| 584 | $this->note = $note; |
| 585 | } |
| 586 | |
| 587 | |
| 588 | |
| 589 | |
| 590 | public function getIsAutomatedBackup(): bool |
| 591 | { |
| 592 | return $this->isAutomatedBackup; |
| 593 | } |
| 594 | |
| 595 | |
| 596 | |
| 597 | |
| 598 | |
| 599 | public function setIsAutomatedBackup(bool $isAutomatedBackup) |
| 600 | { |
| 601 | $this->isAutomatedBackup = $isAutomatedBackup; |
| 602 | } |
| 603 | |
| 604 | |
| 605 | |
| 606 | |
| 607 | public function getIsBeforeUpdateBackup(): bool |
| 608 | { |
| 609 | return $this->isBeforeUpdateBackup; |
| 610 | } |
| 611 | |
| 612 | |
| 613 | |
| 614 | |
| 615 | |
| 616 | public function setIsBeforeUpdateBackup(bool $isBeforeUpdateBackup) |
| 617 | { |
| 618 | $this->isBeforeUpdateBackup = $isBeforeUpdateBackup; |
| 619 | } |
| 620 | |
| 621 | |
| 622 | |
| 623 | |
| 624 | public function getDatabaseFile() |
| 625 | { |
| 626 | return $this->databaseFile; |
| 627 | } |
| 628 | |
| 629 | |
| 630 | |
| 631 | |
| 632 | |
| 633 | public function setDatabaseFile($databaseFile) |
| 634 | { |
| 635 | $this->databaseFile = $databaseFile; |
| 636 | } |
| 637 | |
| 638 | |
| 639 | |
| 640 | |
| 641 | public function getUploadedOn(): int |
| 642 | { |
| 643 | return $this->uploadedOn; |
| 644 | } |
| 645 | |
| 646 | |
| 647 | |
| 648 | |
| 649 | |
| 650 | public function setUploadedOn($uploadedOn) |
| 651 | { |
| 652 | $this->uploadedOn = $uploadedOn; |
| 653 | } |
| 654 | |
| 655 | |
| 656 | |
| 657 | |
| 658 | public function getMaxTableLength() |
| 659 | { |
| 660 | return $this->maxTableLength; |
| 661 | } |
| 662 | |
| 663 | |
| 664 | |
| 665 | |
| 666 | |
| 667 | public function setMaxTableLength($maxTableLength) |
| 668 | { |
| 669 | $this->maxTableLength = $maxTableLength; |
| 670 | } |
| 671 | |
| 672 | |
| 673 | |
| 674 | |
| 675 | public function getDatabaseFileSize() |
| 676 | { |
| 677 | return $this->databaseFileSize; |
| 678 | } |
| 679 | |
| 680 | |
| 681 | |
| 682 | |
| 683 | |
| 684 | public function setDatabaseFileSize($databaseFileSize) |
| 685 | { |
| 686 | $this->databaseFileSize = $databaseFileSize; |
| 687 | } |
| 688 | |
| 689 | |
| 690 | |
| 691 | |
| 692 | public function getPhpVersion(): string |
| 693 | { |
| 694 | return (string)$this->phpVersion; |
| 695 | } |
| 696 | |
| 697 | |
| 698 | |
| 699 | |
| 700 | |
| 701 | public function setPhpVersion(string $phpVersion) |
| 702 | { |
| 703 | $this->phpVersion = (string)$phpVersion; |
| 704 | } |
| 705 | |
| 706 | |
| 707 | |
| 708 | |
| 709 | public function getWpVersion(): string |
| 710 | { |
| 711 | return (string)$this->wpVersion; |
| 712 | } |
| 713 | |
| 714 | |
| 715 | |
| 716 | |
| 717 | |
| 718 | public function setWpVersion(string $wpVersion) |
| 719 | { |
| 720 | $this->wpVersion = (string)$wpVersion; |
| 721 | } |
| 722 | |
| 723 | |
| 724 | |
| 725 | |
| 726 | public function getWpDbVersion(): string |
| 727 | { |
| 728 | return (string)$this->wpDbVersion; |
| 729 | } |
| 730 | |
| 731 | |
| 732 | |
| 733 | |
| 734 | |
| 735 | public function setWpDbVersion(string $wpDbVersion) |
| 736 | { |
| 737 | $this->wpDbVersion = (string)$wpDbVersion; |
| 738 | } |
| 739 | |
| 740 | |
| 741 | |
| 742 | |
| 743 | public function getDbCollate(): string |
| 744 | { |
| 745 | return (string)$this->dbCollate; |
| 746 | } |
| 747 | |
| 748 | |
| 749 | |
| 750 | |
| 751 | |
| 752 | public function setDbCollate(string $dbCollate) |
| 753 | { |
| 754 | $this->dbCollate = (string)$dbCollate; |
| 755 | } |
| 756 | |
| 757 | |
| 758 | |
| 759 | |
| 760 | public function getSqlServerVersion(): string |
| 761 | { |
| 762 | return (string)$this->sqlServerVersion; |
| 763 | } |
| 764 | |
| 765 | |
| 766 | |
| 767 | |
| 768 | |
| 769 | public function setSqlServerVersion(string $sqlServerVersion) |
| 770 | { |
| 771 | $this->sqlServerVersion = (string)$sqlServerVersion; |
| 772 | } |
| 773 | |
| 774 | |
| 775 | |
| 776 | |
| 777 | public function getDbCharset(): string |
| 778 | { |
| 779 | return (string)$this->dbCharset; |
| 780 | } |
| 781 | |
| 782 | |
| 783 | |
| 784 | |
| 785 | |
| 786 | public function setDbCharset(string $dbCharset) |
| 787 | { |
| 788 | $this->dbCharset = (string)$dbCharset; |
| 789 | } |
| 790 | |
| 791 | |
| 792 | |
| 793 | |
| 794 | public function getBackupSize(): int |
| 795 | { |
| 796 | return (int)$this->backupSize; |
| 797 | } |
| 798 | |
| 799 | |
| 800 | |
| 801 | |
| 802 | |
| 803 | public function setBackupSize($backupSize) |
| 804 | { |
| 805 | $this->backupSize = (int)$backupSize; |
| 806 | } |
| 807 | |
| 808 | |
| 809 | |
| 810 | |
| 811 | public function getAbsPath(): string |
| 812 | { |
| 813 | return $this->absPath; |
| 814 | } |
| 815 | |
| 816 | |
| 817 | |
| 818 | |
| 819 | |
| 820 | public function setAbsPath(string $absPath) |
| 821 | { |
| 822 | $this->absPath = $absPath; |
| 823 | } |
| 824 | |
| 825 | |
| 826 | |
| 827 | |
| 828 | public function getBlogId(): int |
| 829 | { |
| 830 | return $this->blogId; |
| 831 | } |
| 832 | |
| 833 | |
| 834 | |
| 835 | |
| 836 | |
| 837 | public function setBlogId(int $blogId) |
| 838 | { |
| 839 | $this->blogId = $blogId; |
| 840 | } |
| 841 | |
| 842 | |
| 843 | |
| 844 | |
| 845 | public function getUploadsPath(): string |
| 846 | { |
| 847 | return $this->uploadsPath; |
| 848 | } |
| 849 | |
| 850 | |
| 851 | |
| 852 | |
| 853 | |
| 854 | public function setUploadsPath(string $uploadsPath) |
| 855 | { |
| 856 | $this->uploadsPath = $uploadsPath; |
| 857 | } |
| 858 | |
| 859 | |
| 860 | |
| 861 | |
| 862 | public function getUploadsUrl(): string |
| 863 | { |
| 864 | return $this->uploadsUrl; |
| 865 | } |
| 866 | |
| 867 | |
| 868 | |
| 869 | |
| 870 | |
| 871 | public function setUploadsUrl(string $uploadsUrl) |
| 872 | { |
| 873 | $this->uploadsUrl = $uploadsUrl; |
| 874 | } |
| 875 | |
| 876 | |
| 877 | |
| 878 | |
| 879 | public function getNetworkId(): int |
| 880 | { |
| 881 | return $this->networkId; |
| 882 | } |
| 883 | |
| 884 | |
| 885 | |
| 886 | |
| 887 | |
| 888 | public function setNetworkId(int $networkId) |
| 889 | { |
| 890 | $this->networkId = $networkId; |
| 891 | } |
| 892 | |
| 893 | |
| 894 | |
| 895 | |
| 896 | public function getNetworkAdmins(): array |
| 897 | { |
| 898 | if (!is_array($this->networkAdmins)) { |
| 899 | $this->networkAdmins = []; |
| 900 | } |
| 901 | |
| 902 | return $this->networkAdmins; |
| 903 | } |
| 904 | |
| 905 | |
| 906 | |
| 907 | |
| 908 | |
| 909 | |
| 910 | public function setNetworkAdmins($networkAdmins) |
| 911 | { |
| 912 | $this->networkAdmins = $networkAdmins; |
| 913 | } |
| 914 | |
| 915 | |
| 916 | |
| 917 | |
| 918 | public function getPhpShortOpenTags(): bool |
| 919 | { |
| 920 | return $this->phpShortOpenTags; |
| 921 | } |
| 922 | |
| 923 | |
| 924 | |
| 925 | |
| 926 | |
| 927 | public function setPhpShortOpenTags(bool $phpShortOpenTags) |
| 928 | { |
| 929 | $this->phpShortOpenTags = $phpShortOpenTags; |
| 930 | } |
| 931 | |
| 932 | |
| 933 | |
| 934 | |
| 935 | public function getWpBakeryActive(): bool |
| 936 | { |
| 937 | return $this->wpBakeryActive; |
| 938 | } |
| 939 | |
| 940 | |
| 941 | |
| 942 | |
| 943 | |
| 944 | public function setWpBakeryActive(bool $wpBakeryActive) |
| 945 | { |
| 946 | $this->wpBakeryActive = $wpBakeryActive; |
| 947 | } |
| 948 | |
| 949 | |
| 950 | |
| 951 | |
| 952 | public function getIsJetpackActive(): bool |
| 953 | { |
| 954 | return $this->isJetpackActive ?? false; |
| 955 | } |
| 956 | |
| 957 | |
| 958 | |
| 959 | |
| 960 | |
| 961 | public function setIsJetpackActive($isJetpackActive) |
| 962 | { |
| 963 | $this->isJetpackActive = $isJetpackActive; |
| 964 | } |
| 965 | |
| 966 | |
| 967 | |
| 968 | |
| 969 | public function getIsCreatedOnWordPressCom(): bool |
| 970 | { |
| 971 | return $this->isCreatedOnWordPressCom ?? false; |
| 972 | } |
| 973 | |
| 974 | |
| 975 | |
| 976 | |
| 977 | |
| 978 | public function setIsCreatedOnWordPressCom($isCreatedOnWordPressCom) |
| 979 | { |
| 980 | $this->isCreatedOnWordPressCom = $isCreatedOnWordPressCom; |
| 981 | } |
| 982 | |
| 983 | |
| 984 | |
| 985 | |
| 986 | public function getScheduleId() |
| 987 | { |
| 988 | return $this->scheduleId; |
| 989 | } |
| 990 | |
| 991 | |
| 992 | |
| 993 | |
| 994 | |
| 995 | public function setScheduleId($scheduleId) |
| 996 | { |
| 997 | $this->scheduleId = $scheduleId; |
| 998 | } |
| 999 | |
| 1000 | |
| 1001 | |
| 1002 | |
| 1003 | public function getScheduleRecurrence() |
| 1004 | { |
| 1005 | return $this->scheduleRecurrence; |
| 1006 | } |
| 1007 | |
| 1008 | |
| 1009 | |
| 1010 | |
| 1011 | |
| 1012 | public function setScheduleRecurrence($scheduleRecurrence) |
| 1013 | { |
| 1014 | $this->scheduleRecurrence = $scheduleRecurrence; |
| 1015 | } |
| 1016 | |
| 1017 | |
| 1018 | |
| 1019 | |
| 1020 | public function getSites() |
| 1021 | { |
| 1022 | return $this->sites; |
| 1023 | } |
| 1024 | |
| 1025 | |
| 1026 | |
| 1027 | |
| 1028 | |
| 1029 | public function setSites($sites) |
| 1030 | { |
| 1031 | $this->sites = $sites; |
| 1032 | } |
| 1033 | |
| 1034 | |
| 1035 | |
| 1036 | |
| 1037 | public function getSubdomainInstall(): bool |
| 1038 | { |
| 1039 | return $this->subdomainInstall; |
| 1040 | } |
| 1041 | |
| 1042 | |
| 1043 | |
| 1044 | |
| 1045 | |
| 1046 | public function setSubdomainInstall(bool $subdomainInstall) |
| 1047 | { |
| 1048 | $this->subdomainInstall = $subdomainInstall; |
| 1049 | } |
| 1050 | |
| 1051 | |
| 1052 | |
| 1053 | |
| 1054 | public function getCreatedOnPro(): bool |
| 1055 | { |
| 1056 | |
| 1057 | if (!isset($this->createdOnPro) || is_null($this->createdOnPro)) { |
| 1058 | $this->createdOnPro = true; |
| 1059 | } |
| 1060 | |
| 1061 | return $this->createdOnPro; |
| 1062 | } |
| 1063 | |
| 1064 | |
| 1065 | |
| 1066 | |
| 1067 | |
| 1068 | public function setCreatedOnPro($createdOnPro) |
| 1069 | { |
| 1070 | $this->createdOnPro = $createdOnPro; |
| 1071 | } |
| 1072 | |
| 1073 | |
| 1074 | |
| 1075 | |
| 1076 | public function getMultipartMetadata() |
| 1077 | { |
| 1078 | |
| 1079 | if (empty($this->multipartMetadata)) { |
| 1080 | return null; |
| 1081 | } |
| 1082 | |
| 1083 | if ($this->multipartMetadata instanceof MultipartMetadata) { |
| 1084 | return $this->multipartMetadata; |
| 1085 | } |
| 1086 | |
| 1087 | $metadata = new MultipartMetadata(); |
| 1088 | $this->multipartMetadata = $metadata->hydrate($this->multipartMetadata); |
| 1089 | |
| 1090 | return $this->multipartMetadata; |
| 1091 | } |
| 1092 | |
| 1093 | |
| 1094 | |
| 1095 | |
| 1096 | |
| 1097 | public function setMultipartMetadata($multipartMetadata) |
| 1098 | { |
| 1099 | $this->multipartMetadata = $multipartMetadata; |
| 1100 | } |
| 1101 | |
| 1102 | |
| 1103 | public function getIsMultipartBackup(): bool |
| 1104 | { |
| 1105 | return !empty($this->multipartMetadata); |
| 1106 | } |
| 1107 | |
| 1108 | |
| 1109 | |
| 1110 | |
| 1111 | public function getNonWpTables() |
| 1112 | { |
| 1113 | return $this->nonWpTables; |
| 1114 | } |
| 1115 | |
| 1116 | |
| 1117 | |
| 1118 | |
| 1119 | |
| 1120 | public function setNonWpTables($tables) |
| 1121 | { |
| 1122 | $this->nonWpTables = $tables; |
| 1123 | } |
| 1124 | |
| 1125 | |
| 1126 | |
| 1127 | |
| 1128 | |
| 1129 | public function setLogFile(string $fileName) |
| 1130 | { |
| 1131 | $this->logFile = $fileName; |
| 1132 | } |
| 1133 | |
| 1134 | |
| 1135 | |
| 1136 | |
| 1137 | |
| 1138 | public function setIndexPartSize(array $indexPartSize) |
| 1139 | { |
| 1140 | $this->indexPartSize = $indexPartSize; |
| 1141 | } |
| 1142 | |
| 1143 | |
| 1144 | |
| 1145 | |
| 1146 | |
| 1147 | |
| 1148 | |
| 1149 | |
| 1150 | |
| 1151 | |
| 1152 | |
| 1153 | |
| 1154 | |
| 1155 | public function getIndexPartSize(): array |
| 1156 | { |
| 1157 | return $this->indexPartSize; |
| 1158 | } |
| 1159 | |
| 1160 | |
| 1161 | |
| 1162 | |
| 1163 | public function getIsZlibCompressed() |
| 1164 | { |
| 1165 | return $this->isZlibCompressed; |
| 1166 | } |
| 1167 | |
| 1168 | |
| 1169 | |
| 1170 | |
| 1171 | public function setIsZlibCompressed($isZlibCompressed) |
| 1172 | { |
| 1173 | $this->isZlibCompressed = $isZlibCompressed; |
| 1174 | } |
| 1175 | |
| 1176 | |
| 1177 | |
| 1178 | |
| 1179 | public function getTotalChunks(): int |
| 1180 | { |
| 1181 | return $this->totalChunks; |
| 1182 | } |
| 1183 | |
| 1184 | |
| 1185 | |
| 1186 | |
| 1187 | |
| 1188 | public function setTotalChunks(int $totalChunks) |
| 1189 | { |
| 1190 | $this->totalChunks = $totalChunks; |
| 1191 | } |
| 1192 | |
| 1193 | |
| 1194 | |
| 1195 | |
| 1196 | public function getHostingType(): string |
| 1197 | { |
| 1198 | if (empty($this->hostingType)) { |
| 1199 | |
| 1200 | |
| 1201 | |
| 1202 | |
| 1203 | $this->hostingType = 'other'; |
| 1204 | } |
| 1205 | |
| 1206 | return $this->hostingType; |
| 1207 | } |
| 1208 | |
| 1209 | |
| 1210 | |
| 1211 | |
| 1212 | |
| 1213 | public function setHostingType(string $hostingType) |
| 1214 | { |
| 1215 | $this->hostingType = $hostingType; |
| 1216 | } |
| 1217 | |
| 1218 | |
| 1219 | |
| 1220 | |
| 1221 | public function getIsContaining2GBFile(): bool |
| 1222 | { |
| 1223 | return $this->isContaining2GBFile; |
| 1224 | } |
| 1225 | |
| 1226 | |
| 1227 | |
| 1228 | |
| 1229 | |
| 1230 | public function setIsContaining2GBFile($isContaining2GBFile) |
| 1231 | { |
| 1232 | $this->isContaining2GBFile = (bool)$isContaining2GBFile; |
| 1233 | } |
| 1234 | |
| 1235 | |
| 1236 | |
| 1237 | |
| 1238 | public function getPhpArchitecture(): string |
| 1239 | { |
| 1240 | return $this->phpArchitecture; |
| 1241 | } |
| 1242 | |
| 1243 | |
| 1244 | |
| 1245 | |
| 1246 | |
| 1247 | public function setPhpArchitecture(string $phpArchitecture) |
| 1248 | { |
| 1249 | $this->phpArchitecture = $phpArchitecture; |
| 1250 | } |
| 1251 | |
| 1252 | |
| 1253 | |
| 1254 | |
| 1255 | public function getOsArchitecture(): string |
| 1256 | { |
| 1257 | return $this->osArchitecture; |
| 1258 | } |
| 1259 | |
| 1260 | |
| 1261 | |
| 1262 | |
| 1263 | |
| 1264 | public function setOsArchitecture(string $osArchitecture) |
| 1265 | { |
| 1266 | $this->osArchitecture = $osArchitecture; |
| 1267 | } |
| 1268 | |
| 1269 | public function getIsBackupFormatV1(): bool |
| 1270 | { |
| 1271 | return version_compare($this->getBackupVersion(), BackupHeader::MIN_BACKUP_VERSION, '<'); |
| 1272 | } |
| 1273 | |
| 1274 | public function getIsMultisiteBackup(): bool |
| 1275 | { |
| 1276 | return $this->backupType !== self::BACKUP_TYPE_SINGLE; |
| 1277 | } |
| 1278 | |
| 1279 | |
| 1280 | |
| 1281 | |
| 1282 | public function revertBackupSizeToDefault() |
| 1283 | { |
| 1284 | $this->backupSize = ''; |
| 1285 | } |
| 1286 | } |
| 1287 |