PluginProbe
Redirection / 3.7
Redirection v3.7
5.10.0 5.9.0 5.8.1 5.8.0 3.7.2 3.7.3 4.0 4.0.1 4.1 4.1.1 4.2 4.2.1 4.2.2 4.2.3 4.3 4.3.1 4.3.2 4.3.3 4.4 4.4.1 4.4.2 4.5 4.5.1 4.6.2 4.7.1 All 130 releases
← All changes | database/database.php +7 -20 4.23.7 View file →
@@ -10,15 +10,13 @@
10 10 * @return array Array of versions from self::get_upgrades()
11 11 */
12 12 public function get_upgrades_for_version( $current_version, $current_stage ) {
13 13 if ( $current_version === '' ) {
14 - return [
15 - [
16 - 'version' => REDIRECTION_DB_VERSION,
17 - 'file' => 'latest.php',
18 - 'class' => 'Red_Latest_Database',
19 - ],
20 - ];
14 + return [ [
15 + 'version' => REDIRECTION_DB_VERSION,
16 + 'file' => 'latest.php',
17 + 'class' => 'Red_Latest_Database',
18 + ] ];
21 19 }
22 20
23 21 $upgraders = [];
24 22 $found = false;
@@ -51,10 +49,9 @@
51 49 public function apply_upgrade( Red_Database_Status $status ) {
52 50 $upgraders = $this->get_upgrades_for_version( $status->get_current_version(), $status->get_current_stage() );
53 51
54 52 if ( count( $upgraders ) === 0 ) {
55 - $status->set_error( 'No upgrades found for version ' . $status->get_current_version() );
56 - return;
53 + return new WP_Error( 'redirect', 'No upgrades found for version ' . $status->get_current_version() );
57 54 }
58 55
59 56 if ( $status->get_current_stage() === false ) {
60 57 if ( $status->needs_installing() ) {
@@ -75,9 +72,9 @@
75 72 }
76 73 }
77 74
78 75 public static function apply_to_sites( $callback ) {
79 - if ( is_multisite() && ( is_network_admin() || defined( 'WP_CLI' ) && WP_CLI ) ) {
76 + if ( is_network_admin() ) {
80 77 array_map( function( $site ) use ( $callback ) {
81 78 switch_to_blog( $site->blog_id );
82 79
83 80 $callback();
@@ -142,18 +139,8 @@
142 139 [
143 140 'version' => '2.4',
144 141 'file' => '240.php',
145 142 'class' => 'Red_Database_240',
146 - ],
147 - [
148 - 'version' => '4.0',
149 - 'file' => '400.php',
150 - 'class' => 'Red_Database_400',
151 - ],
152 - [
153 - 'version' => '4.1',
154 - 'file' => '410.php',
155 - 'class' => 'Red_Database_410',
156 143 ],
157 144 ];
158 145 }
159 146 }