touch en microsecondes

Passage en microsecondes pour le touch (gestion du cache) pour éviter
les problèmes en particulier dans le cas de requêtes de moins d'une
seconde.
Nouvelle fonction invalidateHttpCache() pour plus facilement changer de
méthode de contrôle de fraîcheur de cache.
Devrait résoudre https://github.com/marienfressinaud/FreshRSS/issues/296
pull/298/merge
Alexandre Alapetite 11 years ago
parent 6a9ce0cbad
commit 7cdc477c45
  1. 2
      actualize_script.php
  2. 2
      app/controllers/entryController.php
  3. 4
      app/controllers/indexController.php
  4. 2
      app/layout/layout.phtml
  5. 2
      app/models/RSSConfiguration.php
  6. 4
      lib/lib_rss.php
  7. 2
      lib/minz/dao/Model_pdo.php
  8. 7
      public/index.php

@ -20,4 +20,4 @@ $front_controller = new App_FrontController ();
$front_controller->init ();
Session::_param('mail', true); // permet de se passer de la phase de connexion
$front_controller->run ();
touch(DATA_PATH . '/touch.txt');
invalidateHttpCache();

@ -84,7 +84,7 @@ class entryController extends ActionController {
$entryDAO = new EntryDAO();
$entryDAO->optimizeTable();
touch(DATA_PATH . '/touch.txt');
invalidateHttpCache();
$notif = array (
'type' => 'good',

@ -272,7 +272,7 @@ class indexController extends ActionController {
$res = json_decode ($result, true);
if ($res['status'] == 'okay' && $res['email'] == $this->view->conf->mailLogin ()) {
Session::_param ('mail', $res['email']);
touch(DATA_PATH . '/touch.txt');
invalidateHttpCache();
} else {
$res = array ();
$res['status'] = 'failure';
@ -285,6 +285,6 @@ class indexController extends ActionController {
public function logoutAction () {
$this->view->_useLayout (false);
Session::_param ('mail');
touch(DATA_PATH . '/touch.txt');
invalidateHttpCache();
}
}

@ -32,7 +32,7 @@
<?php
if (isset ($this->notification)) {
touch(DATA_PATH . '/touch.txt');
invalidateHttpCache();
?>
<div class="notification <?php echo $this->notification['type']; ?>">
<?php echo $this->notification['content']; ?>

@ -473,6 +473,6 @@ class RSSConfigurationDAO extends Model_array {
}
$this->writeFile($this->array);
touch(DATA_PATH . '/touch.txt');
invalidateHttpCache();
}
}

@ -230,3 +230,7 @@ function lazyimg($content) {
$content
);
}
function invalidateHttpCache() {
file_put_contents(DATA_PATH . '/touch.txt', microtime(true));
}

@ -85,7 +85,7 @@ class Model_pdo {
class FreshPDO extends PDO {
private static function check($statement) {
if (preg_match('/^(?:UPDATE|INSERT|DELETE)/i', $statement)) {
touch(DATA_PATH . '/touch.txt');
invalidateHttpCache();
}
}

@ -27,10 +27,11 @@ if (file_exists ('install.php')) {
if (!file_exists(DATA_PATH . '/no-cache.txt')) {
require (LIB_PATH . '/http-conditional.php');
$dateLastModification = max(
@filemtime(DATA_PATH . '/touch.txt') - 1,
@filemtime(LOG_PATH . '/application.log') - 1,
@filemtime(DATA_PATH . '/application.ini') - 1
@filemtime(DATA_PATH . '/touch.txt'),
@filemtime(LOG_PATH . '/application.log'),
@filemtime(DATA_PATH . '/application.ini')
);
$_SERVER['QUERY_STRING'] .= '&utime=' . file_get_contents(DATA_PATH . '/touch.txt');
if (httpConditional($dateLastModification, 0, 0, false, false, true)) {
exit(); //No need to send anything
}

Loading…
Cancel
Save