*/
$wgLogActionsHandlers = array();
+/**
+ * Maintain a log of newusers at Log/newusers?
+ */
+$wgNewUserLog = true;
+
/**
* List of special pages, followed by what subtitle they should go under
* at Special:SpecialPages
$revert = '(' . $this->skin->makeKnownLinkObj( $revdel, $this->message['revdel-restore'],
'target=' . $title->getPrefixedUrl() . $logParams ) . ')';
}
+ // Self-created users
+ } else if( self::typeAction($row,'newusers','create2') ) {
+ if( isset( $paramArray[0] ) ) {
+ $revert = $this->skin->userToolLinks( $paramArray[0], $title->getDBkey(), true );
+ } else {
+ # Fall back to a blue contributions link
+ $revert = $this->skin->userToolLinks( 1, $title->getDBkey() );
+ }
+ if( $time < '20080129000000' ) {
+ # Suppress $comment from old entries (before 2008-01-29), not needed and can contain incorrect links
+ $comment = '';
+ }
+ // Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters.
} else {
wfRunHooks( 'LogLine', array( $row->log_type, $row->log_action, $title, $paramArray,
&$comment, &$revert, $row->log_timestamp ) );
- // Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters.
}
// Event description
if( self::isDeleted($row,LogPage::DELETED_ACTION) ) {
wfRunHooks( 'LogPageLogHeader', array( &$wgLogHeaders ) );
wfRunHooks( 'LogPageActionText', array( &$wgLogActions ) );
+if( !empty($wgNewUserLog) ) {
+ # Add a new log type
+ $wgLogTypes[] = 'newusers';
+ $wgLogNames['newusers'] = 'newuserlogpage';
+ $wgLogHeaders['newusers'] = 'newuserlogpagetext';
+ $wgLogActions['newusers/newusers'] = 'newuserlogentry'; // For compatibility with older log entries
+ $wgLogActions['newusers/create'] = 'newuserlog-create-entry';
+ $wgLogActions['newusers/create2'] = 'newuserlog-create2-entry';
+ $wgLogActions['newusers/autocreate'] = 'newuserlog-autocreate-entry';
+}
wfDebug( "Fully initialised\n" );
$wgFullyInitialised = true;
return self::oldCrypt( $password, $userId ) === $hash;
}
}
+
+ /**
+ * Add a newuser log entry for this user
+ * @param bool $byEmail, account made by email?
+ */
+ public function addNewUserLogEntry( $byEmail = false ) {
+ global $wgUser, $wgContLang, $wgNewUserLog;
+ if( empty($wgNewUserLog) ) {
+ return true; // disabled
+ }
+ $talk = $wgContLang->getFormattedNsText( NS_TALK );
+ if( $this->getName() == $wgUser->getName() ) {
+ $action = 'create';
+ $message = '';
+ } else {
+ $action = 'create2';
+ $message = $byEmail ? wfMsgForContent( 'newuserlog-byemail' ) : '';
+ }
+ $log = new LogPage( 'newusers' );
+ $log->addEntry( $action, $this->getUserPage(), $message, array( $this->getId() ) );
+ return true;
+ }
+
+ /**
+ * Add an autocreate newuser log entry for this user
+ * Used by things like CentralAuth and perhaps other authplugins.
+ */
+ public static function addNewUserLogEntryAutoCreate() {
+ global $wgNewUserLog;
+ if( empty($wgNewUserLog) ) {
+ return true; // disabled
+ }
+ $log = new LogPage( 'newusers', false );
+ $log->addEntry( 'autocreate', $this->getUserPage(), '', array( $this->getId() ) );
+ return true;
+ }
+
}
$result = $this->mailPasswordInternal( $u, false, 'createaccount-title', 'createaccount-text' );
wfRunHooks( 'AddNewAccount', array( $u, true ) );
+ $u->addNewUserLogEntry();
$wgOut->setPageTitle( wfMsg( 'accmailtitle' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgUser = $u;
$wgUser->setCookies();
wfRunHooks( 'AddNewAccount', array( $wgUser ) );
+ $wgUser->addNewUserLogEntry();
if( $this->hasSessionCookie() ) {
return $this->successfulCreation();
} else {
$wgOut->addHtml( wfMsgWikiHtml( 'accountcreatedtext', $u->getName() ) );
$wgOut->returnToMain( false, $self );
wfRunHooks( 'AddNewAccount', array( $u ) );
+ $u->addNewUserLogEntry();
return true;
}
}
'listusers-submit' => 'Show',
'listusers-noresult' => 'No user found.',
+# New user log
+'newuserlogpage' => 'User creation log',
+'newuserlogpagetext' => 'This is a log of user creations.',
+'newuserlog-desc' => 'Adds a [[Special:Log/newusers|log of account creations]]',
+'newuserlogentry' => '', # For compatibility, do not translate this
+'newuserlog-byemail' => 'password sent by e-mail',
+'newuserlog-create-entry' => 'New user',
+'newuserlog-create2-entry' => 'created account for $1',
+'newuserlog-autocreate-entry' => 'Account created automatically',
+
# Special:ListGroupRights
'listgrouprights' => 'User group rights',
'listgrouprights-summary' => 'The following is a list of user groups defined on this wiki, with their associated access rights.