fix(cloud): align UTC automatic backup schedule

go
codex 4 weeks ago
parent aea8d58944
commit dcdb33afff

@ -95,7 +95,7 @@ php xcat cloudRepairInstanceMetadata --apply
后台 `/admin/object-storage` 可配置一个全局 S3 兼容对象存储应用,适用于 AWS S3、MinIO 及实现 AWS Signature Version 4 的兼容服务。该功能复用业务库已有的 `configurations` 表,不需要导入新表。Endpoint 必须是带有效证书的 HTTPS origin;MinIO 通常选择路径寻址,AWS S3 通常选择虚拟主机寻址。
Access Key ID 与 Secret Access Key 只在超级管理员提交时进入 PHP,使用 `cloud_data_key` 的独立用途密钥密封后保存,读取页面不会回显。修改任一配置或停用应用都会清除原就绪标记;必须重新执行“验证连接并启用”。连接验证只发送签名的 `HeadBucket` 请求,需要目标 Bucket 的 `s3:ListBucket` 权限,不上传、覆盖或删除对象。管理员虚拟机管理已接入完整系统盘备份和新实例恢复,目标可以是原宿主机或其他合格宿主机;用户自动备份使用同一对象存储,在实例设置中按每天或每周调度并保留最多两份。运行账户还需要配置 `vm-backups/` 与 `vm-migrations/` 前缀范围内的 multipart 上传、`GetObject`、`HeadObject` 和 `DeleteObject` 权限。成功维护迁移会由普通任务 Worker 自动回收隐藏迁移传输包;版本控制 Bucket 仍须为 `vm-migrations/` 配置非当前版本过期策略。当前不包含增量链和管理员手工备份的自动保留策略,具体安全边界见 `docs/PORTABLE_VM_BACKUPS.md`。
Access Key ID 与 Secret Access Key 只在超级管理员提交时进入 PHP,使用 `cloud_data_key` 的独立用途密钥密封后保存,读取页面不会回显。修改任一配置或停用应用都会清除原就绪标记;必须重新执行“验证连接并启用”。连接验证只发送签名的 `HeadBucket` 请求,需要目标 Bucket 的 `s3:ListBucket` 权限,不上传、覆盖或删除对象。管理员虚拟机管理已接入完整系统盘备份和新实例恢复,目标可以是原宿主机或其他合格宿主机;用户自动备份使用同一对象存储,在实例设置中按每天或每周于 UTC 00:00 调度并保留最多两份。运行账户还需要配置 `vm-backups/` 与 `vm-migrations/` 前缀范围内的 multipart 上传、`GetObject`、`HeadObject` 和 `DeleteObject` 权限。成功维护迁移会由普通任务 Worker 自动回收隐藏迁移传输包;版本控制 Bucket 仍须为 `vm-migrations/` 配置非当前版本过期策略。当前不包含增量链和管理员手工备份的自动保留策略,具体安全边界见 `docs/PORTABLE_VM_BACKUPS.md`。
生产环境应为面板创建独立服务账户,把权限限制到配置的 Bucket 和备份前缀。数据库备份必须与原始 `cloud_data_key` 一起保管,重新生成主密钥无法恢复全局配置及各备份冻结的对象存储凭据。

@ -16,7 +16,7 @@
用户在部署时购买自动备份时,首个服务周期与实例账单一并结算。运行中的实例也可以在实例设置中开启:当前服务周期按剩余秒数向上取整计费,已经提前购买但尚未包含备份的后续服务周期按每期完整价格结算。余额扣款、已支付审计账单、订阅和每个服务周期的不可变权益记录在同一事务内完成;同一个幂等请求不会重复扣款。
调度只在订阅已开启且计划执行时间落入已支付权益时运行,并在创建备份的事务内再次核对。用户可以选择每天或每周在太平洋时间 00:00 执行,保留上限为两份。关闭会立即停止新自动备份并从下一张续费账单移除备份费用,不退还当前周期费用,也不删除当前已付权益或已有备份;同一已付周期重新开启不重复收费。续费成功后会为新服务周期写入独立权益,历史部署快照不作为当前计费授权。
调度只在订阅已开启且计划执行时间落入已支付权益时运行,并在创建备份的事务内再次核对。用户可以选择每天或每周在 UTC 00:00 执行,保留上限为两份。关闭会立即停止新自动备份并从下一张续费账单移除备份费用,不退还当前周期费用,也不删除当前已付权益或已有备份;同一已付周期重新开启不重复收费。续费成功后会为新服务周期写入独立权益,历史部署快照不作为当前计费授权。
用户只能在源实例的设置页把自动备份恢复到原实例;全局“云备份”页面可以从已有备份创建新实例。自动备份当前仍是完整系统盘对象,不是增量链。

