* @since 1.19
*/
abstract class LogEntryBase implements LogEntry {
-
public function getFullType() {
return $this->getType() . '/' . $this->getSubtype();
}
/**
* 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 );
}
// 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;
}
* @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.
* 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 ) {
/**
* 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 ) {