PluginProbe
Redirection / 5.6.0
Redirection v5.6.0
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
redirection / database / schema / 410.php

410.php in Redirection 5.6.0, at database/schema/410.php

25 lines 765 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class Red_Database_410 extends Red_Database_Upgrader {
4 /**
5 * @return array<string, string>
6 */
7 public function get_stages() {
8 return [
9 'handle_double_slash' => 'Support double-slash URLs',
10 ];
11 }
12
13 /**
14 * @param \wpdb $wpdb
15 * @return bool
16 */
17 protected function handle_double_slash( $wpdb ) {
18 // Update any URL with a double slash at the end
19 $this->do_query( $wpdb, "UPDATE `{$wpdb->prefix}redirection_items` SET match_url=LOWER(LEFT(SUBSTRING_INDEX(url, '?', 1),LENGTH(SUBSTRING_INDEX(url, '?', 1)) - 1)) WHERE RIGHT(SUBSTRING_INDEX(url, '?', 1), 2) = '//' AND regex=0" );
20
21 // Any URL that is now empty becomes /
22 return $this->do_query( $wpdb, "UPDATE `{$wpdb->prefix}redirection_items` SET match_url='/' WHERE match_url=''" );
23 }
24 }
25