Commit e4c76f03 authored by git's avatar git Committed by bgm

Issue #1053190 by fivefrank : postgresql compat, simplify the crawler pruning...

Issue #1053190 by fivefrank : postgresql compat, simplify the crawler pruning sql query so that it works everywhere.
parent 463734df
......@@ -6255,29 +6255,15 @@ function boost_crawler_add_alias_to_table() {
* Has the site changed, if so get expire column
*/
function boost_crawler_prune_table($expire) {
global $db_type;
if (variable_get('boost_crawl_prune_table', FALSE)) {
return TRUE;
}
// PostgreSQL
if (stristr($db_type, 'pgsql')) {
if ($expire && BOOST_LOOPBACK_BYPASS) {
db_query("DELETE cr FROM {boost_crawler} cr USING {boost_cache} AS ca WHERE cr.hash=ca.hash_url AND ca.expire BETWEEN 1 AND 434966399 OR ca.expire > %d", BOOST_TIME);
}
else {
db_query("DELETE cr FROM {boost_crawler} cr USING {boost_cache} AS ca WHERE cr.hash=ca.hash_url AND ca.expire BETWEEN 1 AND 434966399 OR ca.expire > 434966400");
}
if ($expire && BOOST_LOOPBACK_BYPASS) {
db_query("DELETE FROM {boost_crawler} cr WHERE cr.hash IN (SELECT ca.hash_url FROM {boost_cache} ca WHERE ca.expire BETWEEN 1 AND 434966399 OR ca.expire > %d)", BOOST_TIME);
}
// All others
else {
if ($expire && BOOST_LOOPBACK_BYPASS) {
db_query("DELETE cr FROM {boost_crawler} cr INNER JOIN {boost_cache} AS ca ON cr.hash=ca.hash_url WHERE ca.expire BETWEEN 1 AND 434966399 OR ca.expire > %d", BOOST_TIME);
}
else {
db_query("DELETE cr FROM {boost_crawler} cr INNER JOIN {boost_cache} AS ca ON cr.hash=ca.hash_url WHERE ca.expire BETWEEN 1 AND 434966399 OR ca.expire > 434966400");
}
db_query("DELETE FROM {boost_crawler} cr WHERE cr.hash IN (SELECT ca.hash_url FROM {boost_cache} ca WHERE ca.expire BETWEEN 1 AND 434966399 OR ca.expire > 434966400)");
}
variable_set('boost_crawl_prune_table', TRUE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment