-<?
+<?php
# Class to simplify the use of log pages
class LogPage {
# And update recentchanges
if ( $this->mUpdateRecentChanges ) {
- $sql = "INSERT INTO recentchanges (rc_timestamp,rc_cur_time,
- rc_user,rc_user_text,rc_namespace,rc_title,rc_comment,
- rc_cur_id) VALUES ('{$now}','{$now}',{$uid},'{$ut}',4,'" .
- wfStrencode( $this->mTitle ) . "','" .
- wfStrencode( $this->mComment ) . "',{$this->mId})";
- wfQuery( $sql, DB_WRITE, $fname );
- }
+ $titleObj = Title::makeTitle( Namespace::getWikipedia(), $this->mTitle );
+ RecentChange::notifyLog( $now, $titleObj, $wgUser, $this->mComment );
+ }
return true;
}
}
$d = $wgLang->timeanddate( wfTimestampNow(), false );
- preg_match( "/^(.*?)<ul>(.*)$/sD", $this->mContent, $m );
-
+ if( preg_match( "/^(.*?)<ul>(.*)$/sD", $this->mContent, $m ) ) {
+ $before = $m[1];
+ $after = $m[2];
+ } else {
+ $before = "";
+ $after = "";
+ }
+
if($textaction)
$this->mComment = $textaction;
else
# comment gets escaped again, so we use the unescaped version
$this->mComment .= ": {$comment}";
}
- $this->mContent = "{$m[1]}<ul><li>{$d} {$ul} {$action}{$inline}</li>\n{$m[2]}";
+ $this->mContent = "{$before}<ul><li>{$d} {$ul} {$action}{$inline}</li>\n{$after}";
# TODO: automatic log rotation...