fix: restyle pager chips and restore theme ad slots
Replace the loose page-count label with a SaBlog-style 6 / 316 chip, wire inject/stylevar HTML into list and post views, and flush page cache when ads are saved. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -59,6 +59,7 @@ class SablogImport extends Command
|
||||
}
|
||||
|
||||
$this->importSettings();
|
||||
$this->importStylevars();
|
||||
$this->importCategories();
|
||||
$this->importUsers();
|
||||
$this->importPosts();
|
||||
@@ -144,7 +145,7 @@ class SablogImport extends Command
|
||||
* searchindex —— 搜索缓存,现代 SQL 全文检索足够
|
||||
* sessions —— Laravel 原生会话
|
||||
* statistics —— 实时统计
|
||||
* stylevars —— 老式广告位变量
|
||||
* stylevars —— 导入为当前主题的 theme_vars(广告位)
|
||||
* seccode / 验证码 —— 由 AI 审核 + 蜜罐 + 频控取代
|
||||
*/
|
||||
private function importSettings(): void
|
||||
@@ -182,6 +183,34 @@ class SablogImport extends Command
|
||||
$this->report['settings'] = $count;
|
||||
}
|
||||
|
||||
private function importStylevars(): void
|
||||
{
|
||||
if (! $this->hasTable('stylevars')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$vars = [];
|
||||
foreach ($this->rows('stylevars') as $row) {
|
||||
$name = (string) ($row['title'] ?? $row['variable'] ?? $row['name'] ?? '');
|
||||
$value = (string) ($row['value'] ?? $row['content'] ?? '');
|
||||
if ($name === '' || $value === '') {
|
||||
continue;
|
||||
}
|
||||
$vars[$name] = $value;
|
||||
}
|
||||
|
||||
if ($vars === []) {
|
||||
return;
|
||||
}
|
||||
|
||||
$theme = (string) Setting::get('active_theme', 'sablog');
|
||||
$existing = Setting::get('theme_vars_'.$theme, []);
|
||||
$existing = is_array($existing) ? $existing : (json_decode((string) $existing, true) ?: []);
|
||||
|
||||
Setting::set('theme_vars_'.$theme, array_merge($existing, $vars));
|
||||
$this->report['stylevars'] = count($vars);
|
||||
}
|
||||
|
||||
private function importCategories(): void
|
||||
{
|
||||
$count = 0;
|
||||
|
||||
Reference in New Issue
Block a user