r98859 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98858‎ | r98859 | r98860 >
Date:14:38, 4 October 2011
Author:catrope
Status:ok
Tags:
Comment:
[RL2] Address fixme on r95787: $revision can be null (happens for null edits), was unchecked and causing fatals
Modified paths:
  • /branches/RL2/extensions/Gadgets/Gadgets.hooks.php (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/Gadgets.hooks.php
@@ -78,8 +78,13 @@
7979 return true;
8080 }
8181
82 - $previousRev = $revision->getPrevious();
83 - $prevTs = $previousRev instanceof Revision ? $previousRev->getTimestamp() : wfTimestampNow();
 82+ $prevTs = wfTimestampNow();
 83+ if ( $revision ) { // $revision is null for null edits
 84+ $previousRev = $revision->getPrevious();
 85+ if ( $previousRev ) { // $previousRev is null if there is no previous revision
 86+ $prevTs = $previousRev->getTimestamp();
 87+ }
 88+ }
8489
8590 // Update the database entry for this gadget
8691 $repo = LocalGadgetRepo::singleton();

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r95787RL2: Add hooks that ensure the database is updated when Gadget definition: pa...catrope15:51, 30 August 2011

Status & tagging log