Restore

O Operator
Restore

Restore file to captured state

Every captured change carries its SHA-256-addressed content in BLOB_STORE. Restoring writes that content back to the original path — current file gets backed up to <path>.drift_restore_backup_<epoch> before overwrite.

What will change
Preview -- nothing has been written yet.
Target file/var/www/vhosts/3dshawn.com/site1/TEMPLATES/restore.html
SiteDriftSense self-monitor on local
Kindlocal
Captured at2026-07-12 00:02:05
Captured SHA10cf73c63f2d262a5669ad2dea63bd8f04522dd6b7601bbb11c80f32108848b4
Current state on disk
Live check just now. If SHAs match, the restore is a no-op.
File presentyes
Size9250 bytes
Current SHA4bed1ca57f38
Same as captured?no -- restore will change it
What restore will change — live diff
Left column shows current on-disk content; right shows what restore will write. +0 additions, -31 deletions, 146 unchanged context lines.
11<div class="page-head">
22 <span class="page-eyebrow"><span class="dot"></span> Restore</span>
33 <h1 class="page-title">Restore file to captured state</h1>
44 <p class="page-subtitle">Every captured change carries its SHA-256-addressed content in BLOB_STORE. Restoring writes that content back to the original path &mdash; current file gets backed up to <code>&lt;path&gt;.drift_restore_backup_&lt;epoch&gt;</code> before overwrite.</p>
55</div>
66
77[if:$has_error]
88<div class="module glow-rose">
99 <div class="module-head"><div class="left">
1010 <div class="module-title">Cannot proceed</div>
1111 <span class="module-subtitle">Restore rejected on safety grounds.</span>
1212 </div></div>
1313 <div class="module-body" style="color:var(--accent-danger-hi)">
1414 $error_msg
1515 </div>
1616</div>
1717[/if]
1818
1919[if:$did_restore]
2020 [if:$result_ok]
2121 <div class="module glow-emerald">
2222 <div class="module-head"><div class="left">
2323 <div class="module-icon"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2"><polyline points="20 6 9 17 4 12"/></svg></div>
2424 <div class="module-title">Restore succeeded</div>
2525 <span class="module-subtitle">Content at <code>$target_file</code> now matches captured SHA <code>$source_sha</code>. Prior content is safe in the backup file.</span>
2626 </div></div>
2727 <div class="module-body">
2828 <table class="tbl">
2929 <tbody>
3030 <tr><td style="width:200px"><strong>Target</strong></td><td class="mono">$target_file</td></tr>
3131 <tr><td><strong>Server</strong></td><td class="mono">$server_name (<span class="dim">$server_kind</span>)</td></tr>
3232 <tr><td><strong>Restored content SHA</strong></td><td class="mono">$source_sha</td></tr>
3333 <tr><td><strong>Captured at</strong></td><td class="mono dim"><span class="ts" data-ts="$captured_epoch" data-fmt="datetime">$captured_h</span></td></tr>
3434 <tr><td><strong>Backup file</strong></td><td class="mono dim">[if:$backup_path]$backup_path[/if][if:!$backup_path](no prior content to back up)[/if]</td></tr>
3535 <tr><td><strong>Result</strong></td><td>$result_msg</td></tr>
3636 </tbody>
3737 </table>
3838 <div style="margin-top:14px">
3939 <a href="/file_changes.cgi" class="tr-chip">Back to file changes</a>
4040 <a href="/diff.cgi?kind=file&id=$id" class="tr-chip">See diff</a>
4141 </div>
4242 </div>
4343 </div>
4444 [/if]
4545 [if:!$result_ok]
4646 <div class="module glow-rose">
4747 <div class="module-head"><div class="left">
4848 <div class="module-title">Restore failed</div>
4949 <span class="module-subtitle">See RESTORE_LOG for full audit trail.</span>
5050 </div></div>
5151 <div class="module-body">
5252 <p style="color:var(--accent-danger-hi)">$result_msg</p>
5353 <p class="dim" style="font-size:12.5px;margin-top:8px">Backup path: <code>$backup_path</code></p>
5454 </div>
5555 </div>
5656 [/if]
5757[/if]
5858
5959[if:!$did_restore][if:!$has_error]
6060<div class="dash-grid" style="grid-template-columns:1fr 1fr">
6161 <div class="module glow-teal">
6262 <div class="module-head"><div class="left">
6363 <div class="module-title">What will change</div>
6464 <span class="module-subtitle">Preview -- nothing has been written yet.</span>
6565 </div></div>
6666 <div class="module-body">
6767 <table class="tbl">
6868 <tbody>
6969 <tr><td style="width:170px"><strong>Target file</strong></td><td class="mono">$target_file</td></tr>
7070 <tr><td><strong>Site</strong></td><td>$scan_name <span class="dim">on $server_name</span></td></tr>
7171 <tr><td><strong>Kind</strong></td><td>$server_kind</td></tr>
7272 <tr><td><strong>Captured at</strong></td><td class="mono dim"><span class="ts" data-ts="$captured_epoch" data-fmt="datetime">$captured_h</span></td></tr>
7373 <tr><td><strong>Captured SHA</strong></td><td class="mono">$source_sha_full</td></tr>
7474 </tbody>
7575 </table>
7676 </div>
7777 </div>
7878 <div class="module glow-amber">
7979 <div class="module-head"><div class="left">
8080 <div class="module-title">Current state on disk</div>
8181 <span class="module-subtitle">Live check just now. If SHAs match, the restore is a no-op.</span>
8282 </div></div>
8383 <div class="module-body">
8484 <table class="tbl">
8585 <tbody>
8686 <tr><td style="width:170px"><strong>File present</strong></td><td>[if:$current_exists]<span class="pill pill-ok">yes</span>[/if][if:!$current_exists]<span class="pill pill-mute">no (new file)</span>[/if]</td></tr>
8787 <tr><td><strong>Size</strong></td><td class="mono dim">$current_size</td></tr>
8888 <tr><td><strong>Current SHA</strong></td><td class="mono">$current_sha</td></tr>
8989 <tr><td><strong>Same as captured?</strong></td><td>[if:$same_content]<span class="pill pill-ok">yes -- no-op</span>[/if][if:!$same_content]<span class="pill pill-warn">no -- restore will change it</span>[/if]</td></tr>
9090 </tbody>
9191 </table>
9292 <div style="margin-top:14px">
9393 <a href="$diff_url" class="tr-chip">See exactly what's different &rarr;</a>
9494 </div>
9595 </div>
96 </div>
97</div>
98
99[if:$has_recent_restores]
100<div class="module glow-warn" style="margin-top:16px">
101 <div class="module-head"><div class="left">
102 <div class="module-title">Recent restores of this file</div>
103 <span class="module-subtitle">This file has been restored before &mdash; check whether you want to duplicate that action or pick a different captured moment.</span>
104 </div></div>
105 <div class="module-body tight">
106 <table class="tbl">
107 <thead><tr>
108 <th style="width:100px">Status</th>
109 <th style="width:120px">Source SHA</th>
110 <th>By</th>
111 <th>Error</th>
112 <th style="width:150px">When</th>
113 </tr></thead>
114 <tbody>
115 [loop:@recent_restores_this]
116 <tr>
117 <td><span class="pill $status_pill">$status</span></td>
118 <td class="mono">$sha_short</td>
119 <td class="dim">$restored_by</td>
120 <td class="mono dim" style="font-size:11.5px">$err_short</td>
121 <td class="mono dim"><span class="ts" data-ts="$restored_epoch" data-fmt="relative">$restored_h</span></td>
122 </tr>
123 [/loop]
124 </tbody>
125 </table>
12696 </div>
12797</div>
128[/if]
12998
13099[if:$has_live_diff]
131100<div class="module glow-teal" style="margin-top:20px">
132101 <div class="module-head"><div class="left">
133102 <div class="module-icon"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2"><polyline points="8 3 4 7 8 11"/><polyline points="16 21 20 17 16 13"/><line x1="4" y1="7" x2="20" y2="7"/><line x1="4" y1="17" x2="20" y2="17"/></svg></div>
134103 <div class="module-title">What restore will change &mdash; live diff</div>
135104 <span class="module-subtitle">Left column shows current on-disk content; right shows what restore will write. <strong>+$diff_add</strong> additions, <strong>-$diff_del</strong> deletions, $diff_ctx unchanged context lines.</span>
136105 </div></div>
137106 <div class="module-body tight">
138107 <style>
139108 .rst-diff { width:100%; border-collapse:collapse; font-family:var(--mono); font-size:12px; line-height:1.5; }
140109 .rst-diff td { padding:1px 8px; vertical-align:top; white-space:pre-wrap; word-wrap:break-word; }
141110 .rst-diff .ln { color:var(--text-muted); text-align:right; width:44px; user-select:none; border-right:1px solid var(--border); font-size:11px; }
142111 .rst-diff tr.op-add td.text { background:rgba(52,211,153,.10); color:#a7f3d0; }
143112 .rst-diff tr.op-add td.text::before { content:'+'; color:var(--accent-ok); padding-right:6px; }
144113 .rst-diff tr.op-del td.text { background:rgba(244,63,94,.10); color:var(--accent-danger-hi); }
145114 .rst-diff tr.op-del td.text::before { content:'-'; color:var(--accent-danger); padding-right:6px; }
146115 .rst-diff tr.op-ctx td { color:var(--text-dim); }
147116 .rst-diff tr.op-ctx td.text::before { content:' '; padding-right:6px; }
148117 </style>
149118 <div style="max-height:50vh;overflow:auto">
150119 <table class="rst-diff">
151120 <tbody>
152121 [loop:@diff_lines]<tr class="op-$op"><td class="ln">$old_n</td><td class="ln">$new_n</td><td class="text">$text</td></tr>[/loop]
153122 </tbody>
154123 </table>
155124 </div>
156125 </div>
157126</div>
158127[/if]
159128
160129<div class="module glow-rose" style="margin-top:20px">
161130 <div class="module-head"><div class="left">
162131 <div class="module-title">Confirm restore</div>
163132 <span class="module-subtitle">Backs current content to <code>&lt;target&gt;.drift_restore_backup_&lt;epoch&gt;</code>, writes the captured content, verifies SHA post-write.</span>
164133 </div></div>
165134 <div class="module-body">
166135 <form method="post" action="/restore.cgi" style="display:flex;gap:12px;align-items:center">
167136 <input type="hidden" name="id" value="$id">
168137 <input type="hidden" name="confirm" value="1">
169138 <button type="submit" class="tr-chip is-active" style="border:none;padding:8px 22px;background:var(--accent-danger);border-color:var(--accent-danger);color:#fff">
170139 Yes, restore this file
171140 </button>
172141 <a href="/file_changes.cgi" class="tr-chip">Cancel</a>
173142 <span class="dim" style="margin-left:auto;font-size:12px">Logged to RESTORE_LOG regardless of outcome.</span>
174143 </form>
175144 </div>
176145</div>
177146[/if][/if]
Confirm restore
Backs current content to <target>.drift_restore_backup_<epoch>, writes the captured content, verifies SHA post-write.
Cancel Logged to RESTORE_LOG regardless of outcome.