+
+ /* private */ function fillFromLinkscc( $id ){
+ $id = IntVal( $id );
+ $res = wfQuery("SELECT lcc_cacheobj FROM linkscc WHERE lcc_pageid = $id",
+ DB_READ);
+ $row = wfFetchObject( $res );
+ if( $row == FALSE)
+ return false;
+
+ $cacheobj = false;
+ if( function_exists( "gzuncompress" ) )
+ $cacheobj = @gzuncompress( $row->lcc_cacheobj );
+
+ if($cacheobj == FALSE){
+ $cacheobj = $row->lcc_cacheobj;
+ }
+ $cc = @unserialize( $cacheobj );
+ if( isset( $cc->mClassVer ) and ($cc->mClassVer == $this->mClassVer ) ){
+ $this->mOldGoodLinks = $this->mGoodLinks = $cc->mGoodLinks;
+ $this->mOldBadLinks = $this->mBadLinks = $cc->mBadLinks;
+ $this->mPreFilled = true;
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+
+ }
+
+ /* private */ function saveToLinkscc( $pid ){
+ global $wgCompressedPersistentLC;
+ if( $wgCompressedPersistentLC and function_exists( "gzcompress" ) ) {
+ $ser = wfStrencode( gzcompress( serialize( $this ), 3 ));
+ } else {
+ $ser = wfStrencode( serialize( $this ) );
+ }
+ wfQuery("REPLACE INTO linkscc(lcc_pageid,lcc_cacheobj) " .
+ "VALUES({$pid}, '{$ser}')", DB_WRITE);
+ }
+
+ # $pid is a page id
+ /* static */ function linksccClearLinksTo( $pid ){
+ $pid = intval( $pid );
+ wfQuery("DELETE linkscc FROM linkscc,links ".
+ "WHERE lcc_pageid=links.l_from AND l_to={$pid}", DB_WRITE);
+ wfQuery("DELETE FROM linkscc WHERE lcc_pageid='{$pid}'", DB_WRITE);
+ }
+
+ # $title is a prefixed db title, for example like Title->getPrefixedDBkey() returns.
+ /* static */ function linksccClearBrokenLinksTo( $title ){
+ $title = wfStrencode( $title );
+ wfQuery("DELETE linkscc FROM linkscc,brokenlinks ".
+ "WHERE lcc_pageid=bl_from AND bl_to='{$title}'", DB_WRITE);
+ }
+
+ # $pid is a page id
+ /* static */ function linksccClearPage( $pid ){
+ $pid = intval( $pid );
+ wfQuery("DELETE FROM linkscc WHERE lcc_pageid='{$pid}'", DB_WRITE);
+ }