PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backups, Restore, Migration & Clone / 4.11.1
WP STAGING – WordPress Backups, Restore, Migration & Clone v4.11.1
4.11.1 4.11.0 4.10.0 4.9.5 4.9.4 4.9.3 4.9.2 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 6 days ago BackgroundProcessing 1 week ago Dto 6 days ago Entity 1 week ago Exceptions 1 week ago FileHeader 1 week ago Interfaces 1 week ago Job 6 days ago Request 1 week ago Service 6 days ago Storage 1 week ago Task 6 days ago Traits 1 week ago Utils 1 week ago AfterRestore.php 1 week ago BackupDeleter.php 1 week ago BackupDownload.php 1 week ago BackupFileIndex.php 1 week ago BackupGlitchReason.php 1 week ago BackupHeader.php 6 days ago BackupNextOffer.php 1 week ago BackupRepairer.php 1 week ago BackupRetentionHandler.php 1 week ago BackupScheduler.php 6 days ago BackupServiceProvider.php 1 week ago BackupValidator.php 6 days ago BeforeUpdateRowStatus.php 1 week ago FileHeader.php 1 week ago FileHeaderAttribute.php 1 week ago UpdateProtectionPausedNotice.php 1 week ago WithBackupIdentifier.php 1 week ago
AfterRestore.php
67 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\Facades\Hooks;
8 use WPStaging\Framework\Security\AccessToken;
9 use WPStaging\Framework\ThirdParty\NinjaForms;
10
11 class AfterRestore
12 {
13
14 const FILTER_BACKUP_IMPORT_DATABASE_DROP_OLD_TABLES_AFTER_RESTORE = 'wpstg.backup.import.database.dropOldTablesAfterRestore';
15
16
17
18
19 protected $tableService;
20
21
22
23
24 protected $accessToken;
25
26
27
28
29 protected $ninjaForms;
30
31
32
33
34
35
36 public function __construct(TableService $tableService, AccessToken $accessToken, NinjaForms $ninjaForms)
37 {
38 $this->tableService = $tableService;
39 $this->accessToken = $accessToken;
40 $this->ninjaForms = $ninjaForms;
41 }
42
43
44
45
46
47 public function loginAfterRestore()
48 {
49
50 if (get_option('wpstg.restore.justRestored') !== 'yes') {
51 return;
52 }
53
54
55 add_filter('automatic_updater_disabled', '__return_false');
56
57 if (Hooks::applyFilters(self::FILTER_BACKUP_IMPORT_DATABASE_DROP_OLD_TABLES_AFTER_RESTORE, true)) {
58 $this->tableService->deleteTablesStartWith(DatabaseImporter::TMP_DATABASE_PREFIX_TO_DROP, [], true);
59 }
60
61 $this->ninjaForms->mayBeDisableMaintenanceMode();
62 $this->accessToken->generateNewToken();
63 delete_option('wpstg.restore.justRestored');
64 delete_option('wpstg.restore.justRestored.metadata');
65 }
66 }
67