/** @var string */
private $typeCGI = '';
+ /** @var string */
+ private $action = '';
+
/** @var LogEventsList */
public $mLogEventsList;
* @param int|bool $year The year to start from. Default: false
* @param int|bool $month The month to start from. Default: false
* @param string $tagFilter Tag
+ * @param string $action Specific action (subtype) requested
*/
- public function __construct( $list, $types = [], $performer = '', $title = '', $pattern = '',
- $conds = [], $year = false, $month = false, $tagFilter = '' ) {
+ public function __construct( $list, $types = [], $performer = '', $title = '',
+ $pattern = '', $conds = [], $year = false, $month = false, $tagFilter = '',
+ $action = ''
+ ) {
parent::__construct( $list->getContext() );
$this->mConds = $conds;
$this->limitType( $types ); // also excludes hidden types
$this->limitPerformer( $performer );
$this->limitTitle( $title, $pattern );
+ $this->limitAction( $action );
$this->getDateCond( $year, $month );
$this->mTagFilter = $tagFilter;
}
}
+ /**
+ * Set the log_action field to a specified value (or values)
+ *
+ * @param string $action
+ */
+ private function limitAction( $action ) {
+ global $wgActionFilteredLogs;
+ // Allow to filter the log by actions
+ $type = $this->typeCGI;
+ if ( $type === '' ) {
+ // nothing to do
+ return;
+ }
+ $actions = $wgActionFilteredLogs;
+ if ( isset( $actions[$type] ) ) {
+ // log type can be filtered by actions
+ $this->mLogEventsList->setAllowedActions( array_keys( $actions[$type] ) );
+ if ( $action !== '' && isset( $actions[$type][$action] ) ) {
+ // add condition to query
+ $this->mConds['log_action'] = $actions[$type][$action];
+ $this->action = $action;
+ }
+ }
+ }
+
/**
* Constructs the most part of the query. Extra conditions are sprinkled in
* all over this class.
return $this->mTagFilter;
}
+ public function getAction() {
+ return $this->action;
+ }
+
public function doQuery() {
// Workaround MySQL optimizer bug
$this->mDb->setBigSelects();
LogEventsList::USE_CHECKBOXES
);
- $action = '';
- // Allow to filter the log by actions
- $type = $opts->getValue( 'type' );
- if ( $type !== '' ) {
- $actions = $this->getConfig()->get( 'ActionFilteredLogs' );
- if ( isset( $actions[$type] ) ) {
- // log type can be filtered by actions
- $loglist->setAllowedActions( array_keys( $actions[$type] ) );
- $action = $opts->getValue( 'subtype' );
- if ( $action !== '' && isset( $actions[$type][$action] ) ) {
- // add condition to query
- $extraConds['log_action'] = $actions[$type][$action];
- } else {
- // no action or invalid action
- $action = '';
- }
- }
- }
-
$pager = new LogPager(
$loglist,
$opts->getValue( 'type' ),
$extraConds,
$opts->getValue( 'year' ),
$opts->getValue( 'month' ),
- $opts->getValue( 'tagfilter' )
+ $opts->getValue( 'tagfilter' ),
+ $opts->getValue( 'subtype' )
);
$this->addHeader( $opts->getValue( 'type' ) );
# Show form options
$loglist->showOptions(
$pager->getType(),
- $opts->getValue( 'user' ),
+ $pager->getPerformer(),
$pager->getPage(),
$pager->getPattern(),
$pager->getYear(),
$pager->getMonth(),
$pager->getFilterParams(),
- $opts->getValue( 'tagfilter' ),
- $action
+ $pager->getTagFilter(),
+ $pager->getAction()
);
# Insert list