Create
1 month ago
Delete
1 month ago
Reset
1 month ago
Update
1 month ago
AbstractAjaxPrepare.php
1 month ago
Create.php
5 days ago
Delete.php
5 days ago
DirectoryChildren.php
4 weeks ago
Listing.php
10 months ago
Repair.php
8 months ago
Reset.php
5 days ago
Setup.php
1 month ago
SizeCalculator.php
4 weeks ago
StagingSiteDataChecker.php
5 months ago
Update.php
5 days ago
Delete.php
38 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\StagingSiteDelete; |
| 9 | use WPStaging\Framework\Traits\JobResponseTrait; |
| 10 | |
| 11 | class Delete extends AbstractTemplateComponent |
| 12 | { |
| 13 | use JobResponseTrait; |
| 14 | use MemoryExhaustTrait; |
| 15 | |
| 16 | /** |
| 17 | * @var string |
| 18 | */ |
| 19 | const WPSTG_REQUEST = 'wpstg_delete'; |
| 20 | |
| 21 | /** |
| 22 | * @return void |
| 23 | */ |
| 24 | public function ajaxDelete() |
| 25 | { |
| 26 | if (!$this->canRenderAjax()) { |
| 27 | return; |
| 28 | } |
| 29 | |
| 30 | $tmpFileToDelete = $this->getMemoryExhaustErrorTmpFile(self::WPSTG_REQUEST); |
| 31 | |
| 32 | $jobDelete = WPStaging::make(StagingSiteDelete::class); // @phpstan-ignore-line |
| 33 | $jobDelete->setMemoryExhaustErrorTmpFile($tmpFileToDelete); // @phpstan-ignore-line |
| 34 | |
| 35 | $this->sendJobResponse($jobDelete); |
| 36 | } |
| 37 | } |
| 38 |