* 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() {
wfDeprecated( __METHOD__, '1.20' );
/**
* 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 = 0,
$month = 0, $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)
+ * - useMaster boolean Use master DB
+ * @return int Number of total log items (not limited by $lim)
*/
public static function showLogExtract(
&$out, $types = array(), $page = '', $user = '', $param = array()
'wrap' => "$1",
'flags' => 0,
'useRequestParams' => false,
+ 'useMaster' => false,
);
# The + operator appends elements of remaining keys from the right
# handed array to the left handed, whereas duplicated keys are NOT overwritten.
$pager->mOffset = "";
$pager->mIsBackwards = false;
}
+
+ if ( $param['useMaster'] ) {
+ $pager->mDb = wfGetDB( DB_MASTER );
+ }
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">';
+ $dir = $context->getLanguage()->getDir();
+ $lang = $context->getLanguage()->getCode();
+
+ $s = Xml::openElement( 'div', array(
+ 'class' => "mw-warning-with-logexcerpt mw-content-$dir",
+ 'dir' => $dir,
+ 'lang' => $lang,
+ ) );
if ( count( $msgKey ) == 1 ) {
$s .= $context->msg( $msgKey[0] )->parseAsBlock();
$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;