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 / 231.php

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

54 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Note: not localised as the messages aren't important enough
4 class Red_Database_231 extends Red_Database_Upgrader {
5 /**
6 * @return array<string, string>
7 */
8 public function get_stages() {
9 return [
10 'remove_404_module_231' => 'Remove 404 module',
11 'create_404_table_231' => 'Create 404 table',
12 ];
13 }
14
15 /**
16 * @param \wpdb $wpdb
17 * @return bool
18 */
19 protected function remove_404_module_231( $wpdb ) {
20 return $this->do_query( $wpdb, "UPDATE {$wpdb->prefix}redirection_groups SET module_id=1 WHERE module_id=3" );
21 }
22
23 /**
24 * @param \wpdb $wpdb
25 * @return bool
26 */
27 protected function create_404_table_231( $wpdb ) {
28 $this->do_query( $wpdb, $this->get_404_table( $wpdb ) );
29 return true;
30 }
31
32 /**
33 * @param \wpdb $wpdb
34 * @return string
35 */
36 private function get_404_table( $wpdb ) {
37 $charset_collate = $this->get_charset();
38
39 return "CREATE TABLE `{$wpdb->prefix}redirection_404` (
40 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
41 `created` datetime NOT NULL,
42 `url` varchar(255) NOT NULL DEFAULT '',
43 `agent` varchar(255) DEFAULT NULL,
44 `referrer` varchar(255) DEFAULT NULL,
45 `ip` int(10) unsigned NOT NULL,
46 PRIMARY KEY (`id`),
47 KEY `created` (`created`),
48 KEY `url` (`url`(191)),
49 KEY `ip` (`ip`),
50 KEY `referrer` (`referrer`(191))
51 ) $charset_collate";
52 }
53 }
54