function loadFromCache() {
global $wgMemc;
- wfProfileIn( __METHOD__ );
$this->dataLoaded = false;
$this->extraDataLoaded = false;
$key = $this->getCacheKey();
if ( !$key ) {
- wfProfileOut( __METHOD__ );
return false;
}
wfIncrStats( 'image_cache_miss' );
}
- wfProfileOut( __METHOD__ );
-
return $this->dataLoaded;
}
* @param int $flags
*/
function loadFromDB( $flags = 0 ) {
- # Polymorphic function name to distinguish foreign and local fetches
$fname = get_class( $this ) . '::' . __FUNCTION__;
- wfProfileIn( $fname );
# Unconditionally set loaded=true, we don't want the accessors constantly rechecking
$this->dataLoaded = true;
} else {
$this->fileExists = false;
}
-
- wfProfileOut( $fname );
}
/**
* This covers fields that are sometimes not cached.
*/
protected function loadExtraFromDB() {
- # Polymorphic function name to distinguish foreign and local fetches
$fname = get_class( $this ) . '::' . __FUNCTION__;
- wfProfileIn( $fname );
# Unconditionally set loaded=true, we don't want the accessors constantly rechecking
$this->extraDataLoaded = true;
$this->$name = $value;
}
} else {
- wfProfileOut( $fname );
throw new MWException( "Could not find data for image '{$this->getName()}'." );
}
-
- wfProfileOut( $fname );
}
/**
* Fix assorted version-related problems with the image row by reloading it from the file
*/
function upgradeRow() {
- wfProfileIn( __METHOD__ );
$this->lock(); // begin
if ( !$this->fileExists ) {
$this->unlock();
wfDebug( __METHOD__ . ": file does not exist, aborting\n" );
- wfProfileOut( __METHOD__ );
return;
}
if ( wfReadOnly() ) {
$this->unlock();
- wfProfileOut( __METHOD__ );
return;
}
$this->unlock(); // done
- wfProfileOut( __METHOD__ );
}
/**
* @note This used to purge old thumbnails by default as well, but doesn't anymore.
*/
function purgeCache( $options = array() ) {
- wfProfileIn( __METHOD__ );
// Refresh metadata cache
$this->purgeMetadataCache();
// Purge squid cache for this file
SquidUpdate::purge( array( $this->getURL() ) );
- wfProfileOut( __METHOD__ );
}
/**
*/
function purgeOldThumbnails( $archiveName ) {
global $wgUseSquid;
- wfProfileIn( __METHOD__ );
// Get a list of old thumbnails and URLs
$files = $this->getThumbnails( $archiveName );
SquidUpdate::purge( $urls );
}
- wfProfileOut( __METHOD__ );
}
/**
*/
function purgeThumbnails( $options = array() ) {
global $wgUseSquid;
- wfProfileIn( __METHOD__ );
// Delete thumbnails
$files = $this->getThumbnails();
SquidUpdate::purge( $urls );
}
- wfProfileOut( __METHOD__ );
}
/**
}
if ( !$props ) {
- wfProfileIn( __METHOD__ . '-getProps' );
if ( $this->repo->isVirtualUrl( $srcPath )
|| FileBackend::isStoragePath( $srcPath )
) {
} else {
$props = FSFile::getPropsFromPath( $srcPath );
}
- wfProfileOut( __METHOD__ . '-getProps' );
}
$options = array();
function recordUpload2( $oldver, $comment, $pageText, $props = false, $timestamp = false,
$user = null
) {
- wfProfileIn( __METHOD__ );
if ( is_null( $user ) ) {
global $wgUser;
$dbw->begin( __METHOD__ );
if ( !$props ) {
- wfProfileIn( __METHOD__ . '-getProps' );
$props = $this->repo->getFileProps( $this->getVirtualUrl() );
- wfProfileOut( __METHOD__ . '-getProps' );
}
# Imports or such might force a certain timestamp; otherwise we generate
if ( !$this->fileExists ) {
wfDebug( __METHOD__ . ": File " . $this->getRel() . " went missing!\n" );
$dbw->rollback( __METHOD__ );
- wfProfileOut( __METHOD__ );
return false;
}
// Page exists, do RC entry now (otherwise we wait for later).
$logEntry->publish( $logId );
}
- wfProfileIn( __METHOD__ . '-edit' );
if ( $exists ) {
# Create a null revision
$latest = $descTitle->getLatestRevID();
- $editSummary = LogFormatter::newFromEntry( $logEntry )->getPlainActionText();
+ // Use own context to get the action text in content language
+ $formatter = LogFormatter::newFromEntry( $logEntry );
+ $formatter->setContext( RequestContext::newExtraneousContext( $descTitle ) );
+ $editSummary = $formatter->getPlainActionText();
$nullRevision = Revision::newNullRevision(
$dbw,
$dbw->commit( __METHOD__ ); // commit before anything bad can happen
}
- wfProfileOut( __METHOD__ . '-edit' );
-
if ( $reupload ) {
# Delete old thumbnails
- wfProfileIn( __METHOD__ . '-purge' );
$this->purgeThumbnails();
- wfProfileOut( __METHOD__ . '-purge' );
# Remove the old file from the squid cache
SquidUpdate::purge( array( $this->getURL() ) );
}
# Hooks, hooks, the magic of hooks...
- wfProfileIn( __METHOD__ . '-hooks' );
Hooks::run( 'FileUpload', array( $this, $reupload, $descTitle->exists() ) );
- wfProfileOut( __METHOD__ . '-hooks' );
# Invalidate cache for all pages using this file
$update = new HTMLCacheUpdate( $this->getTitle(), 'imagelinks' );
LinksUpdate::queueRecursiveJobsForTable( $this->getTitle(), 'imagelinks' );
}
- wfProfileOut( __METHOD__ );
-
return true;
}
* @return FileRepoStatus
*/
function execute() {
- wfProfileIn( __METHOD__ );
$this->file->lock();
// Roll back inserts, release lock and abort
// TODO: delete the defunct filearchive rows if we are using a non-transactional DB
$this->file->unlockAndRollback();
- wfProfileOut( __METHOD__ );
return $this->status;
}
// Commit and return
$this->file->unlock();
- wfProfileOut( __METHOD__ );
return $this->status;
}