refactor: move private seo artifacts into storage
This commit is contained in:
@@ -10,7 +10,7 @@ class DomainExternalSeoManualImportHelper
|
||||
{
|
||||
public static function defaultRoot(string $strCodeRoot): string
|
||||
{
|
||||
return rtrim($strCodeRoot, '/') . '/public/_admin_templates/domain-seo-external/manual-import';
|
||||
return rtrim($strCodeRoot, '/') . '/storage/external-seo/manual-import';
|
||||
}
|
||||
|
||||
public static function getHeaders(): array
|
||||
|
||||
@@ -6,12 +6,12 @@ namespace app\common\helper;
|
||||
|
||||
class DomainExternalSeoManualImportRunIndexHelper
|
||||
{
|
||||
protected static function publicRelativePath(string $strPath): string
|
||||
protected static function storageRelativePath(string $strPath): string
|
||||
{
|
||||
$strPublicRoot = str_replace('\\', '/', rtrim(dirname(__DIR__, 3) . '/public', '/'));
|
||||
$strStorageRoot = str_replace('\\', '/', rtrim(dirname(__DIR__, 3) . '/storage', '/'));
|
||||
$strPath = str_replace('\\', '/', $strPath);
|
||||
if (str_starts_with($strPath, $strPublicRoot . '/')) {
|
||||
return substr($strPath, strlen($strPublicRoot . '/'));
|
||||
if (str_starts_with($strPath, $strStorageRoot . '/')) {
|
||||
return substr($strPath, strlen($strStorageRoot . '/'));
|
||||
}
|
||||
|
||||
return $strPath;
|
||||
@@ -47,16 +47,16 @@ class DomainExternalSeoManualImportRunIndexHelper
|
||||
|
||||
$arrItems[] = [
|
||||
'run_id' => basename($strRunRoot),
|
||||
'run_root_public' => self::publicRelativePath($strRunRoot),
|
||||
'run_root_public' => self::storageRelativePath($strRunRoot),
|
||||
'status' => (string)($arrSummary['status'] ?? 'empty'),
|
||||
'provider_key' => (string)($arrSummary['provider_key'] ?? 'manual_csv_import'),
|
||||
'rows_total' => self::countCsvRows($strCsvPath),
|
||||
'hosts_count' => self::countCsvHosts($strCsvPath),
|
||||
'metrics' => (array)($arrSummary['metrics'] ?? []),
|
||||
'uploaded_report_path' => $strUploadedPath !== '' ? self::publicRelativePath($strUploadedPath) : '',
|
||||
'csv_path' => is_file($strCsvPath) ? self::publicRelativePath($strCsvPath) : '',
|
||||
'summary_json_path' => self::publicRelativePath($strSummaryPath),
|
||||
'summary_html_path' => is_file($strRunRoot . '/seo-external-real.summary.html') ? self::publicRelativePath($strRunRoot . '/seo-external-real.summary.html') : '',
|
||||
'uploaded_report_path' => $strUploadedPath !== '' ? self::storageRelativePath($strUploadedPath) : '',
|
||||
'csv_path' => is_file($strCsvPath) ? self::storageRelativePath($strCsvPath) : '',
|
||||
'summary_json_path' => self::storageRelativePath($strSummaryPath),
|
||||
'summary_html_path' => is_file($strRunRoot . '/seo-external-real.summary.html') ? self::storageRelativePath($strRunRoot . '/seo-external-real.summary.html') : '',
|
||||
'updated_at' => date(DATE_ATOM, (int)(filemtime($strSummaryPath) ?: time())),
|
||||
];
|
||||
}
|
||||
@@ -69,16 +69,16 @@ class DomainExternalSeoManualImportRunIndexHelper
|
||||
$arrSummary = is_array($arrDecoded) ? $arrDecoded : [];
|
||||
array_unshift($arrItems, [
|
||||
'run_id' => 'latest_manual_import',
|
||||
'run_root_public' => self::publicRelativePath($strLatestDir),
|
||||
'run_root_public' => self::storageRelativePath($strLatestDir),
|
||||
'status' => (string)($arrSummary['status'] ?? 'empty'),
|
||||
'provider_key' => (string)($arrSummary['provider_key'] ?? 'manual_csv_import'),
|
||||
'rows_total' => self::countCsvRows($strLatestDir . '/manual-seo-import.csv'),
|
||||
'hosts_count' => self::countCsvHosts($strLatestDir . '/manual-seo-import.csv'),
|
||||
'metrics' => (array)($arrSummary['metrics'] ?? []),
|
||||
'uploaded_report_path' => '',
|
||||
'csv_path' => self::publicRelativePath($strLatestDir . '/manual-seo-import.csv'),
|
||||
'summary_json_path' => self::publicRelativePath($strLatestSummaryJsonPath),
|
||||
'summary_html_path' => self::publicRelativePath(dirname($strRoot) . '/latest/seo-external-real.summary.html'),
|
||||
'csv_path' => self::storageRelativePath($strLatestDir . '/manual-seo-import.csv'),
|
||||
'summary_json_path' => self::storageRelativePath($strLatestSummaryJsonPath),
|
||||
'summary_html_path' => self::storageRelativePath(dirname($strRoot) . '/latest/seo-external-real.summary.html'),
|
||||
'updated_at' => date(DATE_ATOM, (int)(filemtime($strLatestSummaryJsonPath) ?: time())),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ class VideoMetadataMissingRefreshHelper
|
||||
$intBatchSize = max(5, min(100, (int)($arrOptions['batch_size'] ?? 20)));
|
||||
$intBatchLimit = max(1, min(50, (int)($arrOptions['batch_limit'] ?? 10)));
|
||||
|
||||
$strPublicRoot = rtrim((string)root_path(), '/') . '/app/public';
|
||||
$strWorkbenchRoot = $strPublicRoot . '/_admin_templates/video-metadata-missing-workbench';
|
||||
$strTaskPoolRoot = $strPublicRoot . '/_admin_templates/video-metadata-missing-task-pool';
|
||||
$strStorageRoot = rtrim((string)root_path(), '/') . '/storage/video-metadata-missing';
|
||||
$strWorkbenchRoot = $strStorageRoot . '/workbench';
|
||||
$strTaskPoolRoot = $strStorageRoot . '/task-pool';
|
||||
|
||||
$arrWorkbenchSummary = VideoMetadataMissingWorkbenchHelper::buildSummary(
|
||||
$intSample,
|
||||
|
||||
@@ -413,11 +413,11 @@ class VideoMetadataMissingTaskPoolHelper
|
||||
);
|
||||
self::writeFile($strPromptPath, (string)($arrBatch['codex_prompt'] ?? ''));
|
||||
|
||||
$arrSummary['batches'][$intIndex]['detail_json_path'] = self::publicRelativePath($strDetailPath);
|
||||
$arrSummary['batches'][$intIndex]['prompt_markdown_path'] = self::publicRelativePath($strPromptPath);
|
||||
$arrSummary['batches'][$intIndex]['detail_json_path'] = self::storageRelativePath($strDetailPath);
|
||||
$arrSummary['batches'][$intIndex]['prompt_markdown_path'] = self::storageRelativePath($strPromptPath);
|
||||
$arrSummary['batches'][$intIndex]['history_json_path'] = is_file($strHistoryPath)
|
||||
? self::publicRelativePath($strHistoryPath)
|
||||
: self::publicRelativePath($strHistoryPath);
|
||||
? self::storageRelativePath($strHistoryPath)
|
||||
: self::storageRelativePath($strHistoryPath);
|
||||
}
|
||||
|
||||
return $arrSummary;
|
||||
@@ -437,12 +437,12 @@ class VideoMetadataMissingTaskPoolHelper
|
||||
return 'video-metadata-missing-task-pool-' . date('Ymd-His');
|
||||
}
|
||||
|
||||
protected static function publicRelativePath(string $strPath): string
|
||||
protected static function storageRelativePath(string $strPath): string
|
||||
{
|
||||
$strPublicRoot = str_replace('\\', '/', rtrim(dirname(__DIR__, 2) . '/public', '/'));
|
||||
$strStorageRoot = str_replace('\\', '/', rtrim(dirname(__DIR__, 3) . '/storage', '/'));
|
||||
$strPath = str_replace('\\', '/', $strPath);
|
||||
if (str_starts_with($strPath, $strPublicRoot . '/')) {
|
||||
return substr($strPath, strlen($strPublicRoot . '/'));
|
||||
if (str_starts_with($strPath, $strStorageRoot . '/')) {
|
||||
return substr($strPath, strlen($strStorageRoot . '/'));
|
||||
}
|
||||
|
||||
return $strPath;
|
||||
|
||||
@@ -53,9 +53,9 @@ class VideoMetadataMissingWorkbenchIndexHelper
|
||||
'top_field_missing_count' => (int)(($arrTopFields[0] ?? [])['missing_count'] ?? 0),
|
||||
'health_label' => $strHealthLabel,
|
||||
'health_reason' => $strHealthReason,
|
||||
'summary_json_path' => self::publicRelativePath($strSummaryPath),
|
||||
'summary_html_path' => self::publicRelativePath($strRunDir . '/video-metadata-missing-workbench.summary.html'),
|
||||
'prompt_markdown_path' => self::publicRelativePath($strRunDir . '/prompt.md'),
|
||||
'summary_json_path' => self::storageRelativePath($strSummaryPath),
|
||||
'summary_html_path' => self::storageRelativePath($strRunDir . '/video-metadata-missing-workbench.summary.html'),
|
||||
'prompt_markdown_path' => self::storageRelativePath($strRunDir . '/prompt.md'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -86,12 +86,12 @@ class VideoMetadataMissingWorkbenchIndexHelper
|
||||
return ['steady', '当前缺字段问题相对可控,适合按优先队列持续收敛。'];
|
||||
}
|
||||
|
||||
protected static function publicRelativePath(string $strPath): string
|
||||
protected static function storageRelativePath(string $strPath): string
|
||||
{
|
||||
$strPublicRoot = str_replace('\\', '/', rtrim(dirname(__DIR__, 2) . '/public', '/'));
|
||||
$strStorageRoot = str_replace('\\', '/', rtrim(dirname(__DIR__, 3) . '/storage', '/'));
|
||||
$strPath = str_replace('\\', '/', $strPath);
|
||||
if (str_starts_with($strPath, $strPublicRoot . '/')) {
|
||||
return substr($strPath, strlen($strPublicRoot . '/'));
|
||||
if (str_starts_with($strPath, $strStorageRoot . '/')) {
|
||||
return substr($strPath, strlen($strStorageRoot . '/'));
|
||||
}
|
||||
|
||||
return $strPath;
|
||||
|
||||
Reference in New Issue
Block a user