Skip to content
Snippets Groups Projects
Commit 40045e50 authored by Laurent's avatar Laurent
Browse files

hotline #58885 remove unused image count from systeme/images

parent 999d0866
Branches
Tags
3 merge requests!2334Master,!2301Master,!2285hotline #58885 remove unused image count from systeme/images
Pipeline #2235 passed with stage
in 10 minutes and 58 seconds
- ticket #58885 : Correction de l'erreur 504 Gateway Time-out sur /admin/systeme/cacheimages
\ No newline at end of file
......@@ -49,44 +49,42 @@ class Admin_SystemeController extends Zend_Controller_Action {
public function cacheimagesAction() {
$fs = static::getFileSystem();
$this->view->titre = $this->_('Contrôle du cache des images');
$path = $fs->getcwd() . '/temp/vignettes_titre';
if (!$fs->file_exists($path))
$fs->mkdir($path);
$this->view->titre = $this->_('Contrôle du cache des images');
$path = $fs->getcwd() . '/temp/vignettes_titre';
$reset_all = ($this->_getParam('mode','') == 'reset_all');
// Effacer tout le cache
if ($reset_all)
if ($reset_all) {
Zend_Registry::get('sql')->execute("update notices set url_vignette='', url_image=''");
$this->_clearImageCache($path);
}
$this->deleteUnknownImages();
$this->view->nb_notices = Class_Notice::count();
$this->view->nb_pas_reconnu = Class_Notice::countBy(['url_vignette' =>'NO']);
$this->view->nb_reconnu = $this->view->nb_notices - $this->view->nb_pas_reconnu - Class_Notice::countBy(['url_vignette' => '']);
}
// Calcul de l'espace occupé
if (!$fs->file_exists($path))
$fs->mkdir($path);
protected function _clearImageCache($path) {
$fs = static::getFileSystem();
if (!$dir = $fs->opendir($path)) {
$this->view->taille_cache = 0;
return;
}
$taille = 0;
while(false !== ($file = $fs->readdir($dir))) {
$extension = substr($file, -4);
if($extension != ".gif" and $extension !=".png" and $extension !=".jpg")
if ($extension != ".gif" and $extension !=".png" and $extension !=".jpg")
continue;
if($reset_all) {
$fs->unlink($path.'/'.$file);
continue;
}
$taille += $fs->filesize($path.'/'.$file);
$this->view->nb_cache++;
$fs->unlink($path.'/'.$file);
}
$fs->closedir($dir);
$this->view->taille_cache = (int)($taille/1024);
}
......
......@@ -2,16 +2,13 @@
<script src="<?php echo URL_ADMIN_JS?>cacheimages.js"> </script>
<?php
echo $this->tag('h2', $this->_('Base de données'));
echo $this->ligneInfos($this->_('Nombre de vignettes reconnues'), $this->nb_reconnu);
echo $this->ligneInfos($this->_('Nombre de vignettes non reconnues'), $this->nb_pas_reconnu);
echo $this->ligneInfos($this->_('Nombre de notices hors cache'),
$this->nb_notices-($this->nb_reconnu + $this->nb_pas_reconnu));
echo $this->tag('h2', $this->_('Cache des images (fichiers)'));
echo $this->ligneInfos($this->_('Nombre d\'images dans le cache'), $this->nb_cache);
echo $this->ligneInfos($this->_('Espace occupé dans le cache'), $this->taille_cache."&nbsp;ko");
echo $this->tag('h2', $this->_('Actions'));
echo $this->button(
(new Class_Entity())->setText($this->_('Vider la totalité du cache'))
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment