Ticket Hash: 084a09bbff324c08102f015692ed98431bef3285
Title: suppression à l'arrache du cache
Status: Closed Type: Bug
Severity: Mineur Priority: Low
Subsystem: Resolution: Fixed
Last Modified: 2021-05-15 11:51:19
Version Found In: 1.1.0-beta1
User Comments:

Olav__ added on 2021-04-04 20:10:36:

(text/x-markdown)
J'ai mis à jour le squelette _head.html via l'interface admin de Garradin.

Cela a bien fonctionné, j'ai eu la page que je souhaitais.

---

J'ai ensuite fait une autre modif de _head.html qui ne semblait pas apparaître sur le site.

Je me suis dit qu'il y avait peut être un problème de cache... donc je l'ai supprimé de manière un peu violente (rm -rf tout ce qu'il y avait dedans...)


---


Le cache a bien été recréé, la partie "admin" de Garradin fonctionne, par contre le rendu des pages du site public ne marche plus du tout :

 \__/
 (xx)
//||\\

Une erreur s'est produite
PHP error
Warning: file_put_contents(/var/www/garradin/data/cache/utemplates/b9f6c0b3de97d839af2d91da298f613a2f2dd73b.php.tmp): failed to open stream: No such file or directory
in .../include/lib/Garradin/UserTemplate/UserTemplate.php:149

145		$source = $this->file ? $this->file->fetch() : file_get_contents($this->path);
146
147		try {
148			$code = $this->compile($source);
149			file_put_contents($tmp_path, $code);
150
151			require $tmp_path;
152		}
153		catch (Brindille_Exception $e) {

in .../include/lib/Garradin/UserTemplate/UserTemplate.php:149
→ file_put_contents (2 arg.)
$filename	

string(74) ".../data/cache/utemplates/b9f6c0b3de97d839af2d91da298f613a2f2dd73b.php.tmp"

$data	

string(3551) "<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="utf-8" />
    <title><?php if ($this->get('title')): ?><?=$this->_modifiers['escape']($this->get('title'))?> — <?php endif; ?><?=$this->_modifiers['escape']($this->get('config.nom_asso'))?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, target-densitydpi=device-dpi" />
    <link rel="stylesheet" type="text/css" href="<?=$this->_modifiers['escape']($this->get('root_url'))?>default.css" media="screen,projection,handheld" />
    <link rel="stylesheet" type="text/css" href="<?=$this->_modifiers['escape']($this->get('root_url'))?>content.css" media="all" />
    <link rel="alternate" type="application/atom+xml" title="<?=$this->_modifiers['escape']($this->get('config.nom_asso'))?>" href="<?=$this->_modifiers['escape']($this->get('root_url'))?>atom.xml" />
</head>

<body>

<header class="nav">
    <nav>
        <a href="/"><img src="/velocite63/bandeauCourt.png" width="100%" align="middle"></a>
    </nav>

</header>

<header class="main">


    <!--menu sous l'image d'entete -->
    <B_menu>
    <nav>
        <ul>
       
            <li>
            <a href="/Actions/" id="1">Activité</a>
            </li><li>
            <a href="/Presentation" id="2">Présentation</a>
            </li><li>
            <a href="/Velo-Ecole" id="3">Vélo-École</a>
            </li><li>
            <a href="/Aide-trajet" id="4">Aide Trajet</a>
            </li><li>
            <a href="/Atelier" id="5">Atelier</a>
            </li><li>
            <a href="/Marquage" id="6">Bicycode</a>
            </li><li>            
            <a href="/Adherents" id="7">Adhérents</a>
            </li><li>
            <a href="https://twitter.com/Velocite63" target="_blank"><img src="/velocite63/Twitter_logo.png" width=32 height=32 valign="center"></a>
            </li><li>
            <a href=https://www.facebook.com/velocite63 target="_blank">…

145		$source = $this->file ? $this->file->fetch() : file_get_contents($this->path);
146
147		try {
148			$code = $this->compile($source);
149			file_put_contents($tmp_path, $code);
150
151			require $tmp_path;
152		}
153		catch (Brindille_Exception $e) {

in .../include/lib/Garradin/Web/Skeleton.php:126
→ Garradin\UserTemplate\UserTemplate->display (0 arg.)

122			}
123
124			$ut->assignArray($params);
125
126			$ut->display();
127		}
128		elseif ($this->file) {
129			$this->file->display();
130		}

in .../include/lib/Garradin/UserTemplate/Functions.php:54
→ Garradin\Web\Skeleton->display (1 arg.)
$params	

array(2) {
  ["file"]=> string(10) "_head.html"
  ["included_from"]=> array(1) {
    [0]=> string(10) "_head.html"
  }
}

50		}
51
52		$params['included_from'] = array_merge($from, [$params['file']]);
53
54		$s->display($params);
55	}
56
57	static public function http(array $params): void
58	{

in .../data/cache/shared/utemplates/3e3a6f71bebadd1333de1f4c3ed8a2179084fb15.php.tmp:1
→ Garradin\UserTemplate\Functions::include (3 arg.)
$params	

array(2) {
  ["file"]=> string(10) "_head.html"
  ["included_from"]=> array(1) {
    [0]=> string(10) "_head.html"
  }
}

$ut	

object(Garradin\UserTemplate\UserTemplate) (8) {
}

$line	

int(1)

1<?=call_user_func($this->_functions['include'], ['file' => '_head.html'], $this, 1)?>
2
3<?php unset($last); foreach (call_user_func($this->_sections['articles'], ['order' => 'published DESC', 'future' => false, 'limit' => 1], $this, 3) as $key => $value): $this->_variables[] = []; $this->assignArray($value + ['__' => $value, '_' => $key]); ?>
4<section class="articles main">
5	<article>
6		<?php unset($last); foreach (call_user_func($this->_sections['images'], ['parent' => $this->get('path'), 'limit' => 1], $this, 6) as $key => $value): $this->_variables[] = []; $this->assignArray($value + ['__' => $value, '_' => $key]); ?>
7		<aside>
8			<a href="<?=$this->_modifiers['escape']($this->get('.url'))?>"><img src="<?=$this->_modifiers['escape']($this->get('thumb_url'))?>" alt="" /></a>
9		</aside>

in .../include/lib/Garradin/UserTemplate/UserTemplate.php:151
→ require (1 arg.)
0	

string(81) ".../data/cache/shared/utemplates/3e3a6f71bebadd1333de1f4c3ed8a2179084fb15.php.tmp"

147		try {
148			$code = $this->compile($source);
149			file_put_contents($tmp_path, $code);
150
151			require $tmp_path;
152		}
153		catch (Brindille_Exception $e) {
154			throw new Brindille_Exception(sprintf("Erreur de syntaxe dans '%s' : %s",
155				$this->file ? $this->file->name : Utils::basename($this->path),

in .../include/lib/Garradin/Web/Skeleton.php:68
→ Garradin\UserTemplate\UserTemplate->display (0 arg.)

64			header(sprintf('Content-Type: %s;charset=utf-8', $this->type()));
65
66			try {
67				$ut->assignArray($params);
68				$ut->display();
69			}
70			catch (Brindille_Exception $e) {
71				printf('<div style="border: 5px solid orange; padding: 10px; background: yellow;"><h2>Erreur dans le squelette</h2><p>%s</p></div>', nl2br(htmlspecialchars($e->getMessage())));
72			}

in .../include/lib/Garradin/Web/Web.php:230
→ Garradin\Web\Skeleton->serve (1 arg.)
$params	

array(3) {
  ["uri"]=> string(0) ""
  ["page"]=> NULL
  ["skel"]=> string(10) "index.html"
}

226			$skel = '404.html';
227		}
228
229		$s = new Skeleton($skel);
230		$s->serve(compact('uri', 'page', 'skel'));
231	}
232}
233

in .../www/index.php:9
→ Garradin\Web\Web::dispatchURI (0 arg.)

5use Garradin\Web\Web;
6
7require __DIR__ . '/_inc.php';
8
9Web::dispatchURI();
10

Context
id	z44l158
date	2021-04-04T22:00:10+02:00
os	Linux
language	PHP 7.4.3
environment	development
php_sapi	apache2handler
remote_ip	127.0.0.1
http_method	GET
files_sent	array(0) { }
rootDirectory	/var/www/garradin
garradin_data_root	/var/www/garradin/data
garradin_version	1.1.0-beta1
url	http://127.0.0.1:81/

---


J'ai recréé en mkdir le répertoire /var/www/garradin/data/cache/utemplates

---

Du coup, il y a bien des fichiers .php.tmp qui se créént :

3e3a6f71bebadd1333de1f4c3ed8a2179084fb15.php.tmp

896022149b1ec8c8aaa672f7252562740ecfa0bf.php.tmp

bec5943913c936847dbe95d16fb79d818bb61db2.php.tmp

mais il n'y a pas de b9f6c0b3de97d839af2d91da298f613a2f2dd73b.php.tmp :(

---

Je ne sais pas si on peut considérer que c'est un bug, vu que ce n'était pas très fin de ma part de tout effacer dans le cache ? (cependant, j'avais fait ce type de manip en versions < 1.1, sans avoir constaté de problèmes, le cache se reconstruisait dynamiquement)

Je remonte le souci au cas où.

Merci d'avance pour l'analyse

Olav__ added on 2021-04-04 20:19:26:

(text/x-markdown)
Ca refonctionne après avoir enlevé le fichier /var/www/garradin/data/files/skel/_head.html, puis l'avoir remis à l'identique...

Tout cela est assez mystérieux pour moi.

bohwaz added on 2021-04-05 11:37:20:

(text/x-fossil-plain)
Merci corrigé dans [1f23b0d518b7e17b1a9f71c86d65df3d0818076b0c3a8817a77376a89cae0320]

Olav__ added on 2021-05-15 09:51:19:

(text/x-markdown)
Ok, en V1.1.5

Merci :)