@ -8,7 +8,7 @@ use App\Services\Config;
/** Initializes only the clean-break PHP business and Agent log schemas. */
final class CloudSetup
{
private const SCHEMA_VERSION = 'go-agent-wss-v8-backup-entitlements';
private const SCHEMA_VERSION = 'go-agent-wss-v9-backup-utc-schedule';
private const MAIN_TABLES = [
'cloud_regions', 'cloud_network_lines', 'cloud_resource_pools',
'cloud_hosts', 'cloud_host_agents',

@ -12,7 +12,7 @@ use App\Models\CloudOffer;
/** Owner-facing paid automatic-backup policy and bounded scheduler. */
final class CloudAutomaticBackupService
{
public const TIMEZONE = 'America/Los_Angeles';
public const TIMEZONE = 'UTC';
public const RUN_AT = '00:00';
public const MAX_RETENTION = 2;
@ -379,7 +379,7 @@ final class CloudAutomaticBackupService
return $removed;
}
/** First Pacific midnight strictly after $after. Weekday uses PHP w: 0=Sunday. */
/** First UTC midnight strictly after $after. Weekday uses PHP w: 0=Sunday. */
public static function nextRunAt(int $after, string $frequency,
int $weekday): int
{

@ -1571,7 +1571,7 @@ function renderAutomaticBackupList(vmId, items, allowed) {
const title = document.createElement('strong');
const detail = document.createElement('span');
title.textContent = '还没有可用备份';
detail.textContent = '计划启用后,系统会在 PT 00:00 自动执行。';
detail.textContent = '计划启用后,系统会在 UTC 00:00 自动执行。';
empty.append(title, detail);
list.append(empty);
return;

@ -291,5 +291,5 @@ body.vu-body .ssh-key-picker-manage:hover {
.vm-state-sync{display:block;margin-top:4px;color:#8b9aaa;font-size:10px;line-height:1.35;white-space:nowrap}.vm-state-sync.stale{color:#b98129}.vm-state-sync.offline{color:#bd5b63}.vm-detail-state-stack{display:flex;flex-direction:column;align-items:flex-end;gap:3px}.vm-detail-state-stack .vm-state-sync{margin-top:0}
.vm-ip-change-facts{display:grid;grid-template-columns:1fr;gap:1px;margin:0 0 24px;padding:1px;background:#e5ecef}.vm-ip-change-facts>div{min-width:0;padding:14px 16px;background:#fff}.vm-ip-change-facts dt{margin-bottom:5px;color:#8796a4;font-size:10px}.vm-ip-change-facts dd{margin:0;color:#294257;font:700 12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;overflow-wrap:anywhere}@media screen and (max-width:510px){.vm-ip-change-facts>div{padding:11px 13px}}
.vm-upgrade-section{max-width:880px}.vm-upgrade-current-card{margin:0 0 25px;padding:18px;border:1px solid #e1e9ed;border-radius:10px;background:#fbfcfd}.vm-upgrade-current-card h4,.vm-upgrade-picker-heading h4{margin:0;color:#314a5f;font-size:13px}.vm-upgrade-spec-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1px;margin:14px 0 0;padding:1px;background:#e3eaee}.vm-upgrade-spec-grid>div{min-width:0;padding:11px 13px;background:#fff}.vm-upgrade-spec-grid dt{margin-bottom:4px;color:#8797a5;font-size:9px}.vm-upgrade-spec-grid dd{margin:0;color:#294257;font-size:11px;font-weight:800;overflow-wrap:anywhere}.vm-upgrade-picker-heading{display:flex;align-items:baseline;justify-content:space-between;gap:15px;margin-bottom:11px}.vm-upgrade-picker-heading span{color:#8a99a7;font-size:10px}.vm-upgrade-offers{display:grid;gap:10px;margin:0 0 22px}.vm-upgrade-offer{position:relative;display:grid;width:100%;gap:14px;padding:16px 18px;border:1px solid #dce7ec;border-radius:10px;background:#fff;color:#50677a;text-align:left;cursor:pointer}.vm-upgrade-offer:hover:not(:disabled){border-color:#8ecdd2;background:#f8fcfc}.vm-upgrade-offer:focus-visible{outline:3px solid rgba(18,166,176,.22);outline-offset:2px}.vm-upgrade-offer[aria-checked=true]{border-color:#2eabb4;background:#eef9fa;box-shadow:inset 0 0 0 1px #2eabb4}.vm-upgrade-offer[aria-checked=true]::after{content:"✓";position:absolute;top:10px;right:10px;display:grid;place-items:center;width:21px;height:21px;border-radius:50%;background:#18a6b0;color:#fff;font-size:12px;font-weight:900}.vm-upgrade-offer:disabled{cursor:not-allowed;opacity:.66}.vm-upgrade-offer-heading{display:flex;align-items:center;justify-content:space-between;gap:35px;padding-right:21px}.vm-upgrade-offer-name{min-width:0;color:#293f53;font-size:13px;overflow-wrap:anywhere}.vm-upgrade-offer-price{flex:none;color:#0d929d;font-size:13px}.vm-upgrade-offer-facts{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}.vm-upgrade-offer-fact{display:grid;min-width:0;gap:3px}.vm-upgrade-offer-fact small{color:#8a99a7;font-size:9px}.vm-upgrade-offer-fact b{color:#445d70;font-size:10px;overflow-wrap:anywhere}.vm-upgrade-empty{margin:0;padding:24px;border:1px dashed #d7e1e6;border-radius:10px;color:#8494a2;font-size:11px;text-align:center}@media screen and (max-width:510px){.vm-upgrade-current-card{padding:14px}.vm-upgrade-spec-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.vm-upgrade-picker-heading{align-items:flex-start;flex-direction:column;gap:4px}.vm-upgrade-offer{gap:13px;padding:15px}.vm-upgrade-offer-heading{align-items:flex-start;flex-direction:column;gap:5px;padding-right:27px}.vm-upgrade-offer-facts{grid-template-columns:repeat(2,minmax(0,1fr));gap:11px 8px}.vm-upgrade-offer-fact:last-child{grid-column:1/-1}.vm-upgrade-offer-price{font-size:12px}}
.vm-automatic-backup-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:17px}.vm-automatic-backup-list-heading{display:flex;align-items:center;justify-content:space-between;gap:15px;margin:32px 0 12px;padding-top:24px;border-top:1px solid #e6ecef}.vm-automatic-backup-list-heading h4{margin:0 0 4px;color:#354c60;font-size:14px}.vm-automatic-backup-list-heading small{color:#8797a5;font-size:10px}.vm-automatic-backup-list{display:grid;gap:10px}.vm-automatic-backup-card{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:13px 18px;padding:15px;border:1px solid #dfe8ed;border-radius:9px;background:#fbfdfd}.vm-automatic-backup-card-main{display:grid;gap:5px;min-width:0}.vm-automatic-backup-card-main strong{color:#31495d;font-size:12px;overflow-wrap:anywhere}.vm-automatic-backup-card-main small{color:#8192a1;font-size:10px;line-height:1.55}.vm-automatic-backup-card-status{align-self:start}.vm-automatic-backup-card-actions{grid-column:1/-1;display:flex;justify-content:flex-end}.vm-automatic-backup-empty{display:grid;gap:5px;padding:25px 17px;border:1px dashed #cedce2;border-radius:9px;color:#8797a5;text-align:center}.vm-automatic-backup-empty strong{color:#506779;font-size:12px}.vm-automatic-backup-empty span{font-size:10px}@media screen and (max-width:740px){.vm-automatic-backup-grid{grid-template-columns:1fr}}@media screen and (max-width:510px){.vm-automatic-backup-list-heading{align-items:flex-start;flex-direction:column}.vm-automatic-backup-list-heading .button{width:100%}.vm-automatic-backup-card{grid-template-columns:1fr}.vm-automatic-backup-card-status,.vm-automatic-backup-card-actions{grid-column:1}.vm-automatic-backup-card-actions .button{width:100%}}
.vm-automatic-backup-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:17px}.vm-automatic-backup-grid>.vm-settings-field{align-content:start}.vm-automatic-backup-list-heading{display:flex;align-items:center;justify-content:space-between;gap:15px;margin:32px 0 12px;padding-top:24px;border-top:1px solid #e6ecef}.vm-automatic-backup-list-heading h4{margin:0 0 4px;color:#354c60;font-size:14px}.vm-automatic-backup-list-heading small{color:#8797a5;font-size:10px}.vm-automatic-backup-list{display:grid;gap:10px}.vm-automatic-backup-card{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:13px 18px;padding:15px;border:1px solid #dfe8ed;border-radius:9px;background:#fbfdfd}.vm-automatic-backup-card-main{display:grid;gap:5px;min-width:0}.vm-automatic-backup-card-main strong{color:#31495d;font-size:12px;overflow-wrap:anywhere}.vm-automatic-backup-card-main small{color:#8192a1;font-size:10px;line-height:1.55}.vm-automatic-backup-card-status{align-self:start}.vm-automatic-backup-card-actions{grid-column:1/-1;display:flex;justify-content:flex-end}.vm-automatic-backup-empty{display:grid;gap:5px;padding:25px 17px;border:1px dashed #cedce2;border-radius:9px;color:#8797a5;text-align:center}.vm-automatic-backup-empty strong{color:#506779;font-size:12px}.vm-automatic-backup-empty span{font-size:10px}@media screen and (max-width:740px){.vm-automatic-backup-grid{grid-template-columns:1fr}}@media screen and (max-width:510px){.vm-automatic-backup-list-heading{align-items:flex-start;flex-direction:column}.vm-automatic-backup-list-heading .button{width:100%}.vm-automatic-backup-card{grid-template-columns:1fr}.vm-automatic-backup-card-status,.vm-automatic-backup-card-actions{grid-column:1}.vm-automatic-backup-card-actions .button{width:100%}}
.vm-automatic-backup-service{display:grid;gap:15px;margin:0 0 24px;padding:18px;border:1px solid #dce7ec;border-radius:11px;background:#fbfdfd}.vm-automatic-backup-service-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:18px}.vm-automatic-backup-service-heading h4{margin:4px 0 0;color:#30495d;font-size:14px}.vm-automatic-backup-service-prices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1px;padding:1px;background:#e2eaed}.vm-automatic-backup-service-prices>div{display:grid;min-width:0;gap:5px;padding:14px;background:#fff}.vm-automatic-backup-service-prices span{color:#7c8e9e;font-size:10px}.vm-automatic-backup-service-prices strong{color:#263f54;font-size:14px;overflow-wrap:anywhere}.vm-automatic-backup-service-prices small{color:#8999a6;font-size:9px;line-height:1.55}.vm-automatic-backup-service-note{margin:0;color:#64798b;font-size:10px;line-height:1.7}.vm-automatic-backup-service-actions{display:flex;justify-content:flex-end;gap:10px}.vm-automatic-backup-service-actions .button{min-width:138px}@media screen and (max-width:740px){.vm-automatic-backup-service-prices{grid-template-columns:1fr}.vm-automatic-backup-service-actions{flex-direction:column}.vm-automatic-backup-service-actions .button{width:100%}}

@ -156,7 +156,7 @@
</section>
<section id="vm-settings-section-automatic-backup" class="vm-settings-section vm-automatic-backup-section" role="tabpanel" aria-labelledby="vm-settings-nav-automatic-backup" data-instance-setting-panel="automatic_backup" hidden>
<header class="vm-settings-section-heading"><span class="eyebrow">AUTOMATIC BACKUP</span><h3>自动备份</h3><p>管理这台实例的自动备份计划,并选择已有备份恢复当前实例。</p></header>
<div class="vm-settings-notice"><strong>固定执行时间</strong><span>自动任务统一在 PT 00:00 执行;系统使用 America/Los_Angeles 时区并自动处理夏令时。</span></div>
<div class="vm-settings-notice"><strong>固定执行时间</strong><span>自动任务统一在 UTC 00:00 执行;固定使用协调世界时,不受夏令时影响。</span></div>
<div class="vm-settings-notice warning"><strong>恢复会覆盖当前系统盘</strong><span>恢复当前实例必须在这里操作。恢复期间实例会停止,系统盘将回到所选备份的内容;账单、服务周期和公网 IP 不会回滚。</span></div>
<p id="vm-automatic-backup-status" class="vm-settings-status" role="status" aria-live="polite">打开本栏目后加载。</p>
<section id="vm-automatic-backup-service" class="vm-automatic-backup-service" aria-labelledby="vm-automatic-backup-service-title">
@ -171,9 +171,9 @@
</section>
<form id="vm-automatic-backup-form" class="vm-settings-form" novalidate>
<div class="vm-automatic-backup-grid">
<div class="vm-settings-field"><label for="vm-automatic-backup-frequency">备份频率(PT 00:00)</label><select id="vm-automatic-backup-frequency" name="frequency" disabled><option value="daily" selected>每天</option><option value="weekly">每周</option></select></div>
<div class="vm-settings-field"><label for="vm-automatic-backup-frequency">备份频率</label><select id="vm-automatic-backup-frequency" name="frequency" disabled><option value="daily" selected>每天(UTC 00:00)</option><option value="weekly">每周(UTC 00:00)</option></select></div>
<div id="vm-automatic-backup-weekday-field" class="vm-settings-field" hidden><label for="vm-automatic-backup-weekday">每周执行日</label><select id="vm-automatic-backup-weekday" name="weekday" disabled><option value="0" selected>星期日</option><option value="1">星期一</option><option value="2">星期二</option><option value="3">星期三</option><option value="4">星期四</option><option value="5">星期五</option><option value="6">星期六</option></select></div>
<div class="vm-settings-field"><label for="vm-automatic-backup-retention">保留份数</label><select id="vm-automatic-backup-retention" name="retention_count" disabled><option value="1">保留 1 份</option><option value="2" selected>保留 2 份</option></select><small>最多保留 2 份;超过数量后自动删除最早的一份。</small></div>
<div class="vm-settings-field"><label for="vm-automatic-backup-retention">保留份数</label><select id="vm-automatic-backup-retention" name="retention_count" disabled><option value="1">保留 1 份</option><option value="2" selected>保留 2 份</option></select><small>最多保留 2 份;新备份创建成功后,系统会自动删除最早的一份。</small></div>
</div>
<div class="vm-settings-actions"><button id="vm-automatic-backup-save" class="button button-primary" type="submit" disabled>保存备份计划</button></div>
<p id="vm-automatic-backup-error" class="form-error" role="alert" hidden></p>

@ -1,2 +1,2 @@
{* Shared Venix CSS/JS cache key. Increment whenever a shared browser asset changes. *}
{assign var=venix_asset_version value='2026102604' scope='global'}
{assign var=venix_asset_version value='2026102605' scope='global'}

@ -530,7 +530,7 @@ CREATE TABLE cloud_backup_subscriptions (
frequency VARCHAR(8) CHARACTER SET ascii COLLATE ascii_bin NOT NULL DEFAULT 'daily',
weekday TINYINT UNSIGNED NOT NULL DEFAULT 0,
retention_count TINYINT UNSIGNED NOT NULL DEFAULT 2,
timezone VARCHAR(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL DEFAULT 'America/Los_Angeles',
timezone VARCHAR(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL DEFAULT 'UTC',
price DECIMAL(12,2) NOT NULL DEFAULT 0.00,
currency CHAR(3) CHARACTER SET ascii COLLATE ascii_bin NOT NULL DEFAULT 'USD',
price_version INT UNSIGNED NOT NULL,

@ -10,26 +10,25 @@ $assert = static function (bool $condition, string $message): void {
}
};
// America/Los_Angeles changes from PST to PDT between these two local
// midnights. The UTC interval is 23 hours, while the user-facing run time
// remains exactly 00:00 Pacific.
$beforeDst = strtotime('2026-03-08T07:30:00Z');
// UTC midnight never moves with daylight-saving transitions.
$beforeDst = strtotime('2026-03-08T23:30:00Z');
$first = CloudAutomaticBackupService::nextRunAt($beforeDst, 'daily', 0);
$second = CloudAutomaticBackupService::nextRunAt($first, 'daily', 0);
$assert(gmdate('Y-m-d H:i:s', $first) === '2026-03-08 08:00:00'
&& gmdate('Y-m-d H:i:s', $second) === '2026-03-09 07:00:00'
&& $second - $first === 23 * 3600,
'Pacific midnight drifted across the spring daylight-saving transition.');
$assert(CloudAutomaticBackupService::TIMEZONE === 'UTC'
&& gmdate('Y-m-d H:i:s', $first) === '2026-03-09 00:00:00'
&& gmdate('Y-m-d H:i:s', $second) === '2026-03-10 00:00:00'
&& $second - $first === 24 * 3600,
'Automatic backup schedule did not remain fixed at UTC midnight.');
$weekly = CloudAutomaticBackupService::nextRunAt(
strtotime('2026-10-24T19:00:00Z'), 'weekly', 1
);
$local = (new DateTimeImmutable('@' . $weekly))->setTimezone(
$utc = (new DateTimeImmutable('@' . $weekly))->setTimezone(
new DateTimeZone(CloudAutomaticBackupService::TIMEZONE)
);
$assert($local->format('w H:i') === '1 00:00'
&& $local->format('Ymd-His') === '20261026-000000',
'Weekly schedule or its deterministic Pacific-midnight name timestamp drifted.');
$assert($utc->format('w H:i') === '1 00:00'
&& $utc->format('Ymd-His') === '20261026-000000',
'Weekly schedule or its deterministic UTC-midnight name timestamp drifted.');
$routes = file_get_contents(dirname(__DIR__) . '/config/routes_cloud.php');
$controller = file_get_contents(
@ -76,4 +75,4 @@ $assert(str_contains($backupService, '$name = \'autobackup-\'')
&& !str_contains($backupService, '$name = \'automatic-\''),
'Scheduled backup names must use the autobackup prefix.');
echo "Automatic backup Pacific schedule and route contract passed.\n";
echo "Automatic backup UTC schedule and route contract passed.\n";

@ -121,7 +121,7 @@ $assert($subscription !== null
&& (bool) $subscription->renew_next_period
&& (string) $subscription->frequency === 'daily'
&& (int) $subscription->retention_count === 2
&& (string) $subscription->timezone === 'America/Los_Angeles'
&& (string) $subscription->timezone === 'UTC'
&& (string) $subscription->price === '2.50',
'Paid provisioning did not freeze the default backup subscription.');

@ -156,7 +156,7 @@ namespace {
$table->string('frequency')->default('daily');
$table->integer('weekday')->default(0);
$table->integer('retention_count')->default(2);
$table->string('timezone')->default('America/Los_Angeles');
$table->string('timezone')->default('UTC');
$table->string('price');
$table->string('currency');
$table->integer('price_version')->default(1);

@ -323,7 +323,7 @@ namespace {
$schema->create('cloud_service_periods', function (Blueprint $t) { $t->increments('id'); foreach (['instance_id', 'user_id'] as $v) { $t->integer($v); } foreach (['plan_id', 'order_id', 'renewal_id', 'download_base_bytes', 'upload_base_bytes', 'activated_at'] as $v) { $t->integer($v)->nullable(); } foreach (['starts_at', 'ends_at', 'traffic_quota_bytes', 'download_used_bytes', 'upload_used_bytes', 'created_at', 'updated_at'] as $v) { $t->integer($v)->default(0); } $t->string('status'); $t->unique('order_id'); $t->unique('renewal_id'); });
$schema->create('cloud_invoices', function (Blueprint $t) { $t->increments('id'); $t->string('invoice_no')->unique(); $t->string('purpose')->default('renewal'); $t->integer('instance_id')->nullable(); $t->integer('order_id')->nullable()->unique(); $t->integer('user_id'); $t->integer('plan_id')->nullable(); $t->integer('offer_id')->nullable(); $t->integer('renewal_id')->nullable(); $t->integer('renews_expires_at')->nullable(); $t->integer('due_at'); $t->string('amount'); $t->string('currency')->default('USD'); $t->integer('validity_days'); $t->integer('traffic_quota_bytes'); $t->string('status'); $t->string('paid_via')->nullable(); $t->string('payment_reference')->nullable(); $t->integer('paid_at')->nullable(); $t->integer('created_at'); $t->integer('updated_at'); });
$schema->create('cloud_invoice_items', function (Blueprint $t) { $t->increments('id'); $t->integer('invoice_id'); $t->integer('order_item_id')->nullable(); $t->string('code'); $t->string('label'); $t->string('amount'); $t->string('currency')->default('USD'); $t->text('snapshot_json'); $t->integer('created_at'); $t->unique(['invoice_id', 'code']); });
$schema->create('cloud_backup_subscriptions', function (Blueprint $t) { $t->increments('id'); $t->integer('instance_id')->unique(); $t->integer('user_id'); $t->integer('offer_id'); $t->boolean('enabled')->default(true); $t->boolean('renew_next_period')->default(true); $t->string('frequency')->default('daily'); $t->integer('weekday')->default(0); $t->integer('retention_count')->default(2); $t->string('timezone')->default('America/Los_Angeles'); $t->string('price'); $t->string('currency')->default('USD'); $t->integer('price_version'); $t->integer('next_run_at'); $t->integer('last_scheduled_at')->nullable(); $t->integer('last_backup_id')->nullable(); $t->integer('created_at'); $t->integer('updated_at'); });
$schema->create('cloud_backup_subscriptions', function (Blueprint $t) { $t->increments('id'); $t->integer('instance_id')->unique(); $t->integer('user_id'); $t->integer('offer_id'); $t->boolean('enabled')->default(true); $t->boolean('renew_next_period')->default(true); $t->string('frequency')->default('daily'); $t->integer('weekday')->default(0); $t->integer('retention_count')->default(2); $t->string('timezone')->default('UTC'); $t->string('price'); $t->string('currency')->default('USD'); $t->integer('price_version'); $t->integer('next_run_at'); $t->integer('last_scheduled_at')->nullable(); $t->integer('last_backup_id')->nullable(); $t->integer('created_at'); $t->integer('updated_at'); });
$schema->create('cloud_backup_period_entitlements', function (Blueprint $t) { $t->increments('id'); $t->integer('subscription_id'); $t->integer('instance_id'); $t->integer('service_period_id')->unique(); $t->integer('user_id'); $t->integer('offer_id'); $t->integer('invoice_id'); $t->integer('starts_at'); $t->integer('ends_at'); $t->string('amount'); $t->string('full_period_price'); $t->string('currency')->default('USD'); $t->integer('price_version'); $t->string('source'); $t->integer('paid_at'); $t->integer('created_at'); $t->integer('updated_at'); });
$schema->create('cloud_invoice_payments', function (Blueprint $t) { $t->increments('id'); $t->integer('invoice_id'); $t->integer('user_id'); $t->string('provider'); $t->string('provider_order_no'); $t->string('idempotency_key'); $t->string('amount'); $t->string('status'); $t->integer('created_at'); $t->integer('updated_at'); $t->unique(['provider', 'provider_order_no']); $t->unique(['user_id', 'idempotency_key']); });
$schema->create('cloud_mail_outbox', function (Blueprint $t) { $t->increments('id'); $t->integer('invoice_id'); $t->string('kind'); $t->string('status'); $t->integer('attempts'); $t->integer('available_at'); $t->string('lease_token')->nullable(); $t->integer('lease_until'); $t->integer('sent_at')->nullable(); $t->string('last_error'); $t->integer('created_at'); $t->integer('updated_at'); $t->unique(['invoice_id', 'kind']); });
@ -853,7 +853,7 @@ namespace {
$subscription->frequency = 'daily';
$subscription->weekday = 0;
$subscription->retention_count = 2;
$subscription->timezone = 'America/Los_Angeles';
$subscription->timezone = 'UTC';
$subscription->price = '2.50';
$subscription->currency = 'USD';
$subscription->price_version = 1;
@ -1845,7 +1845,7 @@ namespace {
'frequency' => 'daily',
'weekday' => 0,
'retention_count' => 2,
'timezone' => 'America/Los_Angeles',
'timezone' => 'UTC',
'price' => '2.50',
'currency' => 'USD',
'price_version' => 1,

@ -22,9 +22,13 @@ $assert(stripos($schema, 'compatibility import') === false
$assert(!preg_match('/\bengine_[A-Za-z0-9_]*\b/', $schema),
'cloud.sql retained an engine-prefixed identifier.');
$assert(str_contains($setup,
"SCHEMA_VERSION = 'go-agent-wss-v8-backup-entitlements'")
"SCHEMA_VERSION = 'go-agent-wss-v9-backup-utc-schedule'")
&& !str_contains($setup, "SCHEMA_VERSION = 'go-v1'"),
'Outbound Agent schema must reject the incompatible earlier Go database.');
$assert(str_contains($schema,
"timezone VARCHAR(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL DEFAULT 'UTC'")
&& !str_contains($schema, 'America/Los_Angeles'),
'Fresh automatic-backup subscriptions must default to UTC.');
foreach (['cloud_host_agents', 'cloud_templates', 'cloud_hosts', 'cloud_instances',
'cloud_orders', 'cloud_invoices', 'cloud_jobs',

@ -208,7 +208,7 @@ namespace {
$table->string('frequency')->default('daily');
$table->integer('weekday')->default(0);
$table->integer('retention_count')->default(2);
$table->string('timezone')->default('America/Los_Angeles');
$table->string('timezone')->default('UTC');
$table->string('price');
$table->string('currency')->default('USD');
$table->integer('price_version');
@ -773,7 +773,7 @@ namespace {
'instance_id' => $applied['instanceId'], 'user_id' => 1,
'offer_id' => $applied['sourceOfferId'], 'enabled' => 0,
'renew_next_period' => 1, 'frequency' => 'daily', 'weekday' => 0,
'retention_count' => 2, 'timezone' => 'America/Los_Angeles',
'retention_count' => 2, 'timezone' => 'UTC',
'price' => '2.00', 'currency' => 'USD', 'price_version' => 1,
'next_run_at' => $now + 86400, 'last_scheduled_at' => null,
'last_backup_id' => null, 'created_at' => $now,

@ -47,20 +47,21 @@ $assert(str_contains($detail, 'data-instance-setting-tab="automatic_backup"')
&& str_contains($detail, 'id="vm-automatic-backup-enable"')
&& str_contains($detail, 'id="vm-automatic-backup-disable"')
&& str_contains($detail, 'id="vm-automatic-backup-frequency"')
&& str_contains($detail, '备份频率(PT 00:00)')
&& str_contains($detail, '<option value="daily" selected>每天</option>')
&& str_contains($detail, '<option value="weekly">每周</option>')
&& str_contains($detail, '<label for="vm-automatic-backup-frequency">备份频率</label>')
&& str_contains($detail, '<option value="daily" selected>每天(UTC 00:00)</option>')
&& str_contains($detail, '<option value="weekly">每周(UTC 00:00)</option>')
&& str_contains($detail, 'id="vm-automatic-backup-retention"')
&& str_contains($detail, '<option value="2" selected>保留 2 份</option>')
&& str_contains($detail, '最多保留 2 份;新备份创建成功后,系统会自动删除最早的一份。')
&& !str_contains($detail, '>执行时间<')
&& !str_contains($detail, '太平洋时间 00:00')
&& str_contains($detail, 'America/Los_Angeles'),
'Instance settings must place the abbreviated Pacific execution time beside the frequency and remove the standalone time field.');
&& !str_contains($detail, 'PT 00:00')
&& !str_contains($detail, 'America/Los_Angeles'),
'Instance settings must place UTC time in both frequency options and align the schedule fields.');
$assert(str_contains($detailScript,
'系统会在 PT 00:00 自动执行。')
'系统会在 UTC 00:00 自动执行。')
&& !str_contains($detailScript,
'系统会在太平洋时间 00:00 自动执行。'),
'Automatic-backup runtime copy must use the same abbreviated Pacific time.');
'系统会在 PT 00:00 自动执行。'),
'Automatic-backup runtime copy must use UTC.');
$assert(str_contains($detailScript,
"`/api/v1/vms/\${encodeURIComponent(vmId)}/automatic-backup`")
&& str_contains($detailScript,
@ -91,6 +92,8 @@ $assert(str_contains($sidebar, 'href="/user/cloud/backups"')
'The global backup library must create new instances or link to instance settings, never restore the source directly.');
$assert(str_contains($styles, '.cloud-backups-list')
&& str_contains($styles, '.vm-automatic-backup-grid')
&& str_contains($styles,
'.vm-automatic-backup-grid>.vm-settings-field{align-content:start}')
&& !str_contains($styles, '.vm-automatic-backup-field-label')
&& !str_contains($styles, '.vm-automatic-backup-fixed-time')
&& str_contains($styles, '.vm-automatic-backup-service')

@ -73,7 +73,7 @@ $assert(str_contains($auth, "Config::get('tos_reg') === 'true'")
'Legal consent is only client-side and can be bypassed.');
$assets = $read('web/resources/views/venix/layout_assets.tpl');
$assert(str_contains($assets, "value='2026102604'")
$assert(str_contains($assets, "value='2026102605'")
&& str_contains($admin, '?v={$venix_asset_version}')
&& str_contains($read('web/resources/views/venix/home/layout_header.tpl'), '?v={$venix_asset_version}'),
'Shared browser asset version was not coupled to the new assets.');

@ -80,7 +80,7 @@ $assert(preg_match('/\.landing-site-header\s*\{[^}]*position:\s*fixed;/s', $css)
&& str_contains($accountCss, 'padding-top: 88px;')
&& str_contains($accountCss, 'padding-top: 76px;'),
'Persistent desktop or mobile public-navigation styling is incomplete.');
$assert(str_contains($read('web/resources/views/venix/layout_assets.tpl'), "value='2026102604'"),
$assert(str_contains($read('web/resources/views/venix/layout_assets.tpl'), "value='2026102605'"),
'The shared browser asset version was not advanced with the navigation styles.');
echo "Public page locale and shared-layout contract tests passed.\n";

@ -69,7 +69,7 @@ foreach ($templates as $template) {
}
$assets = $read('web/resources/views/venix/layout_assets.tpl');
$assert(str_contains($assets, "value='2026102604'"),
$assert(str_contains($assets, "value='2026102605'"),
'The shared asset version was not updated for the canonical logo.');
echo "Shared site-brand contract passed across public, auth, user, cloud and admin layouts.\n";

Loading…
Cancel
Save