r51592 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51591‎ | r51592 | r51593 >
Date:15:10, 8 June 2009
Author:vasilievvv
Status:ok (Comments)
Tags:
Comment:
Add fileExistsBatch method to FileRepo and derived classes (per comments on r49001)
Modified paths:
  • /trunk/phase3/includes/filerepo/FileRepo.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ForeignAPIRepo.php (modified) (history)
  • /trunk/phase3/includes/filerepo/NullRepo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/NullRepo.php
@@ -20,6 +20,9 @@
2121 function deleteBatch( $sourceDestPairs ) {
2222 return false;
2323 }
 24+ function fileExistsBatch( $files, $flags = 0 ) {
 25+ return false;
 26+ }
2427 function getFileProps( $virtualUrl ) {
2528 return false;
2629 }
Index: trunk/phase3/includes/filerepo/FileRepo.php
@@ -401,7 +401,22 @@
402402 */
403403 abstract function publishBatch( $triplets, $flags = 0 );
404404
 405+ function fileExists( $file, $flags = 0 ) {
 406+ $result = $this->fileExistsBatch( array( $file ), $flags );
 407+ return $file;
 408+ }
 409+
405410 /**
 411+ * Checks existence of an array of files.
 412+ *
 413+ * @param array $files URLs (or paths) of files to check
 414+ * @param integer $flags Bitwise combination of the following flags:
 415+ * self::FILES_ONLY Mark file as existing only if it is a file (not directory)
 416+ * @return Either array of files and existence flags, or false
 417+ */
 418+ abstract function fileExistsBatch( $files, $flags = 0 );
 419+
 420+ /**
406421 * Move a group of files to the deletion archive.
407422 *
408423 * If no valid deletion archive is configured, this may either delete the
Index: trunk/phase3/includes/filerepo/ForeignAPIRepo.php
@@ -57,6 +57,9 @@
5858 function deleteBatch( $sourceDestPairs ) {
5959 return false;
6060 }
 61+ function fileExistsBatch( $files, $flags = 0 ) {
 62+ return false;
 63+ }
6164 function getFileProps( $virtualUrl ) {
6265 return false;
6366 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r51673Followup to r51592:...demon01:47, 10 June 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r49001Improve image moving error handling:...vasilievvv13:42, 29 March 2009

Comments

#Comment by 😂 (talk | contribs)   19:29, 9 June 2009

I guess I can implement a ForeignApiRepo version, so we can improve batch lookups to API-based repos (cf bug 15690).

Status & tagging log