Merge "(bug 47070) check content model namespace on import."
[lhc/web/wiklou.git] / includes / logging / LogEntry.php
index e15943f..71b4fc2 100644 (file)
@@ -99,7 +99,6 @@ interface LogEntry {
  * @since 1.19
  */
 abstract class LogEntryBase implements LogEntry {
-
        public function getFullType() {
                return $this->getType() . '/' . $this->getSubtype();
        }
@@ -158,12 +157,13 @@ class DatabaseLogEntry extends LogEntryBase {
        /**
         * Constructs new LogEntry from database result row.
         * Supports rows from both logging and recentchanges table.
-        * @param $row
+        * @param stdClass|array $row
         * @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 );
                }
@@ -171,10 +171,17 @@ class DatabaseLogEntry extends LogEntryBase {
 
        // Non-static->
 
-       /// Database result row.
+       /** @var stdClass Database result row. */
        protected $row;
+
+       /** @var User */
        protected $performer;
 
+       /** @var bool Whether the parameters for this log entry are stored in new
+        *    or old format.
+        */
+       protected $legacy;
+
        protected function __construct( $row ) {
                $this->row = $row;
        }
@@ -333,15 +340,35 @@ class RCDatabaseLogEntry extends DatabaseLogEntry {
  * @since 1.19
  */
 class ManualLogEntry extends LogEntryBase {
-       protected $type; ///!< @var string
-       protected $subtype; ///!< @var string
-       protected $parameters = array(); ///!< @var array
-       protected $relations = array(); ///!< @var array
-       protected $performer; ///!< @var User
-       protected $target; ///!< @var Title
-       protected $timestamp; ///!< @var string
-       protected $comment = ''; ///!< @var string
-       protected $deleted; ///!< @var int
+       /** @var string Type of log entry */
+       protected $type;
+
+       /** @var string Sub type of log entry */
+       protected $subtype;
+
+       /** @var array Parameters for log entry */
+       protected $parameters = array();
+
+       /** @var array */
+       protected $relations = array();
+
+       /** @var User Performer of the action for the log entry */
+       protected $performer;
+
+       /** @var Title Target title for the log entry */
+       protected $target;
+
+       /** @var string Timestamp of creation of the log entry */
+       protected $timestamp;
+
+       /** @var string Comment for the log entry */
+       protected $comment = '';
+
+       /** @var int Deletion state of the log entry */
+       protected $deleted;
+
+       /** @var int ID of the log entry */
+       protected $id;
 
        /**
         * Constructor.
@@ -380,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 Map of (tag => (list of values))
+        * @param array $relations Map of (tag => (list of values))
         * @since 1.22
         */
        public function setRelations( array $relations ) {
@@ -445,12 +472,13 @@ class ManualLogEntry extends LogEntryBase {
        /**
         * Inserts the entry into the logging table.
         * @param IDatabase $dbw
-        * @return int If of the log entry
+        * @return int ID of the log entry
+        * @throws MWException
         */
        public function insert( IDatabase $dbw = null ) {
                global $wgContLang;
 
-               $dbw = $dbw ? : wfGetDB( DB_MASTER );
+               $dbw = $dbw ?: wfGetDB( DB_MASTER );
                $id = $dbw->nextSequenceValue( 'logging_log_id_seq' );
 
                if ( $this->timestamp === null ) {