v1.1.1 (#233)
* fixed #194 PHP 5.6 error * - closed #102 added "set waypoint/destination" context menu to route finder module - update "Select2" 4.0.0 -> 4.0.3 - update "Font Awesome" 4.6.1 -> 4.6.3 * - added *.js files for develop branch * - closed #195 fixed "BASE" dir for subDir installations - fixed "Home" menu link * - #195 improved js load path * - added "clear cache" function for manually cache clearing to /setup #200 #105 #158 - added cache size information to /setup - added current pathfinder "VERSION" to /setup - updated "requireJs" 2.1.20 ->2.2.0 - removed unnecessary page cache timings from static templates (page cache) * - added "document_root", "port", "protocol" and "PHP framework version" to /setup page - added new "shattered" wormhole types to "signature table", closed #182, #179 * - added new "delete old signatures" option to "signature reader" dialog, closed #95 * - added new housekeeping cronjob für cached files, closed #200 - added new cache size information to /setup page * - fixed signature groupId/typeId "overwriting" for already known signatures. closed #207 - improved system search dialog. Added trim(); before "api/signatures-> search" request * updated README.me * fixed PHP error "default object from empty value", closed #209 * reduced image file size * - added local storage (IndexedDB) - added local storage for map scroll position. closed #69 * - added "notice" panel for upcoming release information - improved layout for "release dialog" (GitHub API) - improved pagespeed (removed render blocking javascripts) - improved map scrollbar configuration - improved Chrome browser custom scrollbar layout - removed "sign up" buttons from "map panels", closed #214 * - fixed some session and cookie bugs * - added new requirement check for `max_input_vars` to /setup URL, closed #224 * - fixed isWormhole(); bug * -v1.1.1 added js build files
This commit is contained in:
60
app/main/cron/cache.php
Normal file
60
app/main/cron/cache.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Exodus
|
||||
* Date: 25.06.2016
|
||||
* Time: 14:59
|
||||
*/
|
||||
|
||||
namespace cron;
|
||||
|
||||
use data\filesystem\Search;
|
||||
use Controller;
|
||||
|
||||
class Cache {
|
||||
|
||||
const LOG_TEXT = '%s [%\'_10s] files, size [%\'_10s] byte, not writable [%\'_10s] files, errors [%\'_10s], exec (%.3Fs)';
|
||||
|
||||
/**
|
||||
* clear expired cached files
|
||||
* >> >php index.php "/cron/deleteExpiredCacheData"
|
||||
* @param \Base $f3
|
||||
*/
|
||||
function deleteExpiredData(\Base $f3){
|
||||
$time_start = microtime(true);
|
||||
|
||||
// cache dir (dir is recursively searched...)
|
||||
$cacheDir = $f3->get('TEMP');
|
||||
|
||||
$filterTime = (int)strtotime('-' . $f3->get('PATHFINDER.CACHE.EXPIRE_MAX') . ' seconds');
|
||||
$expiredFiles = Search::getFilesByMTime($cacheDir, $filterTime);
|
||||
|
||||
$deletedFiles = 0;
|
||||
$deletedSize = 0;
|
||||
$notWritableFiles = 0;
|
||||
$deleteErrors = 0;
|
||||
foreach($expiredFiles as $filename => $file) {
|
||||
/**
|
||||
* @var $file \SplFileInfo
|
||||
*/
|
||||
if( $file->isWritable() ){
|
||||
$tmpSize = $file->getSize();
|
||||
if( unlink($file->getRealPath()) ){
|
||||
$deletedSize += $tmpSize;
|
||||
$deletedFiles++;
|
||||
}else{
|
||||
$deleteErrors++;
|
||||
}
|
||||
}else{
|
||||
$notWritableFiles++;
|
||||
}
|
||||
}
|
||||
|
||||
$execTime = microtime(true) - $time_start;
|
||||
|
||||
// Log ------------------------
|
||||
$log = Controller\LogController::getLogger('cron_' . __FUNCTION__);
|
||||
$log->write( sprintf(self::LOG_TEXT, __FUNCTION__, $deletedFiles, $deletedSize, $notWritableFiles, $deleteErrors, $execTime) );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user