|
|
@ -81,14 +81,23 @@ Class SiteController extends Controller { |
|
|
|
|
|
|
|
|
|
|
|
//获取联系方式 |
|
|
|
//获取联系方式 |
|
|
|
$titles = array(); |
|
|
|
$titles = array(); |
|
|
|
$readmeFile = $scanner->getDefaultReadme(); |
|
|
|
$cacheKey = $this->getCacheKey('root', 'readme', $maxScanDeep); |
|
|
|
if (!empty($readmeFile)) { |
|
|
|
$cachedData = Common::getCacheFromFile($cacheKey); |
|
|
|
$titles = $scanner->getMDTitles($readmeFile['id']); |
|
|
|
if (empty($cachedData)) { |
|
|
|
|
|
|
|
$readmeFile = $scanner->getDefaultReadme(); |
|
|
|
$Parsedown = new Parsedown(); |
|
|
|
if (!empty($readmeFile)) { |
|
|
|
$content = file_get_contents($readmeFile['realpath']); |
|
|
|
$titles = $scanner->getMDTitles($readmeFile['id']); |
|
|
|
$htmlReadme = $Parsedown->text($content); |
|
|
|
|
|
|
|
$htmlReadme = $scanner->fixMDUrls($readmeFile['realpath'], $htmlReadme); |
|
|
|
$Parsedown = new Parsedown(); |
|
|
|
|
|
|
|
$content = file_get_contents($readmeFile['realpath']); |
|
|
|
|
|
|
|
$htmlReadme = $Parsedown->text($content); |
|
|
|
|
|
|
|
$htmlReadme = $scanner->fixMDUrls($readmeFile['realpath'], $htmlReadme); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Common::saveCacheToFile($cacheKey, array('htmlReadme' => $htmlReadme, 'titles' => $titles)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
$htmlReadme = $cachedData['htmlReadme']; |
|
|
|
|
|
|
|
$titles = $cachedData['titles']; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|