wfDebug( __METHOD__ . " tried to stash file at '$path', but it doesn't exist\n" );
throw new UploadStashBadPathException( "path doesn't exist" );
}
- $fileProps = FSFile::getPropsFromPath( $path );
+
+ $mwProps = new MWFileProps( MimeMagic::singleton() );
+ $fileProps = $mwProps->getPropsFromPath( $path, true );
wfDebug( __METHOD__ . " stashing file at '$path'\n" );
// we will be initializing from some tmpnam files that don't have extensions.
// insert the file metadata into the db.
wfDebug( __METHOD__ . " inserting $stashPath under $key\n" );
- $dbw = $this->repo->getMasterDb();
+ $dbw = $this->repo->getMasterDB();
$serializedFileProps = serialize( $fileProps );
if ( strlen( $serializedFileProps ) > self::MAX_US_PROPS_SIZE ) {
}
wfDebug( __METHOD__ . ' clearing all rows for user ' . $this->userId . "\n" );
- $dbw = $this->repo->getMasterDb();
+ $dbw = $this->repo->getMasterDB();
$dbw->delete(
'uploadstash',
[ 'us_user' => $this->userId ],
. ' No user is logged in, files must belong to users' );
}
- $dbw = $this->repo->getMasterDb();
+ $dbw = $this->repo->getMasterDB();
// this is a cheap query. it runs on the master so that this function
// still works when there's lag. It won't be called all that often.
// Ensure we have the UploadStashFile loaded for this key
$this->getFile( $key, true );
- $dbw = $this->repo->getMasterDb();
+ $dbw = $this->repo->getMasterDB();
$dbw->delete(
'uploadstash',
. ' No user is logged in, files must belong to users' );
}
- $dbr = $this->repo->getSlaveDb();
+ $dbr = $this->repo->getSlaveDB();
$res = $dbr->select(
'uploadstash',
'us_key',
* Helper function: do the actual database query to fetch file metadata.
*
* @param string $key
- * @param int $readFromDB Constant (default: DB_SLAVE)
+ * @param int $readFromDB Constant (default: DB_REPLICA)
* @return bool
*/
- protected function fetchFileMetadata( $key, $readFromDB = DB_SLAVE ) {
+ protected function fetchFileMetadata( $key, $readFromDB = DB_REPLICA ) {
// populate $fileMetadata[$key]
$dbr = null;
if ( $readFromDB === DB_MASTER ) {
// sometimes reading from the master is necessary, if there's replication lag.
- $dbr = $this->repo->getMasterDb();
+ $dbr = $this->repo->getMasterDB();
} else {
- $dbr = $this->repo->getSlaveDb();
+ $dbr = $this->repo->getSlaveDB();
}
$row = $dbr->selectRow(