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