Squid url redirector

Check-in [4b22e25f24]
anonymous

Check-in [4b22e25f24]

Overview
Comment: * fixed log enabling; * added missed index; * domain is not stored anymore.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: 4b22e25f24ba760d6da8d72a100537771fac9c2b36a759be11b6015fca7b961e
User & Date: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 on 2009-10-07 12:54:23.000
Other Links: branch diff | manifest | tags
Context
2009-10-07
14:20
* added array sorting functions; * indexes modified to check array uniqueness. check-in: e0ecab03f9 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk
12:54
* fixed log enabling; * added missed index; * domain is not stored anymore. check-in: 4b22e25f24 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk
2009-10-05
11:25
* added regexp logging and fixed processing records with regexps; * added simple documentation and sample config file; * file renamed to match contents. check-in: d500448801 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk
Changes
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
	id_tag smallint NOT NULL
);

ALTER TABLE ONLY rules
	ADD CONSTRAINT rules_pkey PRIMARY KEY (netmask);

-- table to hold site arrays
-- maybe full original domain should be added with trigger to leave tripdomain function away
CREATE TABLE site (
	id_site serial,
	site text[] NOT NULL,
	domain not null
);

ALTER TABLE ONLY site
	ADD CONSTRAINT site_id PRIMARY KEY (id_site);

CREATE UNIQUE INDEX site_s ON site USING btree (site);








<


|
<







132
133
134
135
136
137
138

139
140
141

142
143
144
145
146
147
148
	id_tag smallint NOT NULL
);

ALTER TABLE ONLY rules
	ADD CONSTRAINT rules_pkey PRIMARY KEY (netmask);

-- table to hold site arrays

CREATE TABLE site (
	id_site serial,
	site text[] NOT NULL

);

ALTER TABLE ONLY site
	ADD CONSTRAINT site_id PRIMARY KEY (id_site);

CREATE UNIQUE INDEX site_s ON site USING btree (site);

171
172
173
174
175
176
177


178
179
180
181
182
183
184
	regex text
);

ALTER TABLE ONLY urls
	ADD CONSTRAINT urls_pkey PRIMARY KEY (date_added);

CREATE UNIQUE INDEX urls_id_site ON urls USING btree (id_site);



-- rule to join all tables into one to simplify access
-- automaticall uses current day and time data
CREATE VIEW site_rule AS
SELECT a.redirect_url, a.netmask, b.site, b.regexp
FROM ((
	SELECT rules.redirect_url, tag.tag AS rule_tag, rules.netmask







>
>







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
	regex text
);

ALTER TABLE ONLY urls
	ADD CONSTRAINT urls_pkey PRIMARY KEY (date_added);

CREATE UNIQUE INDEX urls_id_site ON urls USING btree (id_site);

CREATE UNIQUE INDEX urls_id_tag ON urls USING btree (id_tag);

-- rule to join all tables into one to simplify access
-- automaticall uses current day and time data
CREATE VIEW site_rule AS
SELECT a.redirect_url, a.netmask, b.site, b.regexp
FROM ((
	SELECT rules.redirect_url, tag.tag AS rule_tag, rules.netmask
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
			self._syslog = None
		else:
			import syslog
			self._syslog = syslog
			self._syslog.openlog('squidTag')

	def info(self, message):
		if not self._syslog:
			self._syslog.syslog(self._syslog.LOG_INFO, message)

	def notice(self, message):
		if not self._syslog:
			self._syslog.syslog(self._syslog.LOG_NOTICE, message)

class tagDB:
	__slots__ = frozenset(['_prepared', '_check_stmt', '_db'])

	def __init__(self):
		self._prepared = set()







|



|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
			self._syslog = None
		else:
			import syslog
			self._syslog = syslog
			self._syslog.openlog('squidTag')

	def info(self, message):
		if self._syslog:
			self._syslog.syslog(self._syslog.LOG_INFO, message)

	def notice(self, message):
		if self._syslog:
			self._syslog.syslog(self._syslog.LOG_NOTICE, message)

class tagDB:
	__slots__ = frozenset(['_prepared', '_check_stmt', '_db'])

	def __init__(self):
		self._prepared = set()