cache pages

This commit is contained in:
Andrey Kuvshinov
2020-05-21 21:04:33 +03:00
2 changed files with 5 additions and 3 deletions

View File

@@ -46,16 +46,17 @@ function pdfs_init($source, $page = 1){
if (!file_exists($source))
return false;
// $result['count'] = pdfs_count($source); // количество страниц
$result['pdfurl'] = SITE.trim(pdfs_cachefile($source), '/'); //полный файл на скачку
$name = pdfs_hash($source);
$cachedir = PGDIR.$name.'/';
$cachefile = $name.'-'.$page.'.pdf';
$fullcachefile = $cachedir.$cachefile;
if (!file_exists($fullcachefile)){
if (!file_exists($source))
return false;
if (!is_dir($cachedir))
mkdir($cachedir);