From 4cedc1d814a622bb854a6fab84fa20332a6fb9dd Mon Sep 17 00:00:00 2001 From: Knah Tsaeb Date: Fri, 9 Aug 2013 15:55:31 +0200 Subject: [PATCH] [fix] delete cache after add video [fix] delete cahce after update video title or video date add --- bin/cronTask.sh.sample | 3 ++- inc/content.php | 4 +++- index.php | 10 ++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bin/cronTask.sh.sample b/bin/cronTask.sh.sample index ed9822c..9d92fa1 100644 --- a/bin/cronTask.sh.sample +++ b/bin/cronTask.sh.sample @@ -1,6 +1,7 @@ #!/bin/bash/ finalDest=/path/of/sovigall/videos/ tempDest=/path/of/sovigall/tmp/ +pageCache=/path/of/sovigall/pagecache/ threads=3 # nb cpu core - 1 cd $tempDest @@ -30,5 +31,5 @@ do done < $file fi done - +rm $pageCache*.html # -rc_lookahead 16 -g 360 -threads 3 diff --git a/inc/content.php b/inc/content.php index 79014a3..35059ac 100644 --- a/inc/content.php +++ b/inc/content.php @@ -186,7 +186,9 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) { $fullTitle = $videoInfo['originalTitle']; $uploadDate = $videoInfo['uploadDate']; updateFileInfo($videoInfo['hash'], $fullTitle, $uploadDate); - deleteCache($ci['bc'], $ci['file'], $ci['sort']); + $videoInfo['title'] = $fullTitle = $videoInfo['originalTitle'].' ('.$videoInfo['originalTitle'].')'; + $videoInfo['uploadDateSort'] = $videoInfo['uploadDate']; + deleteCache($ci['bc'], $ci['file'], $ci['sort'],true); } else { $fullTitle = $videoInfo['title'].' ('.$videoInfo['originalTitle'].')'; } diff --git a/index.php b/index.php index 0b3cd2c..9227412 100644 --- a/index.php +++ b/index.php @@ -560,10 +560,11 @@ function deleteCache($bc = '', $file = '', $sort = '', $parent = false) { unlink($_SERVER['DOCUMENT_ROOT'].'/'.$GLOBALS['config']['PAGECACHE'].'/'.$cacheFile.'.html'); } if ($parent === true) { - $parent = substr($bc, 0, -8); - $cacheParent = md5($parent.$file.$sort); - if (file_exists($_SERVER['DOCUMENT_ROOT'].'/', $GLOBALS['config']['PAGECACHE'].'/'.$cacheParent.'.html')) { - unlink($_SERVER['DOCUMENT_ROOT'].'/', $GLOBALS['config']['PAGECACHE'].'/'.$cacheParent.'.html'); + unset ($file); + unset ($sort); + $cacheParent = md5($bc.$file.$sort); + if (file_exists($_SERVER['DOCUMENT_ROOT'].'/'.$GLOBALS['config']['PAGECACHE'].'/'.$cacheParent.'.html')) { + unlink($_SERVER['DOCUMENT_ROOT'].'/'.$GLOBALS['config']['PAGECACHE'].'/'.$cacheParent.'.html'); } } } @@ -609,6 +610,7 @@ if (isset($ci['ac']) && !empty($ci['ac'])) { verifToken($ci['token']); $addVideo = addVideo($ci, $fullListFile); deleteCache($ci['bc'], $ci['file'], $ci['sort']); + unset($ci['ac']); } if ($ci['ac'] === 'addThumbnail' && !empty($ci['op']) && (int)$ci['op'] === 1) { verifToken($ci['token']);