}
}
- function addObj( $title ) {
+ public function addObj( $title ) {
if ( is_object( $title ) ) {
$this->add( $title->getNamespace(), $title->getDBkey() );
} else {
}
}
- function add( $ns, $dbkey ) {
+ public function add( $ns, $dbkey ) {
if ( $ns < 0 ) {
return;
}
* Set the link list to a given 2-d array
* First key is the namespace, second is the DB key, value arbitrary
*/
- function setArray( $array ) {
+ public function setArray( $array ) {
$this->data = $array;
}
/**
* Returns true if no pages have been added, false otherwise.
*/
- function isEmpty() {
+ public function isEmpty() {
return ($this->getSize() == 0);
}
/**
* Returns the size of the batch.
*/
- function getSize() {
+ public function getSize() {
return count( $this->data );
}
* Do the query and add the results to the LinkCache object
* Return an array mapping PDBK to ID
*/
- function execute() {
+ public function execute() {
$linkCache =& LinkCache::singleton();
return $this->executeInto( $linkCache );
}
* Do the query and add the results to a given LinkCache object
* Return an array mapping PDBK to ID
*/
- function executeInto( &$cache ) {
+ protected function executeInto( &$cache ) {
wfProfileIn( __METHOD__ );
$res = $this->doQuery();
$ids = $this->addResultToCache( $cache, $res );
* This function *also* stores extra fields of the title used for link
* parsing to avoid extra DB queries.
*/
- function addResultToCache( $cache, $res ) {
+ public function addResultToCache( $cache, $res ) {
if ( !$res ) {
return array();
}
/**
* Perform the existence test query, return a ResultWrapper with page_id fields
*/
- function doQuery() {
+ public function doQuery() {
if ( $this->isEmpty() ) {
return false;
}
* @return string
* @public
*/
- function constructSet( $prefix, &$db ) {
+ public function constructSet( $prefix, &$db ) {
$first = true;
$firstTitle = true;
$sql = '';
$this->mBadLinks = array();
}
- /* private */ function getKey( $title ) {
+ private function getKey( $title ) {
return wfMemcKey( 'lc', 'title', $title );
}
/**
* General accessor to get/set whether SELECT FOR UPDATE should be used
*/
- function forUpdate( $update = NULL ) {
+ public function forUpdate( $update = NULL ) {
return wfSetVar( $this->mForUpdate, $update );
}
- function getGoodLinkID( $title ) {
+ public function getGoodLinkID( $title ) {
if ( array_key_exists( $title, $this->mGoodLinks ) ) {
return $this->mGoodLinks[$title];
} else {
* @param string $field ('length','redirect')
* @return mixed
*/
- function getGoodLinkFieldObj( $title, $field ) {
+ public function getGoodLinkFieldObj( $title, $field ) {
$dbkey = $title->getPrefixedDbKey();
if ( array_key_exists( $dbkey, $this->mGoodLinkFields ) ) {
return $this->mGoodLinkFields[$dbkey][$field];
}
}
- function isBadLink( $title ) {
+ public function isBadLink( $title ) {
return array_key_exists( $title, $this->mBadLinks );
}
* @param int $len
* @param int $redir
*/
- function addGoodLinkObj( $id, $title, $len = -1, $redir = NULL ) {
+ public function addGoodLinkObj( $id, $title, $len = -1, $redir = NULL ) {
$dbkey = $title->getPrefixedDbKey();
$this->mGoodLinks[$dbkey] = $id;
$this->mGoodLinkFields[$dbkey] = array( 'length' => $len, 'redirect' => $redir );
$this->mPageLinks[$dbkey] = $title;
}
- function addBadLinkObj( $title ) {
+ public function addBadLinkObj( $title ) {
$dbkey = $title->getPrefixedDbKey();
if ( ! $this->isBadLink( $dbkey ) ) {
$this->mBadLinks[$dbkey] = 1;
}
}
- function clearBadLink( $title ) {
+ public function clearBadLink( $title ) {
unset( $this->mBadLinks[$title] );
$this->clearLink( $title );
}
- function clearLink( $title ) {
+ public function clearLink( $title ) {
global $wgMemc, $wgLinkCacheMemcached;
if( $wgLinkCacheMemcached )
$wgMemc->delete( $this->getKey( $title ) );
}
- function getPageLinks() { return $this->mPageLinks; }
- function getGoodLinks() { return $this->mGoodLinks; }
- function getBadLinks() { return array_keys( $this->mBadLinks ); }
+ public function getPageLinks() { return $this->mPageLinks; }
+ public function getGoodLinks() { return $this->mGoodLinks; }
+ public function getBadLinks() { return array_keys( $this->mBadLinks ); }
/**
* Add a title to the link cache, return the page_id or zero if non-existent
* @param $redir bool, is redirect?
* @return integer
*/
- function addLink( $title, $len = -1, $redir = NULL ) {
+ public function addLink( $title, $len = -1, $redir = NULL ) {
$nt = Title::newFromDBkey( $title );
if( $nt ) {
return $this->addLinkObj( $nt, $len, $redir );
* @param $redir bool, is redirect?
* @return integer
*/
- function addLinkObj( &$nt, $len = -1, $redirect = NULL ) {
+ public function addLinkObj( &$nt, $len = -1, $redirect = NULL ) {
global $wgMemc, $wgLinkCacheMemcached, $wgAntiLockFlags;
$title = $nt->getPrefixedDBkey();
if ( $this->isBadLink( $title ) ) { return 0; }
/**
* Clears cache
*/
- function clear() {
+ public function clear() {
$this->mPageLinks = array();
$this->mGoodLinks = array();
$this->mGoodLinkFields = array();