Go to the documentation of this file.
27 use Wikimedia\Timestamp\ConvertibleTimestamp;
46 parent::__construct( $config );
48 $this->domain = $config[
'domain'] ?? $config[
'wiki'];
63 $status->fatal(
'filejournal-fail-dbconnect', $this->backend );
68 $now = ConvertibleTimestamp::time();
71 foreach ( $entries as $entry ) {
73 'fj_batch_uuid' => $batchId,
75 'fj_op' => $entry[
'op'],
76 'fj_path' => $entry[
'path'],
77 'fj_new_sha1' => $entry[
'newSha1'],
83 $dbw->
insert(
'filejournal', $data, __METHOD__ );
86 if ( mt_rand( 0, 99 ) == 0 ) {
91 $status->fatal(
'filejournal-fail-dbquery', $this->backend );
107 [
'fj_backend' => $this->backend ],
123 [
'fj_backend' => $this->backend,
"fj_timestamp <= $encTimestamp" ],
125 [
'ORDER BY' =>
'fj_timestamp DESC' ]
140 'fj_backend' => $this->backend,
143 array_merge( [
'ORDER BY' =>
'fj_id ASC' ],
144 $limit ? [
'LIMIT' => $limit ] : [] )
148 foreach (
$res as $row ) {
150 foreach ( (array)$row as $key => $value ) {
151 $item[substr( $key, 3 )] = $value;
166 if ( $this->ttlDays <= 0 ) {
171 $dbCutoff =
$dbw->
timestamp( ConvertibleTimestamp::time() - 86400 * $this->ttlDays );
190 $lb = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->newMainLB();
191 $this->dbw = $lb->getConnection(
DB_MASTER, [], $this->domain );
192 $this->dbw->clearFlag(
DBO_TRX );
Version of FileJournal that logs to a DB table.
doLogChangeBatch(array $entries, $batchId)
getMasterDB()
Get a master connection to the logging DB.
__construct(array $config)
Construct a new instance from configuration.
Class for handling file operation journaling.
doGetChangeEntries( $start, $limit)
static newGood( $value=null)
Factory function for good results.
purgeOldLogs()
Purge any old log entries.
doGetPositionAtTime( $time)