* @since 1.19
*/
abstract class LogEntryBase implements LogEntry {
-
public function getFullType() {
return $this->getType() . '/' . $this->getSubtype();
}
// Non-static->
- /// Database result row.
+ /** @var stdClass Database result row. */
protected $row;
+
+ /** @var User */
protected $performer;
protected function __construct( $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;
/**
* 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;
* The first two parameters used to be $skin and $out, but now only a context
* is needed, that's why there's a second unused parameter.
*
- * @param $context IContextSource Context to use; formerly it was Skin object.
- * @param $unused void Unused; used to be an OutputPage object.
- * @param int $flags flags; can be a combinaison of self::NO_ACTION_LINK,
- * self::NO_EXTRA_USER_LINKS or self::USE_REVDEL_CHECKBOXES.
+ * @param IContextSource|Skin $context Context to use; formerly it was
+ * a Skin object. Use of Skin is deprecated.
+ * @param null $unused Unused; used to be an OutputPage object.
+ * @param int $flags Can be a combination of self::NO_ACTION_LINK,
+ * self::NO_EXTRA_USER_LINKS or self::USE_REVDEL_CHECKBOXES.
*/
public function __construct( $context, $unused = null, $flags = 0 ) {
if ( $context instanceof IContextSource ) {
* Deprecated alias for getTitle(); do not use.
*
* @deprecated in 1.20; use getTitle() instead.
- * @return Title object
+ * @return Title
*/
public function getDisplayTitle() {
return $this->getTitle();
/**
* Set page title and show header for this log type
- * @param $type Array
+ * @param array $type
* @deprecated in 1.19
*/
public function showHeader( $type ) {
/**
* Show options for the log list
*
- * @param string $types or Array
- * @param $user String
- * @param $page String
- * @param $pattern String
- * @param $year Integer: year
- * @param $month Integer: month
- * @param $filter: array
- * @param $tagFilter: array?
+ * @param array|string $types
+ * @param string $user
+ * @param string $page
+ * @param string $pattern
+ * @param int $year Year
+ * @param int $month Month
+ * @param array $filter
+ * @param string $tagFilter Tag to select by default
*/
public function showOptions( $types = array(), $user = '', $page = '', $pattern = '', $year = '',
$month = '', $filter = null, $tagFilter = '' ) {
}
/**
- * @param $filter Array
- * @return String: Formatted HTML
+ * @param array $filter
+ * @return string Formatted HTML
*/
private function getFilterLinks( $filter ) {
// show/hide links
}
/**
- * @param $queryTypes Array
- * @return String: Formatted HTML
+ * @param array $queryTypes
+ * @return string Formatted HTML
*/
private function getTypeMenu( $queryTypes ) {
$queryType = count( $queryTypes ) == 1 ? $queryTypes[0] : '';
}
/**
- * @param $user String
- * @return String: Formatted HTML
+ * @param string $user
+ * @return string Formatted HTML
*/
private function getUserInput( $user ) {
$label = Xml::inputLabel(
}
/**
- * @param $title String
- * @return String: Formatted HTML
+ * @param string $title
+ * @return string Formatted HTML
*/
private function getTitleInput( $title ) {
$label = Xml::inputLabel(
}
/**
- * @param $types
+ * @param array $types
* @return string
*/
private function getExtraInputs( $types ) {
}
/**
- * @param $row Row: a single row from the result set
- * @return String: Formatted HTML list item
+ * @param stdClass $row A single row from the result set
+ * @return string Formatted HTML list item
*/
public function logLine( $row ) {
$entry = DatabaseLogEntry::newFromRow( $row );
}
/**
- * @param $row Row
+ * @param stdClass $row Row
* @return string
*/
private function getShowHideLinks( $row ) {
}
/**
- * @param $row Row
- * @param $type Mixed: string/array
- * @param $action Mixed: string/array
- * @param $right string
- * @return Boolean
+ * @param stdClass $row Row
+ * @param string|array $type
+ * @param string|array $action
+ * @param string $right
+ * @return bool
*/
public static function typeAction( $row, $type, $action, $right = '' ) {
$match = is_array( $type ) ?
* Determine if the current user is allowed to view a particular
* field of this log row, if it's marked as deleted.
*
- * @param $row Row
- * @param $field Integer
- * @param $user User object to check, or null to use $wgUser
- * @return Boolean
+ * @param stdClass $row Row
+ * @param int $field
+ * @param User $user User to check, or null to use $wgUser
+ * @return bool
*/
public static function userCan( $row, $field, User $user = null ) {
return self::userCanBitfield( $row->log_deleted, $field, $user );
* Determine if the current user is allowed to view a particular
* field of this log row, if it's marked as deleted.
*
- * @param $bitfield Integer (current field)
- * @param $field Integer
- * @param $user User object to check, or null to use $wgUser
- * @return Boolean
+ * @param int $bitfield Current field
+ * @param int $field
+ * @param User $user User to check, or null to use $wgUser
+ * @return bool
*/
public static function userCanBitfield( $bitfield, $field, User $user = null ) {
if ( $bitfield & $field ) {
}
/**
- * @param $row Row
- * @param $field Integer: one of DELETED_* bitfield constants
- * @return Boolean
+ * @param stdClass $row Row
+ * @param int $field One of DELETED_* bitfield constants
+ * @return bool
*/
public static function isDeleted( $row, $field ) {
return ( $row->log_deleted & $field ) == $field;
/**
* Show log extract. Either with text and a box (set $msgKey) or without (don't set $msgKey)
*
- * @param $out OutputPage|String-by-reference
+ * @param OutputPage|string $out By-reference
* @param string|array $types Log types to show
* @param string|Title $page The page title to show log entries for
* @param string $user The user who made the log entries
* - wrap String Wrap the message in html (usually something like "<div ...>$1</div>").
* - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS)
* - useRequestParams boolean Set true to use Pager-related parameters in the WebRequest
- * @return Integer Number of total log items (not limited by $lim)
+ * @return int Number of total log items (not limited by $lim)
*/
public static function showLogExtract(
&$out, $types = array(), $page = '', $user = '', $param = array()
$pager->mOffset = "";
$pager->mIsBackwards = false;
}
+
if ( isset( $param['offset'] ) ) { # Tell pager to ignore WebRequest offset
$pager->setOffset( $param['offset'] );
}
+
if ( $lim > 0 ) {
$pager->mLimit = $lim;
}
+
$logBody = $pager->getBody();
$s = '';
+
if ( $logBody ) {
if ( $msgKey[0] ) {
$s = '<div class="mw-warning-with-logexcerpt">';
$s = Html::rawElement( 'div', array( 'class' => 'mw-warning-logempty' ),
$context->msg( 'logempty' )->parse() );
}
+
if ( $pager->getNumRows() > $pager->mLimit ) { # Show "Full log" link
$urlParam = array();
if ( $page instanceof Title ) {
} elseif ( $page != '' ) {
$urlParam['page'] = $page;
}
+
if ( $user != '' ) {
$urlParam['user'] = $user;
}
+
if ( !is_array( $types ) ) { # Make it an array, if it isn't
$types = array( $types );
}
+
# If there is exactly one log type, we can link to Special:Log?type=foo
if ( count( $types ) == 1 ) {
$urlParam['type'] = $types[0];
}
+
$s .= Linker::link(
SpecialPage::getTitleFor( 'Log' ),
$context->msg( 'log-fulllog' )->escaped(),
$urlParam
);
}
+
if ( $logBody && $msgKey[0] ) {
$s .= '</div>';
}
/**
* SQL clause to skip forbidden log types for this user
*
- * @param $db DatabaseBase
- * @param $audience string, public/user
- * @param $user User object to check, or null to use $wgUser
- * @return Mixed: string or false
+ * @param DatabaseBase $db
+ * @param string $audience Public/user
+ * @param User $user User to check, or null to use $wgUser
+ * @return string|bool String on success, false on failure.
*/
public static function getExcludeClause( $db, $audience = 'public', User $user = null ) {
global $wgLogRestrictions;
/**
* Constructs a new formatter suitable for given entry.
- * @param $entry LogEntry
+ * @param LogEntry $entry
* @return LogFormatter
*/
public static function newFromEntry( LogEntry $entry ) {
// Nonstatic->
- /// @var LogEntry
+ /** @var LogEntryBase */
protected $entry;
/// Integer constant for handling log_deleted
* be included in page history or send to IRC feed. Links are replaced
* with plaintext or with [[pagename]] kind of syntax, that is parsed
* by page histories and IRC feeds.
- * @var boolean
+ * @var string
*/
protected $plaintext = false;
+ /** @var string */
protected $irctext = false;
protected function __construct( LogEntry $entry ) {
/**
* Replace the default context
- * @param $context IContextSource
+ * @param IContextSource $context
*/
public function setContext( IContextSource $context ) {
$this->context = $context;
* Set the visibility restrictions for displaying content.
* If set to public, and an item is deleted, then it will be replaced
* with a placeholder even if the context user is allowed to view it.
- * @param $audience integer self::FOR_THIS_USER or self::FOR_PUBLIC
+ * @param int $audience self::FOR_THIS_USER or self::FOR_PUBLIC
*/
public function setAudience( $audience ) {
$this->audience = ( $audience == self::FOR_THIS_USER )
/**
* Check if a log item can be displayed
- * @param $field integer LogPage::DELETED_* constant
+ * @param int $field LogPage::DELETED_* constant
* @return bool
*/
protected function canView( $field ) {
* If set to true, will produce user tool links after
* the user name. This should be replaced with generic
* CSS/JS solution.
- * @param $value boolean
+ * @param bool $value
*/
public function setShowUserToolLinks( $value ) {
$this->linkFlood = $value;
* Usually you also want to set extraneous request context
* to avoid formatting for any particular user.
* @see getActionText()
- * @return string text
+ * @return string Plain text
*/
public function getPlainActionText() {
$this->plaintext = true;
/**
* Returns a sentence describing the log action. Usually
* a Message object is returned, but old style log types
- * and entries might return pre-escaped html string.
- * @return Message|string pre-escaped html
+ * and entries might return pre-escaped HTML string.
+ * @return Message|string Pre-escaped HTML
*/
protected function getActionMessage() {
$message = $this->msg( $this->getMessageKey() );
* Default is logentry-TYPE-SUBTYPE for modern logs. Legacy log
* types will use custom keys, and subclasses can also alter the
* key depending on the entry itself.
- * @return string message key
+ * @return string Message key
*/
protected function getMessageKey() {
$type = $this->entry->getType();
* * number: Format value as number
* @param string $value The parameter value that should
* be formated
- * @return string or Message::numParam or Message::rawParam
+ * @return string|Message::numParam|Message::rawParam
* Formated value
* @since 1.21
*/
/**
* Helper to make a link to the page, taking the plaintext
* value in consideration.
- * @param $title Title the page
- * @param array $parameters query parameters
+ * @param Title $title The page
+ * @param array $parameters Query parameters
* @throws MWException
- * @return String
+ * @return string
*/
protected function makePageLink( Title $title = null, $parameters = array() ) {
if ( !$this->plaintext ) {
* Provides the name of the user who performed the log action.
* Used as part of log action message or standalone, depending
* which parts of the log entry has been hidden.
- * @return String
+ * @return string
*/
public function getPerformerElement() {
if ( $this->canView( LogPage::DELETED_USER ) ) {
/**
* Helper method for displaying restricted element.
- * @param $message string
- * @return string HTML or wikitext
+ * @param string $message
+ * @return string HTML or wiki text
*/
protected function getRestrictedElement( $message ) {
if ( $this->plaintext ) {
/**
* Helper method for styling restricted element.
- * @param $content string
- * @return string HTML or wikitext
+ * @param string $content
+ * @return string HTML or wiki text
*/
protected function styleRestricedElement( $content ) {
if ( $this->plaintext ) {
/**
* Shortcut for wfMessage which honors local context.
- * @todo Would it be better to require replacing the global context instead?
- * @param $key string
+ * @param string $key
* @return Message
*/
protected function msg( $key ) {
}
/**
- * @return Array of titles that should be preloaded with LinkBatch.
+ * @return array of titles that should be preloaded with LinkBatch.
*/
public function getPreloadTitles() {
return array();
}
/**
- * @return Output of getMessageParameters() for testing
+ * @return array Output of getMessageParameters() for testing
*/
public function getMessageParametersForTesting() {
// This function was added because getMessageParameters() is
* @since 1.19
*/
class LegacyLogFormatter extends LogFormatter {
-
/**
* Backward compatibility for extension changing the comment from
* the LogLine hook. This will be set by the first call on getComment(),
const DELETED_COMMENT = 2;
const DELETED_USER = 4;
const DELETED_RESTRICTED = 8;
+
// Convenience fields
const SUPPRESSED_USER = 12;
const SUPPRESSED_ACTION = 9;
- /* @access private */
- var $type, $action, $comment, $params;
- /**
- * @var User
+ /** @var bool */
+ var $updateRecentChanges;
+
+ /** @var bool */
+ var $sendToUDP;
+
+ /** @var string One of '', 'block', 'protect', 'rights', 'delete',
+ * 'upload', 'move'
*/
+ var $type;
+
+ /** @var string One of '', 'block', 'protect', 'rights', 'delete',
+ * 'upload', 'move', 'move_redir' */
+ var $action;
+
+ /** @var string Comment associated with action */
+ var $comment;
+
+ /** @var string Blob made of a parameters array */
+ var $params;
+
+ /** @var User The user doing the action */
var $doer;
- /**
- * @var Title
- */
+ /** @var Title */
var $target;
- /* @access public */
- var $updateRecentChanges, $sendToUDP;
-
/**
* Constructor
*
- * @param string $type one of '', 'block', 'protect', 'rights', 'delete',
- * 'upload', 'move'
- * @param $rc Boolean: whether to update recent changes as well as the logging table
- * @param string $udp pass 'UDP' to send to the UDP feed if NOT sent to RC
+ * @param string $type One of '', 'block', 'protect', 'rights', 'delete',
+ * 'upload', 'move'
+ * @param bool $rc Whether to update recent changes as well as the logging table
+ * @param string $udp Pass 'UDP' to send to the UDP feed if NOT sent to RC
*/
public function __construct( $type, $rc = true, $udp = 'skipUDP' ) {
$this->type = $type;
/**
* Get the list of valid log types
*
- * @return Array of strings
+ * @return array of strings
*/
public static function validTypes() {
global $wgLogTypes;
/**
* Is $type a valid log type
*
- * @param string $type log type to check
- * @return Boolean
+ * @param string $type Log type to check
+ * @return bool
*/
public static function isLogType( $type ) {
return in_array( $type, LogPage::validTypes() );
/**
* Get the name for the given log type
*
- * @param string $type logtype
- * @return String: log name
+ * @param string $type Log type
+ * @return string Log name
* @deprecated in 1.19, warnings in 1.21. Use getName()
*/
public static function logName( $type ) {
*
* @todo handle missing log types
* @param string $type logtype
- * @return String: headertext of this logtype
+ * @return string Header text of this logtype
* @deprecated in 1.19, warnings in 1.21. Use getDescription()
*/
public static function logHeader( $type ) {
*
* @param string $type log type
* @param string $action log action
- * @param $title Mixed: Title object or null
- * @param $skin Mixed: Skin object or null. If null, we want to use the wiki
- * content language, since that will go to the IRC feed.
+ * @param Title|null $title Title object or null
+ * @param Skin|null $skin Skin object or null. If null, we want to use the wiki
+ * content language, since that will go to the IRC feed.
* @param array $params parameters
- * @param $filterWikilinks Boolean: whether to filter wiki links
- * @return HTML string
+ * @param bool $filterWikilinks Whether to filter wiki links
+ * @return string HTML
*/
public static function actionText( $type, $action, $title = null, $skin = null,
$params = array(), $filterWikilinks = false
}
/**
- * TODO document
- * @param $type String
- * @param $lang Language or null
- * @param $title Title
- * @param $params Array
- * @return String
+ * @todo Document
+ * @param string $type
+ * @param Language|null $lang
+ * @param Title $title
+ * @param array $params
+ * @return string
*/
protected static function getTitleLink( $type, $lang, $title, &$params ) {
if ( !$lang ) {
*
* @param string $action one of '', 'block', 'protect', 'rights', 'delete',
* 'upload', 'move', 'move_redir'
- * @param $target Title object
+ * @param Title $target Title object
* @param string $comment description associated
* @param array $params parameters passed later to wfMessage function
- * @param $doer User object: the user doing the action
+ * @param null|int|User $doer The user doing the action. null for $wgUser
*
* @return int log_id of the inserted log entry
*/
/**
* Add relations to log_search table
*
- * @param $field String
- * @param $values Array
- * @param $logid Integer
- * @return Boolean
+ * @param string $field
+ * @param array $values
+ * @param int $logid
+ * @return bool
*/
public function addRelations( $field, $values, $logid ) {
if ( !strlen( $field ) || empty( $values ) ) {
/**
* Create a blob from a parameter array
*
- * @param $params Array
- * @return String
+ * @param array $params
+ * @return string
*/
public static function makeParamBlob( $params ) {
return implode( "\n", $params );
/**
* Extract a parameter array from a blob
*
- * @param $blob String
- * @return Array
+ * @param string $blob
+ * @return array
*/
public static function extractParams( $blob ) {
if ( $blob === '' ) {
* into a more readable (and translated) form
*
* @param string $flags Flags to format
- * @param $lang Language object to use
- * @return String
+ * @param Language $lang
+ * @return string
*/
public static function formatBlockFlags( $flags, $lang ) {
$flags = trim( $flags );
* Translate a block log flag if possible
*
* @param int $flag Flag to translate
- * @param $lang Language object to use
- * @return String
+ * @param Language $lang Language object to use
+ * @return string
*/
public static function formatBlockFlag( $flag, $lang ) {
static $messages = array();
* @ingroup Pager
*/
class LogPager extends ReverseChronologicalPager {
+ /** @var array Log types */
private $types = array();
+
+ /** @var string Events limited to those by performer when set */
private $performer = '';
+
+ /** @var string|Title Events limited to those about Title when set */
private $title = '';
+
+ /** @var string */
private $pattern = '';
+
+ /** @var string */
private $typeCGI = '';
+
+ /** @var LogEventsList */
public $mLogEventsList;
/**
* Set the log reader to return only entries of the given type.
* Type restrictions enforced here
*
- * @param string $types or array: Log types ('upload', 'delete', etc);
+ * @param string|array $types Log types ('upload', 'delete', etc);
* empty string means no restriction
*/
private function limitType( $types ) {
* Set the log reader to return only entries affecting the given page.
* (For the block and rights logs, this is a user page.)
*
- * @param string $page or Title object: Title name
- * @param $pattern String
+ * @param string|Title $page Title name
+ * @param string $pattern
* @return bool
*/
private function limitTitle( $page, $pattern ) {
/**
* Record a log event for a change being patrolled
*
- * @param $rc Mixed: change identifier or RecentChange object
- * @param $auto Boolean: was this patrol event automatic?
- * @param $user User: user performing the action or null to use $wgUser
+ * @param mixed $rc Change identifier or RecentChange object
+ * @param bool $auto Was this patrol event automatic?
+ * @param User $user User performing the action or null to use $wgUser
*
* @return bool
*/
/**
* Prepare log parameters for a patrolled change
*
- * @param $change RecentChange to represent
- * @param $auto Boolean: whether the patrol event was automatic
- * @return Array
+ * @param RecentChange $change RecentChange to represent
+ * @param bool $auto Whether the patrol event was automatic
+ * @return array
*/
private static function buildParams( $change, $auto ) {
return array(