$mUser = $mBy = 0;
}
- # Get a ban from the DB, with either the given address or the given username
+ /**
+ * Get a ban from the DB, with either the given address or the given username
+ */
function load( $address = '', $user = 0, $killExpired = true )
{
$fname = 'Block::load';
}
}
- # Callback with a Block object for every block
+ /**
+ * Callback with a Block object for every block
+ */
/*static*/ function enumBlocks( $callback, $tag, $flags = 0 )
{
$block = new Block();
{
var $mData = false, $mMemcKey;
+ /**
+ * Constructor
+ * Create a new BlockCache object
+ *
+ * @param Boolean $deferLoad specifies whether to immediately load the data from memcached.
+ * @param String $dbName specifies the memcached dbName prefix to be used. Defaults to $wgDBname.
+ */
function BlockCache( $deferLoad = false, $dbName = '' ) {
global $wgDBname;
}
}
- # Load the blocks from the database and save them to memcached
+ /**
+ * Load the blocks from the database and save them to memcached
+ */
function loadFromDB() {
global $wgUseMemCached, $wgMemc;
$this->mData = array();
}
}
- # Load the cache from memcached or, if that's not possible, from the DB
+ /**
+ * Load the cache from memcached or, if that's not possible, from the DB
+ */
function load() {
global $wgUseMemCached, $wgMemc;
}
}
- # Add a block to the cache
+ /**
+ * Add a block to the cache
+ *
+ * @param Object &$block Reference to a "Block" object.
+ */
function insert( &$block ) {
if ( $block->mUser == 0 ) {
$nb = $block->getNetworkBits();
}
}
- # Find out if a given IP address is blocked
+ /**
+ * Find out if a given IP address is blocked
+ *
+ * @param String $ip IP address
+ */
function get( $ip ) {
$this->load();
$ipint = ip2long( $ip );
return $block;
}
- # Clear the local cache
- # There was once a clear() to clear memcached too, but I deleted it
+ /**
+ * Clear the local cache
+ * There was once a clear() to clear memcached too, but I deleted it
+ */
function clearLocal() {
$this->mData = false;
}
}
+/**
+ * Add a block to the global $wgBlockCache
+ *
+ * @package MediaWiki
+ * @param Object $block A "Block"-object
+ * @param Any $tag unused
+ */
function wfBlockCacheInsert( $block, $tag ) {
global $wgBlockCache;
$wgBlockCache->insert( $block );