Merge "Add Special:Login and Special:Logout as aliases."
[lhc/web/wiklou.git] / includes / logging / LogEntry.php
index ed9aa5a..92a0abe 100644 (file)
@@ -151,7 +151,7 @@ class DatabaseLogEntry extends LogEntryBase {
                return array(
                        'tables' => $tables,
                        'fields' => $fields,
-                       'conds'  => array(),
+                       'conds' => array(),
                        'options' => array(),
                        'join_conds' => $joins,
                );
@@ -233,7 +233,7 @@ class DatabaseLogEntry extends LogEntryBase {
        }
 
        public function getPerformer() {
-               if( !$this->performer ) {
+               if ( !$this->performer ) {
                        $userId = (int) $this->row->log_user;
                        if ( $userId !== 0 ) { // logged-in users
                                if ( isset( $this->row->user_name ) ) {
@@ -291,7 +291,7 @@ class RCDatabaseLogEntry extends DatabaseLogEntry {
        }
 
        public function getPerformer() {
-               if( !$this->performer ) {
+               if ( !$this->performer ) {
                        $userId = (int) $this->row->rc_user;
                        if ( $userId !== 0 ) {
                                $this->performer = User::newFromId( $userId );
@@ -367,7 +367,7 @@ class ManualLogEntry extends LogEntryBase {
         *
         * @since 1.19
         *
-        * @param $parameters array Associative array
+        * @param array $parameters Associative array
         */
        public function setParameters( $parameters ) {
                $this->parameters = $parameters;
@@ -430,12 +430,13 @@ class ManualLogEntry extends LogEntryBase {
 
        /**
         * Inserts the entry into the logging table.
+        * @param DatabaseBase $dbw
         * @return int If of the log entry
         */
-       public function insert() {
+       public function insert( DatabaseBase $dbw = null ) {
                global $wgContLang;
 
-               $dbw = wfGetDB( DB_MASTER );
+               $dbw = $dbw ?: wfGetDB( DB_MASTER );
                $id = $dbw->nextSequenceValue( 'logging_log_id_seq' );
 
                if ( $this->timestamp === null ) {
@@ -468,8 +469,8 @@ class ManualLogEntry extends LogEntryBase {
 
        /**
         * Publishes the log entry.
-        * @param $newId int id of the log entry.
-        * @param $to string: rcandudp (default), rc, udp
+        * @param int $newId id of the log entry.
+        * @param string $to rcandudp (default), rc, udp
         */
        public function publish( $newId, $to = 'rcandudp' ) {
                $log = new LogPage( $this->getType() );