Swift needs to rewrite entire files. We need this call to prevent N**2 operations...
authorRuss Nelson <nelson@users.mediawiki.org>
Mon, 23 May 2011 01:18:06 +0000 (01:18 +0000)
committerRuss Nelson <nelson@users.mediawiki.org>
Mon, 23 May 2011 01:18:06 +0000 (01:18 +0000)
includes/filerepo/FileRepo.php
includes/upload/UploadBase.php

index c4059bf..7fe8e81 100644 (file)
@@ -429,7 +429,8 @@ abstract class FileRepo {
 
 
        /**
-        * Append the contents of the source path to the given file.
+        * Append the contents of the source path to the given file, OR queue
+        * the appending operation in anticipation of a later appendFinish() call.
         * @param $srcPath String: location of the source file
         * @param $toAppendPath String: path to append to.
         * @param $flags Integer: bitfield, may be FileRepo::DELETE_SOURCE to indicate
@@ -438,6 +439,13 @@ abstract class FileRepo {
         */
        abstract function append( $srcPath, $toAppendPath, $flags = 0 );
 
+       /**
+        * Finish the append operation.
+        * @param $toAppendPath String: path to append to.
+        * @return mixed Status or false
+        */
+       abstract function appendFinish( $toAppendPath );
+
        /**
         * Remove a temporary file or mark it for garbage collection
         * @param $virtualUrl String: the virtual URL returned by storeTemp
index d2db661..a824308 100644 (file)
@@ -215,6 +215,19 @@ abstract class UploadBase {
                return $status;
        }
 
+       /**
+        * Finish appending to the Repo file
+        *
+        * @param $toAppendPath String: path to the Repo file that will be appended to.
+        * @return Status Status
+        */
+       protected function appendFinish( $toAppendPath ) {
+               $repo = RepoGroup::singleton()->getLocalRepo();
+               $status = $repo->appendFinish( $toAppendPath );
+               return $status;
+       }
+
+
        /**
         * @param $srcPath String: the source path
         * @return the real path if it was a virtual URL