Ticket #2813: patch.txt

File patch.txt, 7.5 KB (added by h4ck3rm1k3, 4 years ago)

New patch with website

Line 
1Index: gazetteer/util.update.php
2===================================================================
3--- gazetteer/util.update.php   (revision 20572)
4+++ gazetteer/util.update.php   (working copy)
5@@ -47,13 +47,19 @@
6        $sBasePath = dirname(dirname(__FILE__));
7 
8        require_once('DB.php');
9-       $oDB =& DB::connect('pgsql://@/gazetteer', false);
10-       if (PEAR::IsError($oDB))
11-       {
12-               echo $oDB->getMessage()."\n";
13-               exit;
14-       }
15-       $oDB->setFetchMode(DB_FETCHMODE_ASSOC);
16+       /// pgsql://user:password@host/database"
17+//             $oDB =& DB::connect('pgsql://gis@userpass/localhost/gisdb', false);
18
19+try {         
20+       $oDB = new PDO("pgsql:dbname=gisdb;host=localhost", "gis", "" );
21+        $oDB->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
22+}
23+catch(PDOException $e)
24+{
25+    echo $e->getMessage();
26+    exit;
27+}
28+//     $oDB->setFetchMode(DB_FETCHMODE_ASSOC);
29        $oDB->query("SET DateStyle TO 'sql,european'");
30        $oDB->query("SET client_encoding TO 'utf-8'");
31 
32@@ -182,7 +188,14 @@
33                        flush();
34                       
35                        $sSQL = 'select geometry_index(geometry,indexed,name),count(*) from placex where rank_search = '.$i.' and indexed = false and name is not null '.$sModSQL.'group by geometry_index(geometry,indexed,name)';
36-                       $aAllSectors = $oDB->getAll($sSQL);
37+//                     $aAllSectors =$oDB->getAll($sSQL);
38+
39+               
40+                               $sth=$oDB->prepare($sSQL);
41+                       $sth->execute();
42+                       $aAllSectors = $sth->fetchAll($fetch);//$stmt->fetchAll($fetch);
43+
44+
45                        $iTotalNum = 0;
46                        foreach($aAllSectors as $aSector)
47                        {
48Index: gazetteer/reindex.php
49===================================================================
50--- gazetteer/reindex.php       (revision 20572)
51+++ gazetteer/reindex.php       (working copy)
52@@ -1,6 +1,6 @@
53 <?php
54        require_once('DB.php');
55-       $oDB =& DB::connect('pgsql://@/gazetteerworld', false);
56+       $oDB =& DB::connect('pgsql://gis@/localhost/gisdb', false);
57        $oDB->setFetchMode(DB_FETCHMODE_ASSOC);
58        $oDB->query("SET DateStyle TO 'sql,european'");
59        $oDB->query("SET client_encoding TO 'utf-8'");
60Index: gazetteer/import_country_name.sql
61===================================================================
62--- gazetteer/import_country_name.sql   (revision 20572)
63+++ gazetteer/import_country_name.sql   (working copy)
64@@ -15,7 +15,7 @@
65 SET default_with_oids = false;
66 
67 --
68--- Name: country_name; Type: TABLE; Schema: public; Owner: twain; Tablespace:
69+-- Name: country_name; Type: TABLE; Schema: public; Owner: gis; Tablespace:
70 --
71 
72 CREATE TABLE country_name (
73@@ -25,10 +25,10 @@
74 );
75 
76 
77-ALTER TABLE public.country_name OWNER TO twain;
78+ALTER TABLE public.country_name OWNER TO gis;
79 
80 --
81--- Data for Name: country_name; Type: TABLE DATA; Schema: public; Owner: twain
82+-- Data for Name: country_name; Type: TABLE DATA; Schema: public; Owner: gis
83 --
84 
85 COPY country_name (country_code, name, country_default_language_code) FROM stdin;
86@@ -259,19 +259,19 @@
87 
88 
89 --
90--- Name: idx_country_name_country_code; Type: INDEX; Schema: public; Owner: twain; Tablespace:
91+-- Name: idx_country_name_country_code; Type: INDEX; Schema: public; Owner: gis; Tablespace:
92 --
93 
94 CREATE INDEX idx_country_name_country_code ON country_name USING btree (country_code);
95 
96 
97 --
98--- Name: country_name; Type: ACL; Schema: public; Owner: twain
99+-- Name: country_name; Type: ACL; Schema: public; Owner: gis
100 --
101 
102 REVOKE ALL ON TABLE country_name FROM PUBLIC;
103-REVOKE ALL ON TABLE country_name FROM twain;
104-GRANT ALL ON TABLE country_name TO twain;
105+REVOKE ALL ON TABLE country_name FROM gis;
106+GRANT ALL ON TABLE country_name TO gis;
107 GRANT SELECT ON TABLE country_name TO "www-data";
108 
109 
110Index: gazetteer/import_worldboundaries.sql
111===================================================================
112--- gazetteer/import_worldboundaries.sql        (revision 20572)
113+++ gazetteer/import_worldboundaries.sql        (working copy)
114@@ -15,7 +15,7 @@
115 SET default_with_oids = false;
116 
117 --
118--- Name: worldboundaries; Type: TABLE; Schema: public; Owner: twain; Tablespace:
119+-- Name: worldboundaries; Type: TABLE; Schema: public; Owner: gis; Tablespace:
120 --
121 
122 CREATE TABLE worldboundaries (
123@@ -31,10 +31,10 @@
124 );
125 
126 
127-ALTER TABLE public.worldboundaries OWNER TO twain;
128+ALTER TABLE public.worldboundaries OWNER TO gis;
129 
130 --
131--- Name: worldboundaries_gid_seq; Type: SEQUENCE; Schema: public; Owner: twain
132+-- Name: worldboundaries_gid_seq; Type: SEQUENCE; Schema: public; Owner: gis
133 --
134 
135 CREATE SEQUENCE worldboundaries_gid_seq
136@@ -44,31 +44,31 @@
137     CACHE 1;
138 
139 
140-ALTER TABLE public.worldboundaries_gid_seq OWNER TO twain;
141+ALTER TABLE public.worldboundaries_gid_seq OWNER TO gis;
142 
143 --
144--- Name: worldboundaries_gid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: twain
145+-- Name: worldboundaries_gid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: gis
146 --
147 
148 ALTER SEQUENCE worldboundaries_gid_seq OWNED BY worldboundaries.gid;
149 
150 
151 --
152--- Name: worldboundaries_gid_seq; Type: SEQUENCE SET; Schema: public; Owner: twain
153+-- Name: worldboundaries_gid_seq; Type: SEQUENCE SET; Schema: public; Owner: gis
154 --
155 
156 SELECT pg_catalog.setval('worldboundaries_gid_seq', 3807, true);
157 
158 
159 --
160--- Name: gid; Type: DEFAULT; Schema: public; Owner: twain
161+-- Name: gid; Type: DEFAULT; Schema: public; Owner: gis
162 --
163 
164 ALTER TABLE worldboundaries ALTER COLUMN gid SET DEFAULT nextval('worldboundaries_gid_seq'::regclass);
165 
166 
167 --
168--- Data for Name: worldboundaries; Type: TABLE DATA; Schema: public; Owner: twain
169+-- Data for Name: worldboundaries; Type: TABLE DATA; Schema: public; Owner: gis
170 --
171 
172 COPY worldboundaries (gid, cat, fips_cntry, cntry_name, the_geom, iso3166) FROM stdin;
173@@ -3883,7 +3883,7 @@
174 
175 
176 --
177--- Name: worldboundaries_pkey; Type: CONSTRAINT; Schema: public; Owner: twain; Tablespace:
178+-- Name: worldboundaries_pkey; Type: CONSTRAINT; Schema: public; Owner: gis; Tablespace:
179 --
180 
181 ALTER TABLE ONLY worldboundaries
182Index: gazetteer/gazetteer-functions.sql
183===================================================================
184--- gazetteer/gazetteer-functions.sql   (revision 20572)
185+++ gazetteer/gazetteer-functions.sql   (working copy)
186@@ -120,7 +120,7 @@
187 LANGUAGE plpgsql;
188 
189 CREATE OR REPLACE FUNCTION transliteration(text) RETURNS text
190-  AS '/home/twain/osm2pgsql/gazetteer/gazetteer.so', 'transliteration'
191+  AS '/media/sdd2/home/mdupont/2010/03/shokder/nomatim/osm2pgsql/gazetteer/gazetteer.so', 'transliteration'
192 LANGUAGE c IMMUTABLE STRICT;
193 
194 CREATE OR REPLACE FUNCTION make_standard_name(name TEXT) RETURNS TEXT
195Index: gazetteer/util.index.php
196===================================================================
197--- gazetteer/util.index.php    (revision 20572)
198+++ gazetteer/util.index.php    (working copy)
199@@ -1,7 +1,17 @@
200 <?php
201        require_once('DB.php');
202-       $oDB =& DB::connect('pgsql://@/gazetteerworld', false);
203-       $oDB->setFetchMode(DB_FETCHMODE_ASSOC);
204+//     $oDB =& DB::connect('pgsql://@/gisdb', false);
205+try {         
206+       $oDB = new PDO("pgsql:dbname=gisdb;host=localhost", "gis", "" );
207+        $oDB->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
208+}
209+catch(PDOException $e)
210+{
211+    echo $e->getMessage();
212+    exit;
213+}
214+
215+//     $oDB->setFetchMode(DB_FETCHMODE_ASSOC);
216        $oDB->query("SET DateStyle TO 'sql,european'");
217        $oDB->query("SET client_encoding TO 'utf-8'");
218 
219@@ -71,7 +81,7 @@
220        {
221                // Allocate a block to run
222                $oDB->query($sDebug = 'update updatearea set status = '.$iSessionID.' from ('.$sSQLAvail.') as x where updatearea.lat = x.lat and updatearea.lon = x.lon and updatearea.status = '.$iStatus_Ready);
223-               $aAllocated = $oDB->getRow('select * from updatearea where status = '.$iSessionID);
224+               $aAllocated = $oDB->query('select * from updatearea where status = '.$iSessionID)->fetch();
225                if (!$aAllocated)
226                {
227                        echo "Unable to allocate\n";