X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilebackend%2Ffilejournal%2FDBFileJournal.php;h=2e06c40f728f92ff025a8759e0dc9dcd57422999;hb=939199bcea28a3b13c49c0f808d11d415660b924;hp=0ade6164f25e43b2abc7558816d3a85d91ee468f;hpb=557c331645173b60171e1cbcc9b921e39de9710b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filebackend/filejournal/DBFileJournal.php b/includes/filebackend/filejournal/DBFileJournal.php index 0ade6164f2..2e06c40f72 100644 --- a/includes/filebackend/filejournal/DBFileJournal.php +++ b/includes/filebackend/filejournal/DBFileJournal.php @@ -48,10 +48,10 @@ class DBFileJournal extends FileJournal { * @see FileJournal::logChangeBatch() * @param array $entries * @param string $batchId - * @return Status + * @return StatusValue */ protected function doLogChangeBatch( array $entries, $batchId ) { - $status = Status::newGood(); + $status = StatusValue::newGood(); try { $dbw = $this->getMasterDB(); @@ -63,16 +63,16 @@ class DBFileJournal extends FileJournal { $now = wfTimestamp( TS_UNIX ); - $data = array(); + $data = []; foreach ( $entries as $entry ) { - $data[] = array( + $data[] = [ 'fj_batch_uuid' => $batchId, 'fj_backend' => $this->backend, 'fj_op' => $entry['op'], 'fj_path' => $entry['path'], 'fj_new_sha1' => $entry['newSha1'], 'fj_timestamp' => $dbw->timestamp( $now ) - ); + ]; } try { @@ -97,7 +97,7 @@ class DBFileJournal extends FileJournal { $dbw = $this->getMasterDB(); return $dbw->selectField( 'filejournal', 'MAX(fj_id)', - array( 'fj_backend' => $this->backend ), + [ 'fj_backend' => $this->backend ], __METHOD__ ); } @@ -113,9 +113,9 @@ class DBFileJournal extends FileJournal { $encTimestamp = $dbw->addQuotes( $dbw->timestamp( $time ) ); return $dbw->selectField( 'filejournal', 'fj_id', - array( 'fj_backend' => $this->backend, "fj_timestamp <= $encTimestamp" ), + [ 'fj_backend' => $this->backend, "fj_timestamp <= $encTimestamp" ], __METHOD__, - array( 'ORDER BY' => 'fj_timestamp DESC' ) + [ 'ORDER BY' => 'fj_timestamp DESC' ] ); } @@ -129,17 +129,17 @@ class DBFileJournal extends FileJournal { $dbw = $this->getMasterDB(); $res = $dbw->select( 'filejournal', '*', - array( + [ 'fj_backend' => $this->backend, - 'fj_id >= ' . $dbw->addQuotes( (int)$start ) ), // $start may be 0 + 'fj_id >= ' . $dbw->addQuotes( (int)$start ) ], // $start may be 0 __METHOD__, - array_merge( array( 'ORDER BY' => 'fj_id ASC' ), - $limit ? array( 'LIMIT' => $limit ) : array() ) + array_merge( [ 'ORDER BY' => 'fj_id ASC' ], + $limit ? [ 'LIMIT' => $limit ] : [] ) ); - $entries = array(); + $entries = []; foreach ( $res as $row ) { - $item = array(); + $item = []; foreach ( (array)$row as $key => $value ) { $item[substr( $key, 3 )] = $value; // "fj_op" => "op" } @@ -151,11 +151,11 @@ class DBFileJournal extends FileJournal { /** * @see FileJournal::purgeOldLogs() - * @return Status + * @return StatusValue * @throws DBError */ protected function doPurgeOldLogs() { - $status = Status::newGood(); + $status = StatusValue::newGood(); if ( $this->ttlDays <= 0 ) { return $status; // nothing to do } @@ -164,7 +164,7 @@ class DBFileJournal extends FileJournal { $dbCutoff = $dbw->timestamp( time() - 86400 * $this->ttlDays ); $dbw->delete( 'filejournal', - array( 'fj_timestamp < ' . $dbw->addQuotes( $dbCutoff ) ), + [ 'fj_timestamp < ' . $dbw->addQuotes( $dbCutoff ) ], __METHOD__ ); @@ -181,7 +181,7 @@ class DBFileJournal extends FileJournal { if ( !$this->dbw ) { // Get a separate connection in autocommit mode $lb = wfGetLBFactory()->newMainLB(); - $this->dbw = $lb->getConnection( DB_MASTER, array(), $this->wiki ); + $this->dbw = $lb->getConnection( DB_MASTER, [], $this->wiki ); $this->dbw->clearFlag( DBO_TRX ); }