Index: branches/FileBackend/phase3/includes/filerepo/backend/FileBackendMultiWrite.php |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | * 'backends' : Array of backend config and multi-backend settings. |
37 | 37 | * Each value is the config used in the constructor of a |
38 | 38 | * FileBackend class, but with these additional settings: |
39 | | - * 'class' : The name of the backend class |
| 39 | + * 'class' : The name of the backend class |
40 | 40 | * 'isMultiMaster': This must be set for one non-persistent backend. |
41 | 41 | * @param $config Array |
42 | 42 | */ |
Index: branches/FileBackend/phase3/includes/filerepo/backend/FileOp.php |
— | — | @@ -184,6 +184,7 @@ |
185 | 185 | $status = $this->doAttempt(); |
186 | 186 | if ( !$status->isOK() ) { |
187 | 187 | $this->failed = true; |
| 188 | + $this->logFailure( 'attempt' ); |
188 | 189 | } |
189 | 190 | return $status; |
190 | 191 | } |
— | — | @@ -202,6 +203,9 @@ |
203 | 204 | $status = Status::newGood(); // nothing to revert |
204 | 205 | } else { |
205 | 206 | $status = $this->doRevert(); |
| 207 | + if ( !$status->isOK() ) { |
| 208 | + $this->logFailure( 'revert' ); |
| 209 | + } |
206 | 210 | } |
207 | 211 | return $status; |
208 | 212 | } |
— | — | @@ -465,6 +469,33 @@ |
466 | 470 | return $this->backend->fileExists( array( 'src' => $source ) ); |
467 | 471 | } |
468 | 472 | } |
| 473 | + |
| 474 | + /** |
| 475 | + * Log a file operation failure and preserve any temp files |
| 476 | + * |
| 477 | + * @param $fileOp FileOp |
| 478 | + * @return void |
| 479 | + */ |
| 480 | + final protected function logFailure( $action ) { |
| 481 | + $params = $this->params; |
| 482 | + $params['failedAction'] = $action; |
| 483 | + // Preserve backup files just in case (for recovery) |
| 484 | + if ( $this->tmpSourceFile ) { |
| 485 | + $this->tmpSourceFile->preserve(); // don't purge |
| 486 | + $params['srcBackupPath'] = $this->tmpSourceFile->getPath(); |
| 487 | + } |
| 488 | + if ( $this->tmpDestFile ) { |
| 489 | + $this->tmpDestFile->preserve(); // don't purge |
| 490 | + $params['dstBackupPath'] = $this->tmpDestFile->getPath(); |
| 491 | + } |
| 492 | + try { |
| 493 | + wfDebugLog( 'FileOperation', |
| 494 | + get_class( $this ) . ' failed:' . serialize( $params ) ); |
| 495 | + } catch ( Exception $e ) { |
| 496 | + // bad config? debug log error? |
| 497 | + } |
| 498 | + } |
| 499 | + |
469 | 500 | } |
470 | 501 | |
471 | 502 | /** |
Index: branches/FileBackend/phase3/includes/filerepo/backend/LockManager.php |
— | — | @@ -700,7 +700,7 @@ |
701 | 701 | * @return string |
702 | 702 | */ |
703 | 703 | protected function getMissKey( $lockDb ) { |
704 | | - return "lockmanager:querymisses:$lockDb"; |
| 704 | + return 'lockmanager:querymisses:' . str_replace( ' ', '_', $lockDb ); |
705 | 705 | } |
706 | 706 | |
707 | 707 | /** |