copy file cache

This commit is contained in:
Andrey Kuvshinov
2020-04-08 23:26:46 +03:00
parent a97ba9ed1c
commit 4b7535e963
3 changed files with 13 additions and 1 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
vendor
pdf/

View File

@@ -11,6 +11,8 @@ if (isset($_SERVER['HTTP_HOST']))
else
define('SITEPATH', dirname(__FILE__));
define('PDFDIR', '/vhosts/app/pub/files/pdf/');
db_config('argumentiru', 'mysql:host=mysql;dbname=argumentiru', 'newser', 'Chjk90yuiREY');
db_config('reader', 'mysql:host=mysql;dbname=argumentiru', 'reader', 'ghjyjkUIOhg56Fh');

View File

@@ -18,9 +18,13 @@ function anfilename($id){
function file_kuri($hash) {
$price = db_get("SELECT `price_id`, `pricename` FROM `price` WHERE `pricehash` = '$hash' LIMIT 1");
if (!isset($price['price_id'])){
@@ -29,8 +33,13 @@ function file_kuri($hash) {
return False;
}
$id = $price['price_id'];
$pdfile = anfilename($id);
$newF = PDFDIR.$hash.'.pdf';
if (!file_exists($newF))
copy($pdfile, $newF);
$request = $_SERVER['REQUEST_URI'];
$filename = basename($request);