r106501 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106500‎ | r106501 | r106502 >
Date:07:23, 17 December 2011
Author:aaron
Status:deferred
Tags:
Comment:
* Use INSERT IGNORE for filelocks_shared table
* Free temp file copy in UploadFromChunks
Modified paths:
  • /branches/FileBackend/phase3/includes/filerepo/backend/FileBackendMultiWrite.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/backend/LockManager.php (modified) (history)
  • /branches/FileBackend/phase3/includes/upload/UploadFromChunks.php (modified) (history)

Diff [purge]

Index: branches/FileBackend/phase3/includes/upload/UploadFromChunks.php
@@ -95,8 +95,8 @@
9696 $fileList[] = $this->getVirtualChunkLocation( $i );
9797 }
9898
99 - // Concatinate into the mVirtualTempPath location;
100 - $status = $this->repo->concatenate( $fileList, $this->mVirtualTempPath, FileRepo::DELETE_SOURCE );
 99+ // Concatenate into the mVirtualTempPath location;
 100+ $status = $this->repo->concatenate( $fileList, $this->mVirtualTempPath, FileRepo::DELETE_SOURCE );
101101 if( !$status->isOk() ){
102102 return $status;
103103 }
@@ -104,7 +104,22 @@
105105 $this->mTempPath = $this->getRealPath( $this->mVirtualTempPath );
106106 return $status;
107107 }
 108+
108109 /**
 110+ * Perform the upload, then remove the temp copy afterward
 111+ * @param $comment string
 112+ * @param $pageText string
 113+ * @param $watch bool
 114+ * @param $user User
 115+ * @return Status
 116+ */
 117+ public function performUpload( $comment, $pageText, $watch, $user ) {
 118+ $rv = parent::performUpload( $comment, $pageText, $watch, $user );
 119+ $this->repo->freeTemp( $this->mVirtualTempPath );
 120+ return $rv;
 121+ }
 122+
 123+ /**
109124 * Returns the virtual chunk location:
110125 * @param unknown_type $index
111126 */
Index: branches/FileBackend/phase3/includes/filerepo/backend/FileBackendMultiWrite.php
@@ -35,8 +35,8 @@
3636 * 'backends' : Array of backend config and multi-backend settings.
3737 * Each value is the config used in the constructor of a
3838 * FileBackend class, but with these additional settings:
39 - * 'class' : The name of the backend class
40 - * 'isMultiMaster': This must be set for one non-persistent backend.
 39+ * 'class' : The name of the backend class
 40+ * 'isMultiMaster' : This must be set for one backend.
4141 * @param $config Array
4242 */
4343 public function __construct( array $config ) {
@@ -180,7 +180,7 @@
181181 return $this->backends[$this->masterIndex]->getFileTimestamp( $realParams );
182182 }
183183
184 - function getFileSha1Base36(array $params) {
 184+ function getFileSha1Base36( array $params ) {
185185 # Hit all backends in case of failed operations (out of sync)
186186 foreach ( $this->backends as $backend ) {
187187 $realParams = $this->substOpPaths( $params, $backend );
Index: branches/FileBackend/phase3/includes/filerepo/backend/LockManager.php
@@ -759,7 +759,7 @@
760760 $data[] = array( 'fls_key' => $key, 'fls_session' => $this->session );
761761 }
762762 # Block new writers...
763 - $db->insert( 'filelocks_shared', $data, __METHOD__ );
 763+ $db->insert( 'filelocks_shared', $data, __METHOD__, array( 'IGNORE' ) );
764764 # Actually do the locking queries...
765765 if ( $type == self::LOCK_SH ) { // reader locks
766766 # Bail if there are any existing writers...

Status & tagging log