Create
1 month ago
Delete
1 month ago
Reset
1 month ago
Update
1 month ago
AbstractAjaxPrepare.php
1 month ago
Create.php
4 days ago
Delete.php
4 days ago
DirectoryChildren.php
4 weeks ago
Listing.php
10 months ago
Repair.php
8 months ago
Reset.php
4 days ago
Setup.php
1 month ago
SizeCalculator.php
4 weeks ago
StagingSiteDataChecker.php
5 months ago
Update.php
4 days ago
Update.php
46 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPStaging\Staging\Ajax; |
| 4 | |
| 5 | use WPStaging\Core\WPStaging; |
| 6 | use WPStaging\Framework\Component\AbstractTemplateComponent; |
| 7 | use WPStaging\Framework\Traits\MemoryExhaustTrait; |
| 8 | use WPStaging\Staging\Jobs\StagingSiteUpdate; |
| 9 | use WPStaging\Framework\Traits\JobResponseTrait; |
| 10 | |
| 11 | class Update extends AbstractTemplateComponent |
| 12 | { |
| 13 | use JobResponseTrait; |
| 14 | use MemoryExhaustTrait; |
| 15 | |
| 16 | /** |
| 17 | * @var string |
| 18 | */ |
| 19 | const WPSTG_REQUEST = 'wpstg_staging_update'; |
| 20 | |
| 21 | /** |
| 22 | * @return void |
| 23 | */ |
| 24 | public function render() |
| 25 | { |
| 26 | if (!$this->canRenderAjax()) { |
| 27 | return; |
| 28 | } |
| 29 | |
| 30 | $tmpFileToDelete = $this->getMemoryExhaustErrorTmpFile(self::WPSTG_REQUEST); |
| 31 | |
| 32 | $jobUpdate = $this->getUpdateJob(); |
| 33 | $jobUpdate->setMemoryExhaustErrorTmpFile($tmpFileToDelete); |
| 34 | |
| 35 | $this->sendJobResponse($jobUpdate); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * @return StagingSiteUpdate |
| 40 | */ |
| 41 | protected function getUpdateJob() |
| 42 | { |
| 43 | return WPStaging::make(StagingSiteUpdate::class); |
| 44 | } |
| 45 | } |
| 46 |