Page MenuHomePhabricator

BlockUser should allow altering visibility of the block log entry
Closed, ResolvedPublic


Splitting from T152394: BlockUser::log() creates a log entry and inserts it, without offering any way for callers to alter the entry. In particular, it is not possible to alter visibility of the entry (via ManualLogEntry::setDeleted), which has at least a use case (see mentioned task). Three possible solutions:

  1. Add a setter for log entry visibility, i.e.
/** @var int|null */
private $logDeletionFlags;

 * @param int $flags One of LogPage::* constants
public function setLogDeletionFlags( int $flags ) : void {
    $this->logDeletionFlags = $flags;

private function log( DatabaseBlock $block, bool $isReblock ) {
     // ...
    if ( $this->logDeletionFlags !== null ) {
        $logEntry->setDeleted( $this->logDeletionFlags );
    // ...
  1. Add it as a constructor parameter inside $blockOptions
  2. Add a hook to allow further customization of the entry

I would be fine with any of these solutions, keeping in mind that option (3.) might lack real use cases, and it would have to be considered as a long-term solution, whereas (1) and (2) can be introduced as a more hacky/temporary™ solution.

Tagging AHT per developers/maintainers.

Event Timeline

Change 656612 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/core@master] Add a temporary method for setting visibility of the block log entry

Proposal submitted. I've marked it as unstable so it can be changed later on if we want to.

Change 656612 merged by jenkins-bot:
[mediawiki/core@master] Add a temporary method for setting visibility of the block log entry

Daimona removed a project: Patch-For-Review.