summaryrefslogtreecommitdiff
path: root/includes/filerepo/file/OldLocalFile.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/filerepo/file/OldLocalFile.php')
-rw-r--r--includes/filerepo/file/OldLocalFile.php14
1 files changed, 4 insertions, 10 deletions
diff --git a/includes/filerepo/file/OldLocalFile.php b/includes/filerepo/file/OldLocalFile.php
index 710058fb..fd92e11a 100644
--- a/includes/filerepo/file/OldLocalFile.php
+++ b/includes/filerepo/file/OldLocalFile.php
@@ -175,11 +175,12 @@ class OldLocalFile extends LocalFile {
}
function loadFromDB( $flags = 0 ) {
- wfProfileIn( __METHOD__ );
-
$this->dataLoaded = true;
- $dbr = $this->repo->getSlaveDB();
+ $dbr = ( $flags & self::READ_LATEST )
+ ? $this->repo->getMasterDB()
+ : $this->repo->getSlaveDB();
+
$conds = array( 'oi_name' => $this->getName() );
if ( is_null( $this->requestedTime ) ) {
$conds['oi_archive_name'] = $this->archive_name;
@@ -194,14 +195,12 @@ class OldLocalFile extends LocalFile {
$this->fileExists = false;
}
- wfProfileOut( __METHOD__ );
}
/**
* Load lazy file metadata from the DB
*/
protected function loadExtraFromDB() {
- wfProfileIn( __METHOD__ );
$this->extraDataLoaded = true;
$dbr = $this->repo->getSlaveDB();
@@ -226,11 +225,9 @@ class OldLocalFile extends LocalFile {
$this->$name = $value;
}
} else {
- wfProfileOut( __METHOD__ );
throw new MWException( "Could not find data for image '{$this->archive_name}'." );
}
- wfProfileOut( __METHOD__ );
}
/**
@@ -260,13 +257,11 @@ class OldLocalFile extends LocalFile {
}
function upgradeRow() {
- wfProfileIn( __METHOD__ );
$this->loadFromFile();
# Don't destroy file info of missing files
if ( !$this->fileExists ) {
wfDebug( __METHOD__ . ": file does not exist, aborting\n" );
- wfProfileOut( __METHOD__ );
return;
}
@@ -291,7 +286,6 @@ class OldLocalFile extends LocalFile {
'oi_archive_name' => $this->archive_name ),
__METHOD__
);
- wfProfileOut( __METHOD__ );
}
/**