From: Russ Nelson Date: Mon, 28 Mar 2011 19:57:48 +0000 (+0000) Subject: findFileFromKey, newFileFromKey, $fileFactoryKey, and $oldFileFactoryKey weren't... X-Git-Tag: 1.31.0-rc.0~31148 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=b97d2c85276ac5cbe9718dfeec3f8a4b7704ec52;p=lhc%2Fweb%2Fwiklou.git findFileFromKey, newFileFromKey, $fileFactoryKey, and $oldFileFactoryKey weren't used by anything in .../extensions nor .../phase3 --- diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index 6e4d12f372..8d862b0fcc 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -30,7 +30,6 @@ abstract class FileRepo { * Override these in the base class */ var $fileFactory = false, $oldFileFactory = false; - var $fileFactoryKey = false, $oldFileFactoryKey = false; function __construct( $info ) { // Required settings @@ -178,63 +177,6 @@ abstract class FileRepo { return $result; } - /** - * Create a new File object from the local repository - * @param $sha1 Mixed: base 36 SHA-1 hash - * @param $time Mixed: time at which the image was uploaded. - * If this is specified, the returned object will be an - * of the repository's old file class instead of a current - * file. Repositories not supporting version control should - * return false if this parameter is set. - * - * @return File - */ - function newFileFromKey( $sha1, $time = false ) { - if ( $time ) { - if ( $this->oldFileFactoryKey ) { - return call_user_func( $this->oldFileFactoryKey, $sha1, $this, $time ); - } - } else { - if ( $this->fileFactoryKey ) { - return call_user_func( $this->fileFactoryKey, $sha1, $this ); - } - } - return false; - } - - /** - * Find an instance of the file with this key, created at the specified time - * Returns false if the file does not exist. Repositories not supporting - * version control should return false if the time is specified. - * - * @param $sha1 String base 36 SHA-1 hash - * @param $options Option array, same as findFile(). - */ - function findFileFromKey( $sha1, $options = array() ) { - $time = isset( $options['time'] ) ? $options['time'] : false; - - # First try the current version of the file to see if it precedes the timestamp - $img = $this->newFileFromKey( $sha1 ); - if ( !$img ) { - return false; - } - if ( $img->exists() && ( !$time || $img->getTimestamp() == $time ) ) { - return $img; - } - # Now try an old version of the file - if ( $time !== false ) { - $img = $this->newFileFromKey( $sha1, $time ); - if ( $img && $img->exists() ) { - if ( !$img->isDeleted(File::DELETED_FILE) ) { - return $img; - } else if ( !empty( $options['private'] ) && $img->userCan(File::DELETED_FILE) ) { - return $img; - } - } - } - return false; - } - /** * Get the URL of thumb.php */ diff --git a/includes/filerepo/RepoGroup.php b/includes/filerepo/RepoGroup.php index 2d0b1ac84b..49e5023f6e 100644 --- a/includes/filerepo/RepoGroup.php +++ b/includes/filerepo/RepoGroup.php @@ -211,29 +211,6 @@ class RepoGroup { return false; } - /** - * Find an instance of the file with this key, created at the specified time - * Returns false if the file does not exist. - * - * @param $hash String base 36 SHA-1 hash - * @param $options Option array, same as findFile() - * @return File object or false if it is not found - */ - function findFileFromKey( $hash, $options = array() ) { - if ( !$this->reposInitialised ) { - $this->initialiseRepos(); - } - - $file = $this->localRepo->findFileFromKey( $hash, $options ); - if ( !$file ) { - foreach ( $this->foreignRepos as $repo ) { - $file = $repo->findFileFromKey( $hash, $options ); - if ( $file ) break; - } - } - return $file; - } - /** * Find all instances of files with this key *