* @param $table String
* @param $startId Integer or false
* @param $endId Integer or false
- * @return TitleArray
+ * @return TitleArrayFromResult
*/
public function getLinks( $table, $startId = false, $endId = false ) {
wfProfileIn( __METHOD__ );
$this->partitionCache[$table][$batchSize] = false;
$cacheEntry =& $this->partitionCache[$table][$batchSize];
-
// 2) try full result cache
if ( isset( $this->fullResultCache[$table] ) ) {
return $cacheEntry['batches'];
}
-
// 3) ... fallback to memcached ...
global $wgMemc;
/**
* Partition a DB result with backlinks in it into batches
- * @param $res database result
+ * @param $res ResultWrapper database result
* @param $batchSize integer
* @return array @see
*/
* @param $caller String: the calling method
*/
public function doQuery( $users, $caller = '' ) {
- if ( count( $users ) === 0 ) return false;
+ if ( count( $users ) === 0 ) {
+ return false;
+ }
foreach ( (array) $users as $index => $value ) {
$users[$index] = strtr( $value, '_', ' ' );
}
public function isFileCached() {
- if( $this->mType === false ) return false;
+ if( $this->mType === false ) {
+ return false;
+ }
return file_exists( $this->fileCacheName() );
}
*/
public static function useFileCache() {
global $wgUser, $wgUseFileCache, $wgShowIPinHeader, $wgRequest, $wgLang, $wgContLang;
- if( !$wgUseFileCache ) return false;
+ if( !$wgUseFileCache ) {
+ return false;
+ }
// Get all query values
$queryVals = $wgRequest->getValues();
foreach( $queryVals as $query => $val ) {
- if( $query == 'title' || $query == 'curid' ) continue;
+ if( $query == 'title' || $query == 'curid' ) {
+ continue;
+ }
// Normal page view in query form can have action=view.
// Raw hits for pages also stored, like .css pages for example.
- else if( $query == 'action' && ($val == 'view' || $val == 'raw') ) continue;
- else if( $query == 'usemsgcache' && $val == 'yes' ) continue;
+ else if( $query == 'action' && ($val == 'view' || $val == 'raw') ) {
+ continue;
+ } else if( $query == 'usemsgcache' && $val == 'yes' ) {
+ continue;
+ }
// Below are header setting params
- else if( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' )
+ else if( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' ) {
continue;
- else
+ } else {
return false;
+ }
}
// Check for non-standard user language; this covers uselang,
// and extensions for auto-detecting user language.
public function isFileCacheGood( $timestamp = '' ) {
global $wgCacheEpoch;
- if( !$this->isFileCached() ) return false;
+ if( !$this->isFileCached() ) {
+ return false;
+ }
$cachetime = $this->fileCacheTime();
$good = $timestamp <= $cachetime && $wgCacheEpoch <= $cachetime;
$apacheHeaders = function_exists( 'apache_request_headers' ) ? apache_request_headers() : null;
if( is_array( $apacheHeaders ) ) {
// More reliable than $_SERVER due to case and -/_ folding
- $set = array ();
+ $set = array();
foreach ( $apacheHeaders as $tempName => $tempValue ) {
$set[ strtoupper( $tempName ) ] = $tempValue;
}
function wfGetAgent() {
if( function_exists( 'apache_request_headers' ) ) {
// More reliable than $_SERVER due to case and -/_ folding
- $set = array ();
+ $set = array();
foreach ( apache_request_headers() as $tempName => $tempValue ) {
$set[ strtoupper( $tempName ) ] = $tempValue;
}
function wfIsTrustedProxy( $ip ) {
global $wgSquidServers, $wgSquidServersNoPurge;
- if ( in_array( $ip, $wgSquidServers ) ||
- in_array( $ip, $wgSquidServersNoPurge )
- ) {
- $trusted = true;
- } else {
- $trusted = false;
- }
+ $trusted = in_array( $ip, $wgSquidServers ) ||
+ in_array( $ip, $wgSquidServersNoPurge );
wfRunHooks( 'IsTrustedProxy', array( &$ip, &$trusted ) );
return $trusted;
}
* @param $res result A MySQL result including at least page_namespace and
* page_title -- also can have page_id, page_len, page_is_redirect,
* page_latest (if those will be used). See Title::newFromRow.
- * @return TitleArray
+ * @return TitleArrayFromResult
*/
static function newFromResult( $res ) {
$array = null;
return $array;
}
+ /**
+ * @param $res
+ * @return TitleArrayFromResult
+ */
protected static function newFromResult_internal( $res ) {
$array = new TitleArrayFromResult( $res );
return $array;
/**
* Split a filename into filename and extension
*
- * @param $filename Filename
+ * @param $filename string Filename
* @return array
*/
function splitFilename( $filename ) {