-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclass-update-1100.php
More file actions
50 lines (44 loc) · 1.31 KB
/
class-update-1100.php
File metadata and controls
50 lines (44 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Update class for version 1.10.0.
*
* @package Progress_Planner
*/
namespace Progress_Planner\Update;
/**
* Update class for version 1.10.0.
*
* @package Progress_Planner
*/
class Update_1100 {
const VERSION = '1.10.0';
/**
* Run the update.
*
* @return void
*/
public function run() {
// Delete the prpl_redirect_on_login user meta for all users.
// The settings page has been removed, so users can no longer change this setting.
$this->delete_redirect_on_login_user_meta();
}
/**
* Delete the prpl_redirect_on_login user meta for all users.
*
* The settings page that allowed users to set their login destination
* has been removed. This migration deletes the user meta to prevent
* users from being redirected to Progress Planner after login.
*
* @return void
*/
private function delete_redirect_on_login_user_meta() {
global $wpdb;
// Delete the user meta for all users directly from the database.
// This is more efficient than looping through all users.
$wpdb->delete( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$wpdb->usermeta, // @phpstan-ignore-line property.nonObject
[ 'meta_key' => 'prpl_redirect_on_login' ], // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
[ '%s' ]
);
}
}