PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backup, Restore, Migration & Clone / 3.1.3
WP STAGING – WordPress Backup, Restore, Migration & Clone v3.1.3
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 3 years ago Job 2 years ago Request 2 years ago Service 2 years ago Storage 2 years ago Task 2 years ago AfterRestore.php 3 years ago BackupDeleter.php 3 years ago BackupDownload.php 3 years ago BackupProcessLock.php 3 years ago BackupRepairer.php 3 years ago BackupScheduler.php 2 years ago BackupServiceProvider.php 2 years ago BackupValidator.php 2 years ago WithBackupIdentifier.php 2 years ago wpstgBackupHeader.txt 3 years ago
AfterRestore.php
43 lines
1 <?php
2
3 namespace WPStaging\Backup;
4
5 use WPStaging\Framework\Database\TableService;
6 use WPStaging\Framework\Security\AccessToken;
7 use WPStaging\Backup\Ajax\Restore\PrepareRestore;
8
9 class AfterRestore
10 {
11 protected $tableService;
12 protected $accessToken;
13
14 public function __construct(TableService $tableService, AccessToken $accessToken)
15 {
16 $this->tableService = $tableService;
17 $this->accessToken = $accessToken;
18 }
19
20 /**
21 * @action wp_login
22 * @see \WPStaging\Backup\BackupServiceProvider::addHooks
23 */
24 public function loginAfterRestore()
25 {
26 // Early bail: Not a login after a successful restore
27 if (get_option('wpstg.restore.justRestored') !== 'yes') {
28 return;
29 }
30
31 // Disable WordPress automatic background updates on this request.
32 add_filter('automatic_updater_disabled', '__return_false');
33
34 if (apply_filters('wpstg.backup.import.database.dropOldTablesAfterRestore', true)) {
35 $this->tableService->deleteTablesStartWith(PrepareRestore::TMP_DATABASE_PREFIX_TO_DROP, [], true);
36 }
37
38 $this->accessToken->generateNewToken();
39 delete_option('wpstg.restore.justRestored');
40 delete_option('wpstg.restore.justRestored.metadata');
41 }
42 }
43