* private: If true, return restricted (deleted) files if the current
* user is allowed to view them. Otherwise, such files will not
* be found. If a User object, use that user instead of the current.
+ * latest: If true, load from the latest available data into File objects
* @return File|bool False on failure
*/
public function findFile( $title, $options = array() ) {
if ( !$title ) {
return false;
}
+ if ( isset( $options['bypassCache'] ) ) {
+ $options['latest'] = $options['bypassCache']; // b/c
+ }
$time = isset( $options['time'] ) ? $options['time'] : false;
+ $flags = !empty( $options['latest'] ) ? File::READ_LATEST : 0;
# First try the current version of the file to see if it precedes the timestamp
$img = $this->newFile( $title );
if ( !$img ) {
return false;
}
+ $img->load( $flags );
if ( $img->exists() && ( !$time || $img->getTimestamp() == $time ) ) {
return $img;
}
# Now try an old version of the file
if ( $time !== false ) {
$img = $this->newFile( $title, $time );
+ $img->load( $flags );
if ( $img && $img->exists() ) {
if ( !$img->isDeleted( File::DELETED_FILE ) ) {
return $img; // always OK
$redir = $this->checkRedirect( $title );
if ( $redir && $title->getNamespace() == NS_FILE ) {
$img = $this->newFile( $redir );
+ $img->load( $flags );
if ( !$img ) {
return false;
}
* Create a new fatal error
*
* @param string $message
- * @return FileRepoStatus
+ * @return Status
*/
public function newFatal( $message /*, parameters...*/ ) {
- $params = func_get_args();
- array_unshift( $params, $this );
+ $status = call_user_func_array( array( 'Status', 'newFatal' ), func_get_args() );
+ $status->cleanCallback = $this->getErrorCleanupFunction();
- return call_user_func_array( array( 'FileRepoStatus', 'newFatal' ), $params );
+ return $status;
}
/**
* Create a new good result
*
* @param null|string $value
- * @return FileRepoStatus
+ * @return Status
*/
public function newGood( $value = null ) {
- return FileRepoStatus::newGood( $this, $value );
+ $status = Status::newGood( $value );
+ $status->cleanCallback = $this->getErrorCleanupFunction();
+
+ return $status;
}
/**