Warning sur le site et admin Opencart : library/cache.php
Publié: 31 Juil 2015, 14:17
Bonjour a tous,
Voila, j'ai un grand problème depuis hier sur mon site web. Il y a des warning PHP qui s'affichent sur mon site ( en haut de mon site ) et également sur mon admin Opnecart ( aussi les messages en haut ). En fait ces messages ont apparue suite a une restauration de FTP. J'ai ressayé de restauré a nouveau FTP et la base donnée juste après ca mais c'a rien fait. Je suis chez OVH. Est ce que ici il y a quelqu’un qui pourrait m'aider ?
Voici les messages qui apparaissent sur le site lui meme en ouvrant la page et sur mon admin Opencart :
Warning: fopen(/home/objetperec/www/system/cache/cache.manufacturer.0.1438347395): failed to open stream: No such file or directory in /home/objetperec/www/system/library/cache.php on line 32Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 34Warning: fclose() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 36Warning: fopen(/home/objetperec/www/system/cache/cache.manufacturer.0.1438347395): failed to open stream: No such file or directory in /home/objetperec/www/system/library/cache.php on line 32Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 34Warning: fclose() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 36Warning: fopen(/home/objetperec/www/system/cache/cache.language.1438347396): failed to open stream: No such file or directory in /home/objetperec/www/system/library/cache.php on line 32Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 34Warning: fclose() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 36Warning: fopen(/home/objetperec/www/system/cache/cache.currency.1438347396): failed to open stream: No such file or directory in /home/objetperec/www/system/library/cache.php on line 32Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 34Warning: fclose() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 36
Je retrouve bien avec Filezilla le cache.php mais je sais pas comment et quoi je dois ajouter pour résoudre les warnings . Voici ce que je retrouve dans le www/system/library/cache.php
<?php
class Cache {
private $expire = 3600;
public function get($key) {
$files = glob(DIR_CACHE . 'cache.' . preg_replace('/[^A-Z0-9\._-]/i', '', $key) . '.*');
if ($files) {
$cache = file_get_contents($files[0]);
$data = unserialize($cache);
foreach ($files as $file) {
$time = substr(strrchr($file, '.'), 1);
if ($time < time()) {
if (file_exists($file)) {
unlink($file);
}
}
}
return $data;
}
}
public function set($key, $value) {
$this->delete($key);
$file = DIR_CACHE . 'cache.' . preg_replace('/[^A-Z0-9\._-]/i', '', $key) . '.' . (time() + $this->expire);
$handle = fopen($file, 'w');
fwrite($handle, serialize($value));
fclose($handle);
}
public function delete($key) {
$files = glob(DIR_CACHE . 'cache.' . preg_replace('/[^A-Z0-9\._-]/i', '', $key) . '.*');
if ($files) {
foreach ($files as $file) {
if (file_exists($file)) {
unlink($file);
}
}
}
}
}
?>
Vraiment si vous pouvez me dore comment faire ca serait génial car je me casse la tête depuis hier !
Merci d'avance
Milena
Voila, j'ai un grand problème depuis hier sur mon site web. Il y a des warning PHP qui s'affichent sur mon site ( en haut de mon site ) et également sur mon admin Opnecart ( aussi les messages en haut ). En fait ces messages ont apparue suite a une restauration de FTP. J'ai ressayé de restauré a nouveau FTP et la base donnée juste après ca mais c'a rien fait. Je suis chez OVH. Est ce que ici il y a quelqu’un qui pourrait m'aider ?
Voici les messages qui apparaissent sur le site lui meme en ouvrant la page et sur mon admin Opencart :
Warning: fopen(/home/objetperec/www/system/cache/cache.manufacturer.0.1438347395): failed to open stream: No such file or directory in /home/objetperec/www/system/library/cache.php on line 32Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 34Warning: fclose() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 36Warning: fopen(/home/objetperec/www/system/cache/cache.manufacturer.0.1438347395): failed to open stream: No such file or directory in /home/objetperec/www/system/library/cache.php on line 32Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 34Warning: fclose() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 36Warning: fopen(/home/objetperec/www/system/cache/cache.language.1438347396): failed to open stream: No such file or directory in /home/objetperec/www/system/library/cache.php on line 32Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 34Warning: fclose() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 36Warning: fopen(/home/objetperec/www/system/cache/cache.currency.1438347396): failed to open stream: No such file or directory in /home/objetperec/www/system/library/cache.php on line 32Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 34Warning: fclose() expects parameter 1 to be resource, boolean given in /home/objetperec/www/system/library/cache.php on line 36
Je retrouve bien avec Filezilla le cache.php mais je sais pas comment et quoi je dois ajouter pour résoudre les warnings . Voici ce que je retrouve dans le www/system/library/cache.php
<?php
class Cache {
private $expire = 3600;
public function get($key) {
$files = glob(DIR_CACHE . 'cache.' . preg_replace('/[^A-Z0-9\._-]/i', '', $key) . '.*');
if ($files) {
$cache = file_get_contents($files[0]);
$data = unserialize($cache);
foreach ($files as $file) {
$time = substr(strrchr($file, '.'), 1);
if ($time < time()) {
if (file_exists($file)) {
unlink($file);
}
}
}
return $data;
}
}
public function set($key, $value) {
$this->delete($key);
$file = DIR_CACHE . 'cache.' . preg_replace('/[^A-Z0-9\._-]/i', '', $key) . '.' . (time() + $this->expire);
$handle = fopen($file, 'w');
fwrite($handle, serialize($value));
fclose($handle);
}
public function delete($key) {
$files = glob(DIR_CACHE . 'cache.' . preg_replace('/[^A-Z0-9\._-]/i', '', $key) . '.*');
if ($files) {
foreach ($files as $file) {
if (file_exists($file)) {
unlink($file);
}
}
}
}
}
?>
Vraiment si vous pouvez me dore comment faire ca serait génial car je me casse la tête depuis hier !
Merci d'avance
Milena