JobBackupDataDto.php
789 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPStaging\Backup\Dto\Job; |
| 4 | |
| 5 | use WPStaging\Backup\Dto\Interfaces\RemoteUploadDtoInterface; |
| 6 | use WPStaging\Backup\Dto\JobDataDto; |
| 7 | use WPStaging\Backup\Dto\Traits\IsExportingTrait; |
| 8 | use WPStaging\Backup\Dto\Traits\IsExcludingTrait; |
| 9 | use WPStaging\Backup\Dto\Traits\RemoteUploadTrait; |
| 10 | |
| 11 | class JobBackupDataDto extends JobDataDto implements RemoteUploadDtoInterface |
| 12 | { |
| 13 | use IsExportingTrait; |
| 14 | use IsExcludingTrait; |
| 15 | use RemoteUploadTrait; |
| 16 | |
| 17 | /** @var string|null */ |
| 18 | private $name; |
| 19 | |
| 20 | /** @var array */ |
| 21 | private $excludedDirectories = []; |
| 22 | |
| 23 | /** @var int */ |
| 24 | private $totalDirectories; |
| 25 | |
| 26 | /** @var int The number of files in the backup index */ |
| 27 | private $totalFiles; |
| 28 | |
| 29 | /** @var array The number of files in backup parts */ |
| 30 | private $filesInParts = []; |
| 31 | |
| 32 | /** @var int The number of files the FilesystemScanner discovered */ |
| 33 | private $discoveredFiles; |
| 34 | |
| 35 | /** @var array The number of files the FilesystemScanner discovered in themes,plugins,muplugins,uploads,others */ |
| 36 | private $discoveredFilesArray = []; |
| 37 | |
| 38 | /** @var string */ |
| 39 | private $databaseFile; |
| 40 | |
| 41 | /** |
| 42 | * @var int If a file couldn't be processed in a single request, |
| 43 | * this property holds how many bytes were written thus far |
| 44 | * so that the backup can start writing from this byte onwards. |
| 45 | */ |
| 46 | private $fileBeingBackupWrittenBytes; |
| 47 | |
| 48 | /** @var int */ |
| 49 | private $totalRowsBackup; |
| 50 | |
| 51 | /** @var int */ |
| 52 | private $tableRowsOffset = 0; |
| 53 | |
| 54 | /** @var int */ |
| 55 | private $totalRowsOfTableBeingBackup = 0; |
| 56 | |
| 57 | /** @var int reset to PHP_INT_MIN for each table */ |
| 58 | private $lastInsertId; |
| 59 | |
| 60 | /** @var array */ |
| 61 | private $tablesToBackup = []; |
| 62 | |
| 63 | /** @var array */ |
| 64 | private $nonWpTables = []; |
| 65 | |
| 66 | /** @var int The size in bytes of the database in this backup */ |
| 67 | private $databaseFileSize = 0; |
| 68 | |
| 69 | /** @var int The size in bytes of the filesystem in this backup */ |
| 70 | private $filesystemSize = 0; |
| 71 | |
| 72 | /** @var int The number of requests that the Discovering Files task has executed so far */ |
| 73 | private $discoveringFilesRequests = 0; |
| 74 | |
| 75 | /** @var bool True if this backup should be repeated on a schedule, false if it should run only once. */ |
| 76 | private $repeatBackupOnSchedule; |
| 77 | |
| 78 | /** @var string The cron to repeat this backup, if scheduled. */ |
| 79 | private $scheduleRecurrence; |
| 80 | |
| 81 | /** @var array The hour and minute to repeat this backup, if scheduled. */ |
| 82 | private $scheduleTime = []; |
| 83 | |
| 84 | /** @var int How many backups to keep, if scheduled. */ |
| 85 | private $scheduleRotation; |
| 86 | |
| 87 | /** @var string The absolute path to this .wpstg file */ |
| 88 | private $backupFilePath; |
| 89 | |
| 90 | /** @var string If set, this backup was created as part of this schedule ID. */ |
| 91 | private $scheduleId; |
| 92 | |
| 93 | /** @var bool Should this scheduled backup be created right now. Matters only if this backup is repeated on schedule */ |
| 94 | private $isCreateScheduleBackupNow; |
| 95 | |
| 96 | /** @var array Site selected to backup */ |
| 97 | private $sitesToBackup = []; |
| 98 | |
| 99 | /** |
| 100 | * is network subsite or network main site backup |
| 101 | * @var bool */ |
| 102 | private $isNetworkSiteBackup = false; |
| 103 | |
| 104 | /** @var bool */ |
| 105 | private $isMultipartBackup = false; |
| 106 | |
| 107 | /** @var int */ |
| 108 | private $maxMultipartBackupSize = 2147483647; // 2GB - 1 Byte |
| 109 | |
| 110 | /** |
| 111 | * @var array |
| 112 | * Store max index for each category |
| 113 | */ |
| 114 | private $fileBackupIndices = []; |
| 115 | |
| 116 | /** @var int */ |
| 117 | private $maxDbPartIndex = 0; |
| 118 | |
| 119 | /** @var int */ |
| 120 | private $currentMultipartFileInfoIndex = 0; |
| 121 | |
| 122 | /** @var array */ |
| 123 | private $multipartFilesInfo = []; |
| 124 | |
| 125 | /** |
| 126 | * @var array<string, int> |
| 127 | * Store total size for each category |
| 128 | */ |
| 129 | private $categorySizes = []; |
| 130 | |
| 131 | /** @var string */ |
| 132 | private $backupType; |
| 133 | |
| 134 | /** @var int */ |
| 135 | private $subsiteBlogId; |
| 136 | |
| 137 | /** |
| 138 | * @return string|null |
| 139 | */ |
| 140 | public function getName() |
| 141 | { |
| 142 | return $this->name; |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * Hydrated dynamically. |
| 147 | * |
| 148 | * @param string|null $name |
| 149 | */ |
| 150 | public function setName($name) |
| 151 | { |
| 152 | $this->name = $name; |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * @return array|null |
| 157 | */ |
| 158 | public function getExcludedDirectories() |
| 159 | { |
| 160 | return (array)$this->excludedDirectories; |
| 161 | } |
| 162 | |
| 163 | public function setExcludedDirectories(array $excludedDirectories = []) |
| 164 | { |
| 165 | $this->excludedDirectories = $excludedDirectories; |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * @return int |
| 170 | */ |
| 171 | public function getTotalDirectories() |
| 172 | { |
| 173 | return $this->totalDirectories; |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * @param int $totalDirectories |
| 178 | */ |
| 179 | public function setTotalDirectories($totalDirectories) |
| 180 | { |
| 181 | $this->totalDirectories = $totalDirectories; |
| 182 | } |
| 183 | |
| 184 | /** |
| 185 | * @return int |
| 186 | */ |
| 187 | public function getTotalFiles() |
| 188 | { |
| 189 | return $this->totalFiles; |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * @param int $totalFiles |
| 194 | */ |
| 195 | public function setTotalFiles($totalFiles) |
| 196 | { |
| 197 | $this->totalFiles = $totalFiles; |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * @return int |
| 202 | */ |
| 203 | public function getDiscoveredFiles() |
| 204 | { |
| 205 | return $this->discoveredFiles; |
| 206 | } |
| 207 | |
| 208 | /** |
| 209 | * @param int $discoveredFiles |
| 210 | */ |
| 211 | public function setDiscoveredFiles($discoveredFiles) |
| 212 | { |
| 213 | $this->discoveredFiles = $discoveredFiles; |
| 214 | } |
| 215 | |
| 216 | /** |
| 217 | * @return string |
| 218 | */ |
| 219 | public function getDatabaseFile() |
| 220 | { |
| 221 | return $this->databaseFile; |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * @param string $databaseFile |
| 226 | */ |
| 227 | public function setDatabaseFile($databaseFile) |
| 228 | { |
| 229 | $this->databaseFile = $databaseFile; |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * @return int |
| 234 | */ |
| 235 | public function getTableRowsOffset() |
| 236 | { |
| 237 | return (int)$this->tableRowsOffset; |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * @param int $tableRowsOffset |
| 242 | */ |
| 243 | public function setTableRowsOffset($tableRowsOffset) |
| 244 | { |
| 245 | $this->tableRowsOffset = (int)$tableRowsOffset; |
| 246 | } |
| 247 | |
| 248 | /** |
| 249 | * @return int |
| 250 | */ |
| 251 | public function getTotalRowsBackup() |
| 252 | { |
| 253 | return (int)$this->totalRowsBackup; |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * @param int $totalRowsBackup |
| 258 | */ |
| 259 | public function setTotalRowsBackup($totalRowsBackup) |
| 260 | { |
| 261 | $this->totalRowsBackup = (int)$totalRowsBackup; |
| 262 | } |
| 263 | |
| 264 | /** |
| 265 | * @return int |
| 266 | */ |
| 267 | public function getFileBeingBackupWrittenBytes() |
| 268 | { |
| 269 | return (int)$this->fileBeingBackupWrittenBytes; |
| 270 | } |
| 271 | |
| 272 | /** |
| 273 | * @param int $fileBeingBackupWrittenBytes |
| 274 | */ |
| 275 | public function setFileBeingBackupWrittenBytes($fileBeingBackupWrittenBytes) |
| 276 | { |
| 277 | $this->fileBeingBackupWrittenBytes = (int)$fileBeingBackupWrittenBytes; |
| 278 | } |
| 279 | |
| 280 | /** |
| 281 | * @return array |
| 282 | */ |
| 283 | public function getTablesToBackup() |
| 284 | { |
| 285 | return (array)$this->tablesToBackup; |
| 286 | } |
| 287 | |
| 288 | /** |
| 289 | * @param array $tablesToBackup |
| 290 | */ |
| 291 | public function setTablesToBackup($tablesToBackup) |
| 292 | { |
| 293 | $this->tablesToBackup = (array)$tablesToBackup; |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * @return array |
| 298 | */ |
| 299 | public function getNonWpTables() |
| 300 | { |
| 301 | return (array)$this->nonWpTables; |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * @param array $nonWpTables |
| 306 | */ |
| 307 | public function setNonWpTables($nonWpTables) |
| 308 | { |
| 309 | $this->nonWpTables = (array)$nonWpTables; |
| 310 | } |
| 311 | |
| 312 | /** |
| 313 | * @return int |
| 314 | */ |
| 315 | public function getTotalRowsOfTableBeingBackup() |
| 316 | { |
| 317 | return (int)$this->totalRowsOfTableBeingBackup; |
| 318 | } |
| 319 | |
| 320 | /** |
| 321 | * @param int $totalRowsOfTableBeingBackup |
| 322 | */ |
| 323 | public function setTotalRowsOfTableBeingBackup($totalRowsOfTableBeingBackup) |
| 324 | { |
| 325 | $this->totalRowsOfTableBeingBackup = (int)$totalRowsOfTableBeingBackup; |
| 326 | } |
| 327 | |
| 328 | /** |
| 329 | * @return int |
| 330 | */ |
| 331 | public function getDatabaseFileSize() |
| 332 | { |
| 333 | return $this->databaseFileSize; |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * @param int $databaseFileSize |
| 338 | */ |
| 339 | public function setDatabaseFileSize($databaseFileSize) |
| 340 | { |
| 341 | $this->databaseFileSize = $databaseFileSize; |
| 342 | } |
| 343 | |
| 344 | /** |
| 345 | * @return int |
| 346 | */ |
| 347 | public function getFilesystemSize() |
| 348 | { |
| 349 | return $this->filesystemSize; |
| 350 | } |
| 351 | |
| 352 | /** |
| 353 | * @param int $filesystemSize |
| 354 | */ |
| 355 | public function setFilesystemSize($filesystemSize) |
| 356 | { |
| 357 | $this->filesystemSize = $filesystemSize; |
| 358 | } |
| 359 | |
| 360 | /** |
| 361 | * @return int |
| 362 | */ |
| 363 | public function getDiscoveringFilesRequests() |
| 364 | { |
| 365 | return $this->discoveringFilesRequests; |
| 366 | } |
| 367 | |
| 368 | /** |
| 369 | * @param int $discoveringFilesRequests |
| 370 | */ |
| 371 | public function setDiscoveringFilesRequests($discoveringFilesRequests) |
| 372 | { |
| 373 | $this->discoveringFilesRequests = $discoveringFilesRequests; |
| 374 | } |
| 375 | |
| 376 | /** |
| 377 | * @return bool |
| 378 | */ |
| 379 | public function getRepeatBackupOnSchedule() |
| 380 | { |
| 381 | return $this->repeatBackupOnSchedule; |
| 382 | } |
| 383 | |
| 384 | /** |
| 385 | * @param bool $repeatBackupOnSchedule |
| 386 | */ |
| 387 | public function setRepeatBackupOnSchedule($repeatBackupOnSchedule) |
| 388 | { |
| 389 | $this->repeatBackupOnSchedule = $repeatBackupOnSchedule; |
| 390 | } |
| 391 | |
| 392 | /** |
| 393 | * @see Cron For WP STAGING cron recurrences. |
| 394 | * |
| 395 | * @return string A WP STAGING cron schedule |
| 396 | */ |
| 397 | public function getScheduleRecurrence() |
| 398 | { |
| 399 | return $this->scheduleRecurrence; |
| 400 | } |
| 401 | |
| 402 | /** |
| 403 | * @param string $scheduleRecurrence |
| 404 | */ |
| 405 | public function setScheduleRecurrence($scheduleRecurrence) |
| 406 | { |
| 407 | $this->scheduleRecurrence = $scheduleRecurrence; |
| 408 | } |
| 409 | |
| 410 | /** |
| 411 | * @return array H:i time format, expected to be accurate to the site's timezone, example: 00:00 |
| 412 | */ |
| 413 | public function getScheduleTime() |
| 414 | { |
| 415 | return $this->scheduleTime; |
| 416 | } |
| 417 | |
| 418 | /** |
| 419 | * @param array $scheduleTime Hour and Minute ['00', '00'] |
| 420 | */ |
| 421 | public function setScheduleTime(array $scheduleTime) |
| 422 | { |
| 423 | $this->scheduleTime = $scheduleTime; |
| 424 | } |
| 425 | |
| 426 | /** |
| 427 | * @return int How many backups to keep, example: 1 |
| 428 | */ |
| 429 | public function getScheduleRotation() |
| 430 | { |
| 431 | return $this->scheduleRotation; |
| 432 | } |
| 433 | |
| 434 | /** |
| 435 | * @param int $scheduleRotation |
| 436 | */ |
| 437 | public function setScheduleRotation($scheduleRotation) |
| 438 | { |
| 439 | $this->scheduleRotation = $scheduleRotation; |
| 440 | } |
| 441 | |
| 442 | /** |
| 443 | * @return string |
| 444 | */ |
| 445 | public function getBackupFilePath() |
| 446 | { |
| 447 | return $this->backupFilePath; |
| 448 | } |
| 449 | |
| 450 | /** |
| 451 | * @param string $backupFilePath |
| 452 | */ |
| 453 | public function setBackupFilePath($backupFilePath) |
| 454 | { |
| 455 | $this->backupFilePath = $backupFilePath; |
| 456 | } |
| 457 | |
| 458 | /** |
| 459 | * @return string |
| 460 | */ |
| 461 | public function getScheduleId() |
| 462 | { |
| 463 | return $this->scheduleId; |
| 464 | } |
| 465 | |
| 466 | /** |
| 467 | * @param string $scheduleId |
| 468 | */ |
| 469 | public function setScheduleId($scheduleId) |
| 470 | { |
| 471 | $this->scheduleId = $scheduleId; |
| 472 | } |
| 473 | |
| 474 | /** |
| 475 | * @return bool |
| 476 | */ |
| 477 | public function getIsCreateScheduleBackupNow() |
| 478 | { |
| 479 | return $this->isCreateScheduleBackupNow; |
| 480 | } |
| 481 | |
| 482 | /** |
| 483 | * @param bool $isCreateScheduleBackupNow |
| 484 | */ |
| 485 | public function setIsCreateScheduleBackupNow($isCreateScheduleBackupNow) |
| 486 | { |
| 487 | $this->isCreateScheduleBackupNow = (bool)$isCreateScheduleBackupNow; |
| 488 | } |
| 489 | |
| 490 | /** |
| 491 | * @return array|null |
| 492 | */ |
| 493 | public function getSitesToBackup() |
| 494 | { |
| 495 | return (array)$this->sitesToBackup; |
| 496 | } |
| 497 | |
| 498 | public function setSitesToBackup(array $sitesToBackup = []) |
| 499 | { |
| 500 | $this->sitesToBackup = $sitesToBackup; |
| 501 | } |
| 502 | |
| 503 | /** |
| 504 | * @return bool |
| 505 | */ |
| 506 | public function getIsMultipartBackup() |
| 507 | { |
| 508 | return apply_filters('wpstg.backup.isMultipartBackup', $this->isMultipartBackup); |
| 509 | } |
| 510 | |
| 511 | /** |
| 512 | * @param bool $isMultipartBackup |
| 513 | */ |
| 514 | public function setIsMultipartBackup($isMultipartBackup) |
| 515 | { |
| 516 | $this->isMultipartBackup = $isMultipartBackup; |
| 517 | } |
| 518 | |
| 519 | /** |
| 520 | * @return int |
| 521 | */ |
| 522 | public function getMaxMultipartBackupSize() |
| 523 | { |
| 524 | return apply_filters('wpstg.backup.maxMultipartBackupSize', $this->maxMultipartBackupSize); |
| 525 | } |
| 526 | |
| 527 | /** |
| 528 | * @param int $maxMultipartBackupSize |
| 529 | */ |
| 530 | public function setMaxMultipartBackupSize($maxMultipartBackupSize) |
| 531 | { |
| 532 | $this->maxMultipartBackupSize = $maxMultipartBackupSize; |
| 533 | } |
| 534 | |
| 535 | /** |
| 536 | * @return array |
| 537 | */ |
| 538 | public function getDiscoveredFilesArray() |
| 539 | { |
| 540 | return $this->discoveredFilesArray; |
| 541 | } |
| 542 | |
| 543 | /** |
| 544 | * @param array $discoveredFiles |
| 545 | */ |
| 546 | public function setDiscoveredFilesArray($discoveredFiles = []) |
| 547 | { |
| 548 | $this->discoveredFilesArray = $discoveredFiles; |
| 549 | } |
| 550 | |
| 551 | /** |
| 552 | * @param string $category |
| 553 | * @return int |
| 554 | */ |
| 555 | public function getDiscoveredFilesByCategory($category) |
| 556 | { |
| 557 | if (!array_key_exists($category, $this->discoveredFilesArray)) { |
| 558 | return 0; |
| 559 | } |
| 560 | |
| 561 | return $this->discoveredFilesArray[$category]; |
| 562 | } |
| 563 | |
| 564 | /** |
| 565 | * @param string $category |
| 566 | * @param int $discoveredFiles |
| 567 | */ |
| 568 | public function setDiscoveredFilesByCategory($category, $discoveredFiles) |
| 569 | { |
| 570 | $this->discoveredFilesArray[$category] = $discoveredFiles; |
| 571 | } |
| 572 | |
| 573 | /** |
| 574 | * @return array |
| 575 | */ |
| 576 | public function getFilesInParts() |
| 577 | { |
| 578 | return $this->filesInParts; |
| 579 | } |
| 580 | |
| 581 | /** |
| 582 | * @param array $filesInParts |
| 583 | */ |
| 584 | public function setFilesInParts($filesInParts = []) |
| 585 | { |
| 586 | $this->filesInParts = $filesInParts; |
| 587 | } |
| 588 | |
| 589 | /** |
| 590 | * @param string $category |
| 591 | * @param int $categoryIndex |
| 592 | * @return int |
| 593 | */ |
| 594 | public function getFilesInPart($category, $categoryIndex) |
| 595 | { |
| 596 | if (!array_key_exists($category, $this->filesInParts)) { |
| 597 | return 0; |
| 598 | } |
| 599 | |
| 600 | if (!isset($this->filesInParts[$category][$categoryIndex])) { |
| 601 | return 0; |
| 602 | } |
| 603 | |
| 604 | return $this->filesInParts[$category][$categoryIndex]; |
| 605 | } |
| 606 | |
| 607 | /** |
| 608 | * @param string $category |
| 609 | * @param int $categoryIndex |
| 610 | * @param int $files |
| 611 | */ |
| 612 | public function setFilesInPart($category, $categoryIndex, $files) |
| 613 | { |
| 614 | if (!array_key_exists($category, $this->filesInParts)) { |
| 615 | $this->filesInParts[$category] = []; |
| 616 | } |
| 617 | |
| 618 | $this->filesInParts[$category][$categoryIndex] = $files; |
| 619 | } |
| 620 | |
| 621 | /** |
| 622 | * @return array |
| 623 | */ |
| 624 | public function getFileBackupIndices() |
| 625 | { |
| 626 | return $this->fileBackupIndices; |
| 627 | } |
| 628 | |
| 629 | /** |
| 630 | * @param array $fileBackupIndices |
| 631 | */ |
| 632 | public function setFileBackupIndices($fileBackupIndices = []) |
| 633 | { |
| 634 | $this->fileBackupIndices = $fileBackupIndices; |
| 635 | } |
| 636 | |
| 637 | /** |
| 638 | * @return int |
| 639 | */ |
| 640 | public function getMaxDbPartIndex() |
| 641 | { |
| 642 | return $this->maxDbPartIndex; |
| 643 | } |
| 644 | |
| 645 | /** |
| 646 | * @param int $maxDbPartIndex |
| 647 | */ |
| 648 | public function setMaxDbPartIndex($maxDbPartIndex) |
| 649 | { |
| 650 | $this->maxDbPartIndex = $maxDbPartIndex; |
| 651 | } |
| 652 | |
| 653 | /** |
| 654 | * @return int |
| 655 | */ |
| 656 | public function getCurrentMultipartFileInfoIndex() |
| 657 | { |
| 658 | return $this->currentMultipartFileInfoIndex; |
| 659 | } |
| 660 | |
| 661 | /** |
| 662 | * @param int $currentMultipartFileInfoIndex |
| 663 | */ |
| 664 | public function setCurrentMultipartFileInfoIndex($currentMultipartFileInfoIndex) |
| 665 | { |
| 666 | $this->currentMultipartFileInfoIndex = $currentMultipartFileInfoIndex; |
| 667 | } |
| 668 | |
| 669 | /** |
| 670 | * @return array |
| 671 | */ |
| 672 | public function getMultipartFilesInfo() |
| 673 | { |
| 674 | return $this->multipartFilesInfo; |
| 675 | } |
| 676 | |
| 677 | /** |
| 678 | * @param array $multipartFilesInfo |
| 679 | */ |
| 680 | public function setMultipartFilesInfo($multipartFilesInfo) |
| 681 | { |
| 682 | $this->multipartFilesInfo = $multipartFilesInfo; |
| 683 | } |
| 684 | |
| 685 | /** |
| 686 | * @param array $multipartFileInfo |
| 687 | */ |
| 688 | public function addMultipartFileInfo($multipartFileInfo) |
| 689 | { |
| 690 | $this->multipartFilesInfo[] = $multipartFileInfo; |
| 691 | } |
| 692 | |
| 693 | /** |
| 694 | * @param array $multipartFileInfo |
| 695 | * @param int $index |
| 696 | */ |
| 697 | public function updateMultipartFileInfo($multipartFileInfo, $index) |
| 698 | { |
| 699 | $this->multipartFilesInfo[$index] = $multipartFileInfo; |
| 700 | } |
| 701 | |
| 702 | /** |
| 703 | * @param int $lastInsertId |
| 704 | */ |
| 705 | public function setLastInsertId($lastInsertId) |
| 706 | { |
| 707 | $this->lastInsertId = $lastInsertId; |
| 708 | } |
| 709 | |
| 710 | /** |
| 711 | * @return int |
| 712 | */ |
| 713 | public function getLastInsertId() |
| 714 | { |
| 715 | return $this->lastInsertId; |
| 716 | } |
| 717 | |
| 718 | /** |
| 719 | * @param array<string, int> $categorySizes |
| 720 | */ |
| 721 | public function setCategorySizes($categorySizes) |
| 722 | { |
| 723 | $this->categorySizes = $categorySizes; |
| 724 | } |
| 725 | |
| 726 | /** |
| 727 | * @return array<string, int> |
| 728 | */ |
| 729 | public function getCategorySizes() |
| 730 | { |
| 731 | return $this->categorySizes; |
| 732 | } |
| 733 | |
| 734 | /** |
| 735 | * @param bool $isNetworkSiteBackup |
| 736 | * @return void |
| 737 | */ |
| 738 | public function setIsNetworkSiteBackup(bool $isNetworkSiteBackup) |
| 739 | { |
| 740 | $this->isNetworkSiteBackup = $isNetworkSiteBackup; |
| 741 | } |
| 742 | |
| 743 | /** |
| 744 | * @return bool |
| 745 | */ |
| 746 | public function getIsNetworkSiteBackup(): bool |
| 747 | { |
| 748 | return (bool)$this->isNetworkSiteBackup; |
| 749 | } |
| 750 | |
| 751 | /** |
| 752 | * @param string $backupType |
| 753 | * @return void |
| 754 | */ |
| 755 | public function setBackupType(string $backupType) |
| 756 | { |
| 757 | $this->backupType = $backupType; |
| 758 | } |
| 759 | |
| 760 | /** |
| 761 | * @return string |
| 762 | */ |
| 763 | public function getBackupType(): string |
| 764 | { |
| 765 | return $this->backupType; |
| 766 | } |
| 767 | |
| 768 | /** |
| 769 | * @param int|null $subsiteBlogId |
| 770 | * @return void |
| 771 | */ |
| 772 | public function setSubsiteBlogId($subsiteBlogId) |
| 773 | { |
| 774 | $this->subsiteBlogId = $subsiteBlogId; |
| 775 | } |
| 776 | |
| 777 | /** |
| 778 | * @return int |
| 779 | */ |
| 780 | public function getSubsiteBlogId(): int |
| 781 | { |
| 782 | if (empty($this->subsiteBlogId)) { |
| 783 | $this->subsiteBlogId = get_current_blog_id(); |
| 784 | } |
| 785 | |
| 786 | return (int)$this->subsiteBlogId; |
| 787 | } |
| 788 | } |
| 789 |