\Drupal\strata\Restore RestorePlan

What a restore would do, subject by subject, before anything is written.

The document the confirm form prints and the audit log keeps. It exists because a rollback is not one decision but one per subject: some can be put back exactly, some only in part, some not at all, and an operator who is shown a single "restore 1,412 items" button is not being told which.

A plan is produced without writing anything and is the same plan the apply uses, so what is confirmed is what happens.

Summary

Methods
Properties
Constants
__construct
withStatus
counts
writable
skipped
isEmpty
isComplete
summary
jsonSerialize
target
depth
subjects
problems
fillDegraded
seconds
plannedAt
acceptConflicts
No public constants found
No protected methods found
No protected properties found
No protected constants found
isWritable
No private properties found
No private constants found

Properties

$target

$target : string

Type

string

$depth

$depth : int

Type

int

$subjects

$subjects : array

Type

array<string|int, mixed>

$problems

$problems : array

Type

array<string|int, mixed>

$fillDegraded

$fillDegraded : bool

Type

bool

$seconds

$seconds : float

Type

float

$plannedAt

$plannedAt : int

Type

int

$acceptConflicts

$acceptConflicts : bool

Type

bool

Methods

__construct()

__construct(string  $target, int  $depth = 0, array  $subjects = [], list  $problems = [], bool  $fillDegraded = false, float  $seconds = 0.0, int  $plannedAt = 0, bool  $acceptConflicts = false) : mixed

Constructs a plan.

Parameters

string $target

Commit the restore targets.

int $depth

How many commits a replay covers to reach it, which is what the restore costs to compute.

array $subjects

Subject path keyed to what a replay produced for it.

list $problems

One line per subject that could not be planned at all.

bool $fillDegraded

Whether the scope opted in to writing partial reconstructions. FALSE is the default and the only safe answer without a human saying otherwise.

float $seconds

How long planning took.

int $plannedAt

Unix microseconds the plan was built. What a concurrent edit is measured against: a subject written after this moment was written by somebody who had not seen the plan.

bool $acceptConflicts

Whether the scope opted in to overwriting a subject somebody changed while the plan was waiting. FALSE by default: overwriting an edit nobody saw is a decision, not a detail.

Returns

mixed —

withStatus()

withStatus(\Drupal\strata\Restore\SubjectStatus  $status) : array<string,\Drupal\strata\Restore\ReplayResult>

Subjects at one status.

Parameters

\Drupal\strata\Restore\SubjectStatus $status

The status to filter on.

Returns

array

Subject path keyed to its result.

counts()

counts() : array<string,int>

How many subjects sit at each status.

Returns

array

Status value keyed to its count, with every status present even at zero so a form can render the full breakdown without inventing rows.

writable()

writable() : array<string,\Drupal\strata\Restore\ReplayResult>

The subjects an apply would actually write.

Returns

array

Subject path keyed to its result.

skipped()

skipped() : array<string,string>

The subjects an apply would leave alone, and why.

Returns

array

Subject path keyed to the reason it is skipped.

isEmpty()

isEmpty() : bool

Whether the plan would write anything.

Returns

bool —

TRUE when at least one subject is writable.

isComplete()

isComplete() : bool

Whether every subject in the plan can be put back exactly.

Returns

bool —

TRUE when nothing is degraded or unrestorable.

summary()

summary() : string

A one-line summary for a log entry or a command's output.

Returns

string —

The summary.

jsonSerialize()

jsonSerialize() : array<string,mixed>

{@inheritdoc}

Returns

array

The plan as a plain array, which is the form the audit log keeps.

isWritable()

isWritable(\Drupal\strata\Restore\ReplayResult  $result) : bool

Whether one result would be written.

Parameters

\Drupal\strata\Restore\ReplayResult $result

The result.

Returns

bool —

TRUE when the status allows it, or the scope opted in to partial reconstructions.