Create
1 day ago
Delete
2 weeks ago
Reset
2 weeks ago
Update
2 weeks ago
AbstractAjaxPrepare.php
1 day ago
Create.php
2 weeks ago
Delete.php
1 year ago
Listing.php
9 months ago
Repair.php
7 months ago
Reset.php
2 weeks ago
Setup.php
2 weeks ago
StagingSiteDataChecker.php
3 months ago
Update.php
2 weeks ago
Reset.php
44 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\StagingSiteReset; |
| 9 | |
| 10 | class Reset extends AbstractTemplateComponent |
| 11 | { |
| 12 | use MemoryExhaustTrait; |
| 13 | |
| 14 | /** |
| 15 | * @var string |
| 16 | */ |
| 17 | const WPSTG_REQUEST = 'wpstg_staging_reset'; |
| 18 | |
| 19 | /** |
| 20 | * @return void |
| 21 | */ |
| 22 | public function render() |
| 23 | { |
| 24 | if (!$this->canRenderAjax()) { |
| 25 | return; |
| 26 | } |
| 27 | |
| 28 | $tmpFileToDelete = $this->getMemoryExhaustErrorTmpFile(self::WPSTG_REQUEST); |
| 29 | |
| 30 | $jobReset = $this->getResetJob(); |
| 31 | $jobReset->setMemoryExhaustErrorTmpFile($tmpFileToDelete); |
| 32 | |
| 33 | wp_send_json($jobReset->prepareAndExecute()); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * @return StagingSiteReset |
| 38 | */ |
| 39 | protected function getResetJob() |
| 40 | { |
| 41 | return WPStaging::make(StagingSiteReset::class); |
| 42 | } |
| 43 | } |
| 44 |