diff options
| author | 2013-11-03 20:28:52 +0100 | |
|---|---|---|
| committer | 2013-11-04 23:32:22 +0100 | |
| commit | adc9a958afa5fb9f6f2dab4ae8abac1f932a7db4 (patch) | |
| tree | 4a739d492582f3ba95d66d6f8072f6ecbcc1e654 /lib/minz | |
| parent | 231516f5238b6023001bed548569077c61411a4e (diff) | |
Préchargement et requêtes conditionnelles HTTP/1.1
Grosse amélioration des performances en utilisant le cache HTTP :
- Implémentation de HTTP/1.1, c.a.d. If-Modified-Since, If-None-Match,
If-Unmodified-Since, If-Match... avec la librairie
http://alexandre.alapetite.fr/doc-alex/php-http-304/
- Support de HEAD (HTTP /1.0).
- Préchargement de la page suivante (avec link next prefetch) dans le
cas de pagination.
- Et nouvelle possibilité de navigation pour les navigateurs qui
supportent "next".
- La date de dernier changement est pour l'instant primitive et
correspond au dernier changement de la session PHP ou
Configuration.array.php ou application.log ou touch.txt.
- touch.txt est modifié a chaque requête UPDATE ou INSERT ou DELETE.
Diffstat (limited to 'lib/minz')
| -rwxr-xr-x | lib/minz/dao/Model_pdo.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/minz/dao/Model_pdo.php b/lib/minz/dao/Model_pdo.php index 343b7004a..a91a4fa00 100755 --- a/lib/minz/dao/Model_pdo.php +++ b/lib/minz/dao/Model_pdo.php @@ -54,7 +54,7 @@ class Model_pdo { . '/data/' . $db['base'] . '.sqlite'; //TODO: DEBUG UTF-8 http://www.siteduzero.com/forum/sujet/sqlite-connexion-utf-8-18797 } - $this->bd = new PDO ( + $this->bd = new FreshPDO ( $string, $db['user'], $db['password'], @@ -72,3 +72,21 @@ class Model_pdo { } } } + +class FreshPDO extends PDO { + private static function check($statement) { + if (preg_match('/^(?:UPDATE|INSERT|DELETE)/i', $statement)) { + touch(PUBLIC_PATH . '/data/touch.txt'); + } + } + + public function prepare ($statement, $driver_options = array()) { + FreshPDO::check($statement); + return parent::prepare($statement, $driver_options); + } + + public function exec ($statement) { + FreshPDO::check($statement); + return parent::exec($statement); + } +} |
