From 183851b06bd6c52f3cae5375f433da720d410447 Mon Sep 17 00:00:00 2001
From: Pierre Schmitz <pierre@archlinux.de>
Date: Wed, 11 Oct 2006 18:12:39 +0000
Subject: MediaWiki 1.7.1 wiederhergestellt

---
 maintenance/archives/patch-ipb_range_start.sql | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 maintenance/archives/patch-ipb_range_start.sql

(limited to 'maintenance/archives/patch-ipb_range_start.sql')

diff --git a/maintenance/archives/patch-ipb_range_start.sql b/maintenance/archives/patch-ipb_range_start.sql
new file mode 100644
index 00000000..c31e2d9c
--- /dev/null
+++ b/maintenance/archives/patch-ipb_range_start.sql
@@ -0,0 +1,25 @@
+-- Add the range handling fields
+ALTER TABLE /*$wgDBprefix*/ipblocks 
+  ADD ipb_range_start varchar(32) NOT NULL default '',
+  ADD ipb_range_end varchar(32) NOT NULL default '',
+  ADD INDEX ipb_range (ipb_range_start(8), ipb_range_end(8));
+
+
+-- Initialise fields
+-- Only range blocks match ipb_address LIKE '%/%', this fact is used in the code already
+UPDATE /*$wgDBprefix*/ipblocks 
+  SET 
+    ipb_range_start = LPAD(HEX( 
+        (SUBSTRING_INDEX(ipb_address, '.', 1) << 24)
+      + (SUBSTRING_INDEX(SUBSTRING_INDEX(ipb_address, '.', 2), '.', -1) << 16)
+      + (SUBSTRING_INDEX(SUBSTRING_INDEX(ipb_address, '.', 3), '.', -1) << 24)
+      + (SUBSTRING_INDEX(SUBSTRING_INDEX(ipb_address, '/', 1), '.', -1)) ), 8, '0' ),
+
+    ipb_range_end = LPAD(HEX( 
+        (SUBSTRING_INDEX(ipb_address, '.', 1) << 24)
+      + (SUBSTRING_INDEX(SUBSTRING_INDEX(ipb_address, '.', 2), '.', -1) << 16)
+      + (SUBSTRING_INDEX(SUBSTRING_INDEX(ipb_address, '.', 3), '.', -1) << 24)
+      + (SUBSTRING_INDEX(SUBSTRING_INDEX(ipb_address, '/', 1), '.', -1))
+      + ((1 << (32 - SUBSTRING_INDEX(ipb_address, '/', -1))) - 1) ), 8, '0' )
+
+  WHERE ipb_address LIKE '%/%';
-- 
cgit v1.2.3-54-g00ecf

