X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Ffilerepo%2FFileRepo.php;h=15821ea4dd7a87eb2cdd44b0174c6f81b360fd3d;hp=f3c2abf323b4e722c0886f88600167c7f8698f5b;hb=e3bd13db0c285f312e31bb1b7271af4628cca80c;hpb=64ecff581757f026ae819a21e766f65b9c0aed32 diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index f3c2abf323..15821ea4dd 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -1158,7 +1158,7 @@ class FileRepo { * Options to $options include: * - headers : name/value map of HTTP headers to use in response to GET/HEAD requests * - * @param string $srcPath The source file system path, storage path, or URL + * @param string|FSFile $src The source file system path, storage path, or URL * @param string $dstRel The destination relative path * @param string $archiveRel The relative path where the existing file is to * be archived, if there is one. Relative to the public zone root. @@ -1168,12 +1168,12 @@ class FileRepo { * @return FileRepoStatus */ public function publish( - $srcPath, $dstRel, $archiveRel, $flags = 0, array $options = [] + $src, $dstRel, $archiveRel, $flags = 0, array $options = [] ) { $this->assertWritableRepo(); // fail out if read-only $status = $this->publishBatch( - [ [ $srcPath, $dstRel, $archiveRel, $options ] ], $flags ); + [ [ $src, $dstRel, $archiveRel, $options ] ], $flags ); if ( $status->successCount == 0 ) { $status->ok = false; } @@ -1212,7 +1212,9 @@ class FileRepo { $sourceFSFilesToDelete = []; // cleanup for disk source files // Validate each triplet and get the store operation... foreach ( $ntuples as $ntuple ) { - list( $srcPath, $dstRel, $archiveRel ) = $ntuple; + list( $src, $dstRel, $archiveRel ) = $ntuple; + $srcPath = ( $src instanceof FSFile ) ? $src->getPath() : $src; + $options = isset( $ntuple[3] ) ? $ntuple[3] : []; // Resolve source to a storage path if virtual $srcPath = $this->resolveToStoragePath( $srcPath ); @@ -1275,7 +1277,7 @@ class FileRepo { } else { // FS source path $operations[] = [ 'op' => 'store', - 'src' => $srcPath, + 'src' => $src, // prefer FSFile objects 'dst' => $dstPath, 'overwrite' => true, // replace current 'headers' => $headers @@ -1904,7 +1906,7 @@ class FileRepo { /** * Returns whether or not storage is SHA-1 based - * @return boolean + * @return bool */ public function hasSha1Storage() { return $this->hasSha1Storage; @@ -1912,7 +1914,7 @@ class FileRepo { /** * Returns whether or not repo supports having originals SHA-1s in the thumb URLs - * @return boolean + * @return bool */ public function supportsSha1URLs() { return $this->supportsSha1URLs;