PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backups, Restore, Migration & Clone / 3.8.4
WP STAGING – WordPress Backups, Restore, Migration & Clone v3.8.4
4.11.2 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 2 years ago BackgroundProcessing 2 years ago Dto 2 years ago Entity 2 years ago Exceptions 2 years ago Interfaces 2 years ago Job 2 years ago Request 2 years ago Service 2 years ago Storage 2 years ago Task 2 years ago AfterRestore.php 2 years ago BackupDeleter.php 2 years ago BackupDownload.php 2 years ago BackupFileIndex.php 2 years ago BackupHeader.php 2 years ago BackupRepairer.php 2 years ago BackupRetentionHandler.php 2 years ago BackupScheduler.php 2 years ago BackupServiceProvider.php 2 years ago BackupValidator.php 2 years ago FileHeader.php 2 years ago FileHeaderAttribute.php 2 years ago WithBackupIdentifier.php 2 years ago
AfterRestore.php
63 lines
1 <?php
2
3 namespace WPStaging\Backup;
4
5 use WPStaging\Backup\Ajax\Restore\PrepareRestore;
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(PrepareRestore::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