$engine
$engine : \Drupal\strata\Engine
The commands that read history back and the commands that write it over the live site.
A restore is planned before it is applied, and the plan is what the operator is shown. It carries a per-subject split - restorable, degraded, unrestorable - and the plan a confirmation applies is the same object that was printed, not a second one computed after the answer. A subject somebody changed while the plan was waiting is listed as a conflict and left alone unless the operator says otherwise, because overwriting an edit nobody reviewed is a decision rather than a detail.
A merge follows the same shape and the same rule. Its manifest is printed with both values of every key the two sides disagree about, and a strategy has to be named before any of them is decided. It covers the configuration realm alone; the other realms are captured as deltas against a parent, and merging two divergent delta chains would mean inventing values.
Archives are the same history in a portable file. An import verifies every content-addressed object against its own digest before writing it and never advances a ref, so importing history from elsewhere cannot change what this site restores to.
$engine : \Drupal\strata\Engine
$ledger : \Drupal\strata\Health\HealthLedgerInterface
__construct(\Drupal\strata\Engine $engine, \Drupal\strata\Health\HealthLedgerInterface $ledger) : mixed
Constructs the command set.
| \Drupal\strata\Engine | $engine | Builds the preflight, the replayer and the restore. |
| \Drupal\strata\Health\HealthLedgerInterface | $ledger | Holds the rung each finding code sits at, which is what a quarantine moves. |
diff(string $commit, string|null $other = null, array$options = ['subject' => \self::REQ, 'limit' => 200]) : \Consolidation\OutputFormatters\StructuredData\RowsOfFields
What differs between two points in history.
Without a subject this compares which subjects each commit covers, which is the question a rollback turns on: what would appear, what would disappear, and what exists in both. With one it reconstructs that subject at both commits and compares the fields.
| string | $commit | The commit to compare. |
| string|null | $other | The commit to compare it against, or NULL for the current head. |
| array |
$options | Command options. |
One row per difference, empty when the two points agree.
rollback(string $commit, array$options = ['dry-run' => false, 'limit' => 0, 'fill-degraded' => false, 'accept-conflicts' => false]) : \Consolidation\OutputFormatters\StructuredData\PropertyList
Puts the whole site back to a commit.
The plan is printed before the confirmation, with the restorable, degraded and unrestorable
split and every subject somebody has changed since the plan was built. A degraded subject is
one only partly reconstructable, and it is skipped unless --fill-degraded says otherwise:
writing half a node over a whole one loses data that was still there.
| string | $commit | Commit id to restore to. |
| array |
$options | Command options. |
What was written, or what would be.
restore(string $commit, string $subjects, array$options = ['dry-run' => false, 'fill-degraded' => false, 'accept-conflicts' => false]) : \Consolidation\OutputFormatters\StructuredData\PropertyList
Puts named subjects back to a commit, leaving the rest of the site alone.
A subject the target commit does not cover is planned anyway and comes back unrestorable, so "that node did not exist then" is an answer rather than an error.
| string | $commit | Commit id to restore to. |
| string | $subjects | Comma-separated subject paths, such as "entity/node:42,config/system.site". |
| array |
$options | Command options. |
What was written, or what would be.
quarantine(string|null $code = null, array$options = ['dry-run' => false, 'release' => false, 'refuse' => false]) : \Consolidation\OutputFormatters\StructuredData\RowsOfFields
Stops a finding code being treated as restorable, or lets it be again.
Quarantine sits above the ceiling an unattended run may reach, so nothing gets here without a person asking: the rung takes a restore target away, which is the thing a backup exists to provide. Called with no code it lists what is currently held.
| string|null | $code | The finding code to move, or NULL to list what is quarantined. |
| array |
$options | Command options. |
One row per code, empty when nothing is quarantined.
branch(string|null $name = null, array$options = ['from' => \self::REQ, 'delete' => false]) : \Consolidation\OutputFormatters\StructuredData\RowsOfFields
Lists the configuration branches, or creates and removes one.
Called with no name it lists what the store holds. Called with one it cuts a branch off the
trunk's tip, or off --from, and --delete removes the name while leaving every commit it
pointed at in place for a prune to decide about.
A branch carries configuration and nothing else, because configuration is captured whole and
every other realm is captured as deltas against a parent. Flush onto one with
drush strata:flush --ref=heads/NAME.
| string|null | $name | The branch name, or NULL to list what exists. |
| array |
$options | Command options. |
One row per branch, the trunk included.
merge(string $name, array$options = ['strategy' => \self::REQ, 'dry-run' => false]) : \Consolidation\OutputFormatters\StructuredData\PropertyList
Merges a configuration branch back into the trunk.
The manifest is printed before the confirmation: every object the merge would write, every one
it would keep, and both values of every key the two sides disagree about. A conflict stops the
merge unless --strategy names what to do with it, because two people having written different
answers to the same question is not something to decide by default.
Applying goes through the ordinary logical restore, so the pre-write snapshot that makes it undoable is taken whatever the options say.
| string | $name | The branch to merge. |
| array |
$options | Command options. |
What was written, or what would be.
export(string $path, array$options = ['from' => \self::REQ, 'limit' => \self::REQ]) : \Consolidation\OutputFormatters\StructuredData\PropertyList
Writes a span of history into one portable file.
What makes the archive restorable is the closure rather than the commits: every anchor a commit resolves through, every frame those anchors and segments name, every delta parent up each chain, and every dictionary any of those frames needs. An archive missing one of them unpacks cleanly and restores nothing, so anything unreadable is recorded as a problem rather than skipped.
| string | $path | Where to write. A ".gz" or ".tgz" suffix compresses the archive. |
| array |
$options | Command options. |
What was written.
import(string $path, array$options = ['dry-run' => false]) : \Consolidation\OutputFormatters\StructuredData\PropertyList
Loads an archive's objects into this site's store.
Every content-addressed object is checked against the digest it is filed under before it is
written, so an archive that was edited or truncated is caught here rather than at the moment
somebody needs the restore. The ref is never advanced and the local indexes are not rebuilt;
strata:reindex does that from the objects an import has just put in place.
| string | $path | The archive to read. |
| array |
$options | Command options. |
What was written, or what would be.
value(array$options, string $name) : string|null
Reads an option that carries a value.
A value option declares DrushCommands::REQ as its default, and Drush replaces that with the
string the operator supplied or with NULL before the command body runs. A method called
directly - from a test, a hook, or another command - still sees the sentinel, and both forms
mean that nothing was supplied. Drush only ever passes a string, so an integer sentinel cannot
be confused with a value.
| array |
$options | The options the command was called with. |
| string | $name | The option name. |
The value, or NULL when none was supplied.
number(array$options, string $name, int $fallback) : int
Reads an option that carries a whole number.
| array |
$options | The options the command was called with. |
| string | $name | The option name. |
| int | $fallback | What to return when nothing was supplied. |
The value, or the fallback.
agreed(string $question) : bool
Asks before doing something that removes a restore target or overwrites live data.
Drush answers this itself under --yes and --no, so a scripted run never blocks. The
default is no, because the question is only ever asked about something irreversible.
| string | $question | What is about to happen, phrased as a question. |
TRUE to go ahead.
announce(bool $acted, string $summary) : void
States what a pass did, at the severity the outcome deserves.
A pass that ran and a pass that declined to run both produce a summary worth reading, and the difference between them is what an operator watching a scheduled job needs to see.
| bool | $acted | TRUE when the pass did the thing it was asked to do. |
| string | $summary | The one-line summary to print. |
digest(string|null $digest) : string
Shortens a content address for a table cell.
Anything that is not a digest is returned whole, so an object key or a refusal reason passed here is readable rather than truncated to twelve characters of a path.
| string|null | $digest | The digest, or NULL. |
The first twelve characters of a digest, the value unchanged when it is not one, or "-".
exporter() : \Drupal\strata\Archive\ArchiveExporter
The archive writer, built when a command asks for one.
Not a constructor argument. Building one assembles the whole store, which refuses on a site
that has not chosen a key yet, and Drush answers a constructor that throws by dropping every
command on the class with a debug-level line nobody sees. Losing strata:rollback because
strata:export could not be built is the wrong trade at exactly the moment somebody needs it.
The exporter.
applyPlan(\Drupal\strata\Restore\RestorePlan $plan, string $scope, bool $dryRun) : \Consolidation\OutputFormatters\StructuredData\PropertyList
Prints a plan, asks about it, and applies it.
The plan handed to the restore is the one that was printed, so a subject that changed between the two is caught as a conflict rather than written silently.
| \Drupal\strata\Restore\RestorePlan | $plan | The plan. |
| string | $scope | What the restore was scoped to, as the operator expressed it. |
| bool | $dryRun | TRUE to stop after printing. |
What was written, or what would be.
resultList(\Drupal\strata\Restore\RestorePlan $plan, \Drupal\strata\Restore\RestoreResult $result) : \Consolidation\OutputFormatters\StructuredData\PropertyList
Turns a plan and its outcome into the command's result.
| \Drupal\strata\Restore\RestorePlan | $plan | The plan. |
| \Drupal\strata\Restore\RestoreResult | $result | What the restore did. |
The result.
mergeList(\Drupal\strata\Branch\MergeResult $result) : \Consolidation\OutputFormatters\StructuredData\PropertyList
Turns a merge outcome into the command's result.
| \Drupal\strata\Branch\MergeResult | $result | What the merge did. |
The result.
fieldDiff(string $left, string $right, string $subject, int $limit) : array<string,array<string,string>>
The field-level difference for one subject between two commits.
| string | $left | The commit to compare. |
| string | $right | The commit to compare it against. |
| string | $subject | Subject path. |
| int | $limit | Most fields to report. |
Field name keyed to its row.
manifestList(string $path, \Drupal\strata\Archive\ArchiveManifest $manifest) : \Consolidation\OutputFormatters\StructuredData\PropertyList
Turns a manifest into the command's result.
| string | $path | The archive path. |
| \Drupal\strata\Archive\ArchiveManifest | $manifest | The manifest. |
The result.