Browse Source

bug fix: get default readme from current directory

master
filesite 5 months ago
parent
commit
350c8ef162
  1. 2
      themes/beauty/controller/ListController.php
  2. 22
      themes/beauty/controller/SiteController.php

2
themes/beauty/controller/ListController.php

@ -96,7 +96,7 @@ Class ListController extends Controller {
$breadcrumbs = $this->getBreadcrumbs($currentDir, $cachedParentData, $scanner); $breadcrumbs = $this->getBreadcrumbs($currentDir, $cachedParentData, $scanner);
//获取当前目录下的readme //获取当前目录下的readme
$cateReadmeFile = $scanner->getDefaultReadme($cateId); $cateReadmeFile = $scanner->getDefaultReadme();
if (!empty($cateReadmeFile)) { if (!empty($cateReadmeFile)) {
$Parsedown = new Parsedown(); $Parsedown = new Parsedown();
$content = file_get_contents($cateReadmeFile['realpath']); $content = file_get_contents($cateReadmeFile['realpath']);

22
themes/beauty/controller/SiteController.php

@ -67,13 +67,6 @@ Class SiteController extends Controller {
if (!empty($readmeFile['sort'])) { if (!empty($readmeFile['sort'])) {
$menus_sorted = explode("\n", $readmeFile['sort']); $menus_sorted = explode("\n", $readmeFile['sort']);
} }
$titles = $scanner->getMDTitles($readmeFile['id']);
$Parsedown = new Parsedown();
$content = file_get_contents($readmeFile['realpath']);
$htmlReadme = $Parsedown->text($content);
$htmlReadme = $scanner->fixMDUrls($readmeFile['realpath'], $htmlReadme);
} }
//排序 //排序
@ -86,16 +79,19 @@ Class SiteController extends Controller {
Common::saveCacheToFile($cacheKey, $menus); //保存目录数据 Common::saveCacheToFile($cacheKey, $menus); //保存目录数据
} }
//获取联系方式
$titles = array();
$readmeFile = $scanner->getDefaultReadme();
if (!empty($readmeFile)) {
$titles = $scanner->getMDTitles($readmeFile['id']);
//获取当前目录下的readme
$cateReadmeFile = $scanner->getDefaultReadme($defaultCateId);
if (!empty($cateReadmeFile)) {
$Parsedown = new Parsedown(); $Parsedown = new Parsedown();
$content = file_get_contents($cateReadmeFile['realpath']); $content = file_get_contents($readmeFile['realpath']);
$htmlCateReadme = $Parsedown->text($content); $htmlReadme = $Parsedown->text($content);
$htmlCateReadme = $scanner->fixMDUrls($cateReadmeFile['realpath'], $htmlCateReadme); $htmlReadme = $scanner->fixMDUrls($readmeFile['realpath'], $htmlReadme);
} }
//优先从缓存获取默认mp3文件 //优先从缓存获取默认mp3文件
$cacheKey = $this->getCacheKey('root', 'mp3', $maxScanDeep); $cacheKey = $this->getCacheKey('root', 'mp3', $maxScanDeep);
$mp3File = Common::getCacheFromFile($cacheKey); $mp3File = Common::getCacheFromFile($cacheKey);

Loading…
Cancel
Save