Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RemoteWikiFactory: fix overriding assignment #630

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions includes/Services/RemoteWikiFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,9 @@ public function markInactive(): void {
$this->trackChange( 'inactive', 0, 1 );
$this->inactive = true;
$this->inactiveTimestamp = $this->dbr->timestamp();
$this->newRows += [
'wiki_inactive' => 1,
'wiki_inactive_timestamp' => $this->inactiveTimestamp,
];

$this->newRows['wiki_inactive'] = 1;
$this->newRows['wiki_inactive_timestamp'] = $this->inactiveTimestamp;
}

public function markActive(): void {
Expand All @@ -176,12 +175,13 @@ public function markActive(): void {
$this->closed = false;
$this->closedTimestamp = null;
$this->inactiveTimestamp = null;
$this->newRows += [

$this->newRows = array_merge( $this->newRows, [
'wiki_closed' => 0,
'wiki_closed_timestamp' => null,
'wiki_inactive' => 0,
'wiki_inactive_timestamp' => null,
];
] );
}

public function getInactiveTimestamp(): ?string {
Expand Down Expand Up @@ -226,9 +226,9 @@ public function isPrivate(): bool {

public function markPrivate(): void {
$this->trackChange( 'private', 0, 1 );
$this->hooks[] = 'CreateWikiStatePrivate';
$this->private = true;
$this->newRows['wiki_private'] = 1;
$this->hooks[] = 'CreateWikiStatePrivate';

$this->jobQueueGroupFactory->makeJobQueueGroup( $this->dbname )->push(
new JobSpecification(
Expand All @@ -240,9 +240,9 @@ public function markPrivate(): void {

public function markPublic(): void {
$this->trackChange( 'public', 0, 1 );
$this->hooks[] = 'CreateWikiStatePublic';
$this->private = false;
$this->newRows['wiki_private'] = 0;
$this->hooks[] = 'CreateWikiStatePublic';

$this->jobQueueGroupFactory->makeJobQueueGroup( $this->dbname )->push(
new JobSpecification(
Expand All @@ -258,17 +258,18 @@ public function isClosed(): bool {

public function markClosed(): void {
$this->trackChange( 'closed', 0, 1 );
$this->hooks[] = 'CreateWikiStateClosed';
$this->closed = true;
$this->inactive = false;
$this->closedTimestamp = $this->dbr->timestamp();
$this->inactiveTimestamp = null;
$this->newRows += [

$this->newRows = array_merge( $this->newRows, [
'wiki_closed' => 1,
'wiki_closed_timestamp' => $this->closedTimestamp,
'wiki_inactive' => 0,
'wiki_inactive_timestamp' => null,
];
$this->hooks[] = 'CreateWikiStateClosed';
] );
}

public function getClosedTimestamp(): ?string {
Expand All @@ -288,25 +289,25 @@ public function delete(): void {
$this->deletedTimestamp = $this->dbr->timestamp();
$this->closedTimestamp = null;
$this->inactiveTimestamp = null;
$this->newRows += [

$this->newRows = array_merge( $this->newRows, [
'wiki_deleted' => 1,
'wiki_deleted_timestamp' => $this->deletedTimestamp,
'wiki_closed' => 0,
'wiki_closed_timestamp' => null,
'wiki_inactive' => 0,
'wiki_inactive_timestamp' => null,
];
] );
}

public function undelete(): void {
$this->trackChange( 'deleted', 1, 0 );
$this->log = 'undelete';
$this->deleted = false;
$this->deletedTimestamp = null;
$this->newRows += [
'wiki_deleted' => 0,
'wiki_deleted_timestamp' => null,
];

$this->newRows['wiki_deleted'] = 0;
$this->newRows['wiki_deleted_timestamp'] = null;
}

public function getDeletedTimestamp(): ?string {
Expand Down
Loading