* @param string $path * @return int */ public function size($path) { return filesize($path); } public function humanFilesize($bytes, $decimals = 2) { $sz = 'BKMGTP'; //ini_set('error_log' , '/home/solomono/web/solomono.net/sites/dev/php.log'); error_reporting(E_ALL); set_error_handler(function ($level, $message, $file = '', $line = 0) { $this->handleError($level, $message, $file, $line); }); set_exception_handler(function ($e) { $this->handleException($e); }); * @param string $path * @return int */ public function size($path) { return filesize($path); } public function humanFilesize($bytes, $decimals = 2) { $sz = 'BKMGTP'; $handle = fopen($path, 'rb'); if ($handle) { // try { if (flock($handle, LOCK_SH)) { clearstatcache(true, $path); $contents = fread($handle, $this->size($path) ?: 1); flock($handle, LOCK_UN); } // } finally { // fclose($handle); // } * @throws Exception */ public function get(string $path, bool $lock = false) { if ($this->isFile($path) && file_exists($path)) { return $lock ? $this->sharedGet($path) : file_get_contents($path); } throw new Exception("File does not exist at path {$path}"); } /** // If the file doesn't exist, we obviously cannot return the cache so we will // just return null. Otherwise, we'll get the contents of the file and get // the expiration UNIX timestamps from the start of the file's contents. try { $expire = substr( $contents = $this->files->get($path, true), 0, 10 ); } catch (Exception $e) { return $this->emptyPayload(); * Retrieve an item from the cache by key. * @param string|array $key */ public function get($key) { return $this->getPayload($key)['data'] ?? null; } /** * Store an item in the cache for a given number of seconds. * @param string $key */ public function forget($key): bool { //save list of keys to paths if ($key !== 'ALL_KEYS' && empty($seconds)) { $allKeys = $this->get('ALL_KEYS') ?: []; if (isset($allKeys[$key])) { unset($allKeys[$key]); $this->put('ALL_KEYS', $allKeys, 0); } } // If the current time is greater than expiration timestamps we will delete // the file and return null. This helps clean up the old files and keeps // this directory much cleaner for us as old files aren't hanging out. if ($this->currentTime() >= $expire) { $this->forget($key); return $this->emptyPayload(); } try { * Retrieve an item from the cache by key. * @param string|array $key */ public function get($key) { return $this->getPayload($key)['data'] ?? null; } /** * Store an item in the cache for a given number of seconds. * @param string $key { if (is_array($key)) { return $this->many($key); } $value = $this->store->get($this->itemKey($key)); // If we could not find the cache value, we will fire the missed event and get // the default value for this cache value. This default could be a callback // so we will execute the value function which will resolve it if needed. if (is_null($value)) { * @param Closure $callback * @return mixed */ public function remember($key, $ttl, Closure $callback) { $value = $this->get($key); // If the item exists in the cache we will just return this immediately and if // not we will execute the given Closure and cache the result of that for a // given number of seconds so it's available for all subsequent requests. if (!is_null($value)) { try { if ($isCacheEnabled) { return self::getRepository() ->remember( $key, $ttl, $closure ); } else { return $closure();$configurations = FileCacheHelper::remember( FileCacheHelper::CONFIGURATIONS_KEY, fn() => tep_db_query( 'select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION )->fetch_all(MYSQLI_ASSOC), null);foreach ($configurations as $configuration) { $check_modules_folders = explode(':', $configuration['cfgValue']); if (define('PAGE_PARSE_START_TIME', microtime(true));define("SECONDS_PER_WEEK", 604800);header("Content-Security-Policy: default-src data: * 'unsafe-inline' 'unsafe-eval'; frame-ancestors 'none';");$saveDbPrepareInput = [];require_once __DIR__ . "/application_main.php";//redirect to a new domain nameif(getConstantValue('DOMEN_URL','') != '' && getConstantValue('DOMEN_URL') != $_SERVER['HTTP_HOST']){ header('Location: http://' . getConstantValue('DOMEN_URL')); exit();}use JsonLd\Container;use JsonLd\Product;use JsonLd\ProductReview;require('includes/application_top.php');includeLanguages(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);// define current template constants:$productAvailable = false;$productReviewsArr = [];|
ErrorException
|
|---|
ErrorException:
filesize(): stat failed for /var/www/roverhub_com_usr/data/www/roverhub.com.ua/storage/cache/bd/a5/bda5fcbf671782aad500a5f6cf52179bc99ebd7b
at /var/www/roverhub_com_usr/data/www/roverhub.com.ua/app/Classes/Filesystem/Filesystem.php:339
at Bootstrap\HandleExceptions->handleError(2, 'filesize(): stat failed for /var/www/roverhub_com_usr/data/www/roverhub.com.ua/storage/cache/bd/a5/bda5fcbf671782aad500a5f6cf52179bc99ebd7b', '/var/www/roverhub_com_usr/data/www/roverhub.com.ua/app/Classes/Filesystem/Filesystem.php', 339)
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/bootstrap/HandleExceptions.php:32)
at Bootstrap\HandleExceptions->Bootstrap\{closure}(2, 'filesize(): stat failed for /var/www/roverhub_com_usr/data/www/roverhub.com.ua/storage/cache/bd/a5/bda5fcbf671782aad500a5f6cf52179bc99ebd7b', '/var/www/roverhub_com_usr/data/www/roverhub.com.ua/app/Classes/Filesystem/Filesystem.php', 339, array('path' => '/var/www/roverhub_com_usr/data/www/roverhub.com.ua/storage/cache/bd/a5/bda5fcbf671782aad500a5f6cf52179bc99ebd7b'))
at filesize('/var/www/roverhub_com_usr/data/www/roverhub.com.ua/storage/cache/bd/a5/bda5fcbf671782aad500a5f6cf52179bc99ebd7b')
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/app/Classes/Filesystem/Filesystem.php:339)
at App\Classes\Filesystem\Filesystem->size('/var/www/roverhub_com_usr/data/www/roverhub.com.ua/storage/cache/bd/a5/bda5fcbf671782aad500a5f6cf52179bc99ebd7b')
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/app/Classes/Filesystem/Filesystem.php:55)
at App\Classes\Filesystem\Filesystem->sharedGet('/var/www/roverhub_com_usr/data/www/roverhub.com.ua/storage/cache/bd/a5/bda5fcbf671782aad500a5f6cf52179bc99ebd7b')
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/app/Classes/Filesystem/Filesystem.php:38)
at App\Classes\Filesystem\Filesystem->get('/var/www/roverhub_com_usr/data/www/roverhub.com.ua/storage/cache/bd/a5/bda5fcbf671782aad500a5f6cf52179bc99ebd7b', true)
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/app/Classes/Cache/Store/FileStore.php:200)
at App\Classes\Cache\Store\FileStore->getPayload('ALL_KEYS')
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/app/Classes/Cache/Store/FileStore.php:46)
at App\Classes\Cache\Store\FileStore->get('ALL_KEYS')
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/app/Classes/Cache/Store/FileStore.php:149)
at App\Classes\Cache\Store\FileStore->forget('configurations')
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/app/Classes/Cache/Store/FileStore.php:212)
at App\Classes\Cache\Store\FileStore->getPayload('configurations')
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/app/Classes/Cache/Store/FileStore.php:46)
at App\Classes\Cache\Store\FileStore->get('configurations')
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/app/Classes/Cache/Repository.php:65)
at App\Classes\Cache\Repository->get('configurations')
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/app/Classes/Cache/Repository.php:319)
at App\Classes\Cache\Repository->remember('configurations', null, object(Closure))
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/app/Classes/Cache/Helpers/FileCacheHelper.php:161)
at App\Classes\Cache\Helpers\FileCacheHelper::remember('configurations', object(Closure), null)
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/includes/application_main.php:32)
at require_once('/var/www/roverhub_com_usr/data/www/roverhub.com.ua/includes/application_main.php')
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/includes/application_top.php:10)
at require('/var/www/roverhub_com_usr/data/www/roverhub.com.ua/includes/application_top.php')
(/var/www/roverhub_com_usr/data/www/roverhub.com.ua/product_info.php:8)
|