From df79d3432b6722b4e9937f15d011b3664c68e05f Mon Sep 17 00:00:00 2001 From: "Mr. E23" Date: Sun, 9 Nov 2003 23:28:06 +0000 Subject: [PATCH] Some minor PersistentLC related changes --- includes/Article.php | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 7e2188b2de..51d27dc055 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -786,11 +786,19 @@ $wgLang->recodeForEdit( $wpTextbox1 ) . "WHERE rc_cur_id=" . $this->getID(); wfQuery( $sql, DB_WRITE, $fname ); - // Purge related entries in link cache when a page change - // (probably just affects anything when article changes stub state) - $pageid=$this->getID(); - wfQuery("DELETE linkscc FROM linkscc,links ". - "WHERE lcc_title=links.l_from AND l_to={$pageid}", DB_WRITE); + if ( $wgEnablePersistentLC ) { + + // Purge link cache for this page + $pageid=$this->getID(); + wfQuery("DELETE FROM linkscc WHERE lcc_pageid='{$pageid}'", DB_WRITE); + + // This next query just makes sure stub colored links to this page + // are updated correctly (I think). If performance is more important + // than real-time updating of stub links, we really should skip + // this query. + wfQuery("DELETE linkscc FROM linkscc,links ". + "WHERE lcc_title=links.l_from AND l_to={$pageid}", DB_WRITE); + } } if( $wgDBtransactions ) { @@ -1162,23 +1170,26 @@ $wgLang->recodeForEdit( $wpTextbox1 ) . $sql = "DELETE FROM recentchanges WHERE rc_namespace={$ns} AND " . "rc_title='{$t}'"; - wfQuery( $sql, DB_WRITE, $fname ); + wfQuery( $sql, DB_WRITE, $fname ); # Finally, clean up the link tables if ( 0 != $id ) { - // Purge related entries in links cache on delete, - wfQuery("DELETE linkscc FROM linkscc,links ". - "WHERE lcc_title=links.l_from AND l_to={$id}", DB_WRITE); - wfQuery("DELETE FROM linkscc WHERE lcc_title='{$t}'", DB_WRITE); - $t = wfStrencode( $title->getPrefixedDBkey() ); + + if ( $wgEnablePersistentLC ) { + // Purge related entries in links cache on delete, + wfQuery("DELETE linkscc FROM linkscc,links ". + "WHERE lcc_title=links.l_from AND l_to={$id}", DB_WRITE); + wfQuery("DELETE FROM linkscc WHERE lcc_title='{$t}'", DB_WRITE); + } + $sql = "SELECT l_from FROM links WHERE l_to={$id}"; $res = wfQuery( $sql, DB_READ, $fname ); $sql = "INSERT INTO brokenlinks (bl_from,bl_to) VALUES "; - $now = wfTimestampNow(); + $now = wfTimestampNow(); $sql2 = "UPDATE cur SET cur_touched='{$now}' WHERE cur_id IN ("; $first = true; -- 2.20.1