* @param bool $noudp
*/
public function save( $noudp = false ) {
- global $wgPutIPinRC, $wgUseEnotif, $wgShowUpdatedMarker, $wgContLang;
+ global $wgPutIPinRC, $wgUseEnotif, $wgShowUpdatedMarker;
$dbw = wfGetDB( DB_MASTER );
if ( !is_array( $this->mExtra ) ) {
# Trim spaces on user supplied text
$this->mAttribs['rc_comment'] = trim( $this->mAttribs['rc_comment'] );
- # Make sure summary is truncated (whole multibyte characters)
- $this->mAttribs['rc_comment'] = $wgContLang->truncate( $this->mAttribs['rc_comment'], 255 );
-
# Fixup database timestamps
$this->mAttribs['rc_timestamp'] = $dbw->timestamp( $this->mAttribs['rc_timestamp'] );
- $this->mAttribs['rc_id'] = $dbw->nextSequenceValue( 'recentchanges_rc_id_seq' );
# # If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
if ( $this->mAttribs['rc_cur_id'] == 0 ) {
unset( $row['rc_comment'], $row['rc_comment_text'], $row['rc_comment_data'] );
$row += CommentStore::newKey( 'rc_comment' )->insert( $dbw, $comment );
+ # Don't reuse an existing rc_id for the new row, if one happens to be
+ # set for some reason.
+ unset( $row['rc_id'] );
+
# Insert new row
$dbw->insert( 'recentchanges', $row, __METHOD__ );
// Never send an RC notification email about categorization changes
if (
- $this->mAttribs['rc_type'] != RC_CATEGORIZE &&
- Hooks::run( 'AbortEmailNotification', [ $editor, $title, $this ] )
+ Hooks::run( 'AbortEmailNotification', [ $editor, $title, $this ] ) &&
+ $this->mAttribs['rc_type'] != RC_CATEGORIZE
) {
// @FIXME: This would be better as an extension hook
// Send emails or email jobs once this row is safely committed
* @param bool $bot true, if the change was made by a bot
* @param string $ip IP address of the user, if the change was made anonymously
* @param int $deleted Indicates whether the change has been deleted
+ * @param bool $added true, if the category was added, false for removed
*
* @return RecentChange
*/
$lastTimestamp,
$bot,
$ip = '',
- $deleted = 0
+ $deleted = 0,
+ $added = null
) {
+ // Done in a backwards compatible way.
+ $params = [
+ 'hidden-cat' => WikiCategoryPage::factory( $categoryTitle )->isHidden()
+ ];
+ if ( $added !== null ) {
+ $params['added'] = $added;
+ }
+
$rc = new RecentChange;
$rc->mTitle = $categoryTitle;
$rc->mPerformer = $user;
'rc_logid' => 0,
'rc_log_type' => null,
'rc_log_action' => '',
- 'rc_params' => serialize( [
- 'hidden-cat' => WikiCategoryPage::factory( $categoryTitle )->isHidden()
- ] )
+ 'rc_params' => serialize( $params )
];
$rc->mExtra = [