Diff -- /var/www/vhosts/webstls.com/httpdocs/_clone.pl
Diff
/var/www/vhosts/webstls.com/httpdocs/_clone.pl
added on WebSTLs (webstls.com) at 2026-07-01 22:27:11
Added
+40
lines
Removed
-0
lines
Context
0
unchanged
Blobs
from
to 15a5e80be7bc
to 15a5e80be7bc
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.| 1 | #!/usr/bin/perl | |
| 2 | # Clone admin_earnings.cgi to WebSTLs (separate VPS). | |
| 3 | use strict; use warnings; | |
| 4 | ||
| 5 | # Read from a known-good source (TaskForge copy uploaded for this run) | |
| 6 | open my $fh, '<:raw', '/var/www/vhosts/webstls.com/httpdocs/_admin_earnings_src.cgi' or die $!; | |
| 7 | my $src = do { local $/; <$fh> }; close $fh; | |
| 8 | $src =~ s/^\xEF\xBB\xBF//; | |
| 9 | $src =~ s/MODS::TaskForge::/MODS::WebSTLs::/g; | |
| 10 | $src =~ s{/var/www/vhosts/3dshawn\.com/taskforge\.3dshawn\.com}{/var/www/vhosts/webstls.com/httpdocs}g; | |
| 11 | ||
| 12 | my $dst = '/var/www/vhosts/webstls.com/httpdocs/admin_earnings.cgi'; | |
| 13 | open my $oh, '>:raw', $dst or die $!; | |
| 14 | print $oh $src; close $oh; | |
| 15 | chmod 0755, $dst; | |
| 16 | `chown stlsweb:psacln $dst`; | |
| 17 | print "wrote $dst (${\ length($src) } bytes)\n"; | |
| 18 | my $c = `perl -c $dst 2>&1 | tail -1`; | |
| 19 | print $c; | |
| 20 | ||
| 21 | # Patch the WebSTLs Wrapper.pm | |
| 22 | my $wf = '/var/www/vhosts/webstls.com/httpdocs/MODS/WebSTLs/Wrapper.pm'; | |
| 23 | if (-f $wf) { | |
| 24 | open my $wfh, '<:raw', $wf or die $!; | |
| 25 | my $wsrc = do { local $/; <$wfh> }; close $wfh; | |
| 26 | $wsrc =~ s/^\xEF\xBB\xBF//; | |
| 27 | unless ($wsrc =~ /admin_earnings/) { | |
| 28 | my $entry = q[ { key => 'admin_earnings', label => 'Earnings & Expenses', href => '/admin_earnings.cgi', icon => 'billing', super_admin_only => 1, tip => 'Revenue from paid invoices + manual expense ledger.' },] . "\n"; | |
| 29 | if ($wsrc =~ s{(\{\s*section\s*=>\s*['"]Admin['"][^\n]*\n)}{$1$entry}) { | |
| 30 | open my $woh, '>:raw', $wf or die $!; | |
| 31 | print $woh $wsrc; close $woh; | |
| 32 | `chown stlsweb:psacln $wf`; | |
| 33 | print "wrapper patched\n"; | |
| 34 | } else { | |
| 35 | print "wrapper anchor not found\n"; | |
| 36 | } | |
| 37 | } else { | |
| 38 | print "wrapper already patched\n"; | |
| 39 | } | |
| 40 | } |