Merge "Improve styleability of RecentChanges form"
[lhc/web/wiklou.git] / includes / logging / LogEntry.php
index 76c2280..46c5515 100644 (file)
@@ -88,8 +88,8 @@ interface LogEntry {
        public function getDeleted();
 
        /**
-        * @param $field Integer: one of LogPage::DELETED_* bitfield constants
-        * @return Boolean
+        * @param int $field One of LogPage::DELETED_* bitfield constants
+        * @return bool
         */
        public function isDeleted( $field );
 }
@@ -161,8 +161,9 @@ class DatabaseLogEntry extends LogEntryBase {
         * @return DatabaseLogEntry
         */
        public static function newFromRow( $row ) {
-               if ( is_array( $row ) && isset( $row['rc_logid'] ) ) {
-                       return new RCDatabaseLogEntry( (object)$row );
+               $row = (object)$row;
+               if ( isset( $row->rc_logid ) ) {
+                       return new RCDatabaseLogEntry( $row );
                } else {
                        return new self( $row );
                }
@@ -406,7 +407,7 @@ class ManualLogEntry extends LogEntryBase {
         * Declare arbitrary tag/value relations to this log entry.
         * These can be used to filter log entries later on.
         *
-        * @param array $relations Map of (tag => (list of values))
+        * @param array $relations Map of (tag => (list of values|value))
         * @since 1.22
         */
        public function setRelations( array $relations ) {
@@ -462,7 +463,7 @@ class ManualLogEntry extends LogEntryBase {
         *
         * @since 1.19
         *
-        * @param integer $deleted
+        * @param int $deleted
         */
        public function setDeleted( $deleted ) {
                $this->deleted = $deleted;
@@ -503,6 +504,10 @@ class ManualLogEntry extends LogEntryBase {
                        'log_comment' => $comment,
                        'log_params' => serialize( (array)$this->getParameters() ),
                );
+               if ( isset( $this->deleted ) ) {
+                       $data['log_deleted'] = $this->deleted;
+               }
+
                $dbw->insert( 'logging', $data, __METHOD__ );
                $this->id = !is_null( $id ) ? $id : $dbw->insertId();
 
@@ -511,6 +516,11 @@ class ManualLogEntry extends LogEntryBase {
                        if ( !strlen( $tag ) ) {
                                throw new MWException( "Got empty log search tag." );
                        }
+
+                       if ( !is_array( $values ) ) {
+                               $values = array( $values );
+                       }
+
                        foreach ( $values as $value ) {
                                $rows[] = array(
                                        'ls_field' => $tag,
@@ -523,6 +533,10 @@ class ManualLogEntry extends LogEntryBase {
                        $dbw->insert( 'log_search', $rows, __METHOD__, 'IGNORE' );
                }
 
+               // Update any bloom filter cache
+               $member = $this->getTarget()->getNamespace() . ':' . $this->getTarget()->getDBkey();
+               BloomCache::get( 'main' )->insert( wfWikiId(), 'TitleHasLogs', $member );
+
                return $this->id;
        }
 
@@ -568,8 +582,8 @@ class ManualLogEntry extends LogEntryBase {
 
        /**
         * Publishes the log entry.
-        * @param int $newId id of the log entry.
-        * @param string $to rcandudp (default), rc, udp
+        * @param int $newId Id of the log entry.
+        * @param string $to One of: rcandudp (default), rc, udp
         */
        public function publish( $newId, $to = 'rcandudp' ) {
                $log = new LogPage( $this->getType() );