PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backup, Restore, Migration & Clone / 4.3.0
WP STAGING – WordPress Backup, Restore, Migration & Clone v4.3.0
4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / Backup / AfterRestore.php
wp-staging / Backup Last commit date
Ajax 10 months ago BackgroundProcessing 1 year ago Dto 10 months ago Entity 10 months ago Exceptions 1 year ago Interfaces 1 year ago Job 10 months ago Request 1 year ago Service 10 months ago Storage 11 months ago Task 10 months ago Traits 10 months ago AfterRestore.php 1 year ago BackupDeleter.php 1 year ago BackupDownload.php 1 year ago BackupFileIndex.php 1 year ago BackupGlitchReason.php 1 year ago BackupHeader.php 10 months ago BackupRepairer.php 1 year ago BackupRetentionHandler.php 1 year ago BackupScheduler.php 11 months ago BackupServiceProvider.php 10 months ago BackupValidator.php 1 year ago FileHeader.php 10 months ago FileHeaderAttribute.php 2 years ago WithBackupIdentifier.php 1 year ago
AfterRestore.php
63 lines
1 <?php
2
3 namespace WPStaging\Backup;
4
5 use WPStaging\Backup\Service\Database\DatabaseImporter;
6 use WPStaging\Framework\Database\TableService;
7 use WPStaging\Framework\Security\AccessToken;
8 use WPStaging\Framework\ThirdParty\NinjaForms;
9
10 class AfterRestore
11 {
12 /**
13 * @var TableService
14 */
15 protected $tableService;
16
17 /**
18 * @var AccessToken
19 */
20 protected $accessToken;
21
22 /**
23 * @var NinjaForms
24 */
25 protected $ninjaForms;
26
27 /**
28 * @param TableService $tableService
29 * @param AccessToken $accessToken
30 * @param NinjaForms $ninjaForms
31 */
32 public function __construct(TableService $tableService, AccessToken $accessToken, NinjaForms $ninjaForms)
33 {
34 $this->tableService = $tableService;
35 $this->accessToken = $accessToken;
36 $this->ninjaForms = $ninjaForms;
37 }
38
39 /**
40 * @action wp_login
41 * @see \WPStaging\Backup\BackupServiceProvider::addHooks
42 */
43 public function loginAfterRestore()
44 {
45 // Early bail: Not a login after a successful restore
46 if (get_option('wpstg.restore.justRestored') !== 'yes') {
47 return;
48 }
49
50 // Disable WordPress automatic background updates on this request.
51 add_filter('automatic_updater_disabled', '__return_false');
52
53 if (apply_filters('wpstg.backup.import.database.dropOldTablesAfterRestore', true)) {
54 $this->tableService->deleteTablesStartWith(DatabaseImporter::TMP_DATABASE_PREFIX_TO_DROP, [], true);
55 }
56
57 $this->ninjaForms->mayBeDisableMaintenanceMode();
58 $this->accessToken->generateNewToken();
59 delete_option('wpstg.restore.justRestored');
60 delete_option('wpstg.restore.justRestored.metadata');
61 }
62 }
63