summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchris <chris@jalakai.co.uk>2006-09-24 22:21:57 +0200
committerchris <chris@jalakai.co.uk>2006-09-24 22:21:57 +0200
commitce6b63d97068e71369bad95e7959d0110717bbfd (patch)
treef496db6a8c3d9e964f902873a3db81c7a1dddf72
parent100a97e3f1501dd634d1e398f564902dcaf2b3fb (diff)
downloadrpg-ce6b63d97068e71369bad95e7959d0110717bbfd.tar.gz
rpg-ce6b63d97068e71369bad95e7959d0110717bbfd.tar.bz2
cache, metadata & purgefile updates
Cache - add dependency for metadata renderer file - check metadata for end of page life, "date valid end". Metadata Renderer - RSS syntax mode now sets rendered page expiry, "date valid end" and includes the feed URL in "relation haspart". Purgefile For all wiki installations the purgefile records the earliest time before which no cache purge (based on data consistency) is required. Cache files older than this time MAY need to be purged. - remove purgeonadd configuration setting darcs-hash:20060924202157-9b6ab-4531e91411c41914eeab2b6a8160c3d46b001cee.gz
-rw-r--r--conf/dokuwiki.php1
-rw-r--r--inc/cache.php29
-rw-r--r--inc/common.php6
-rw-r--r--inc/parser/metadata.php10
-rw-r--r--inc/parser/xhtml.php2
-rw-r--r--lib/plugins/config/lang/cs/lang.php1
-rw-r--r--lib/plugins/config/lang/da/lang.php1
-rw-r--r--lib/plugins/config/lang/de/lang.php1
-rw-r--r--lib/plugins/config/lang/el/lang.php1
-rw-r--r--lib/plugins/config/lang/en/lang.php1
-rw-r--r--lib/plugins/config/lang/es/lang.php1
-rw-r--r--lib/plugins/config/lang/fr/lang.php1
-rw-r--r--lib/plugins/config/lang/it/lang.php1
-rw-r--r--lib/plugins/config/lang/ja/lang.php1
-rw-r--r--lib/plugins/config/lang/pl/lang.php1
-rw-r--r--lib/plugins/config/lang/ru/lang.php1
-rw-r--r--lib/plugins/config/lang/uk/lang.php1
-rw-r--r--lib/plugins/config/settings/config.metadata.php1
18 files changed, 36 insertions, 25 deletions
diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php
index 861ffd1c4..9403de176 100644
--- a/conf/dokuwiki.php
+++ b/conf/dokuwiki.php
@@ -79,7 +79,6 @@ $conf['autoplural'] = 0; //try (non)plural form of nonexisting f
$conf['compression'] = 'gz'; //compress old revisions: (0: off) ('gz': gnuzip) ('bz2': bzip)
// bz2 generates smaller files, but needs more cpu-power
$conf['cachetime'] = 60*60*24; //maximum age for cachefile in seconds (defaults to a day)
-$conf['purgeonadd'] = 1; //purge cache when a new file is added (needed for up to date links)
$conf['locktime'] = 15*60; //maximum age for lockfiles (defaults to 15 minutes)
$conf['fetchsize'] = 2*1024*1024; //maximum size (bytes) fetch.php may download from extern
$conf['notify'] = ''; //send change info to this email (leave blank for nobody)
diff --git a/inc/cache.php b/inc/cache.php
index ae27f4e9e..767ad8a35 100644
--- a/inc/cache.php
+++ b/inc/cache.php
@@ -36,6 +36,7 @@ class cache {
* @param array $depends array of cache dependencies, support dependecies:
* 'age' => max age of the cache in seconds
* 'files' => cache must be younger than mtime of each file
+ * (nb. dependency passes if file doesn't exist)
*
* @return bool true if cache can be used, false otherwise
*/
@@ -218,14 +219,21 @@ class cache_renderer extends cache_parser {
if (!parent::_useCache()) return false;
- // for wiki pages, check for internal link status changes
+ // for wiki pages, check metadata dependencies
if (isset($this->page)) {
+ $metadata = p_get_metadata($this->page);
- // check the purgefile
+ // page has an expiry time, after which it should be re-rendered (RSS feeds use this)
+ $page_expiry = $metadata['date']['valid']['end'];
+ if (!empty($page_expiry) && (time() > $page_expiry)) return false;
+
+ // check currnent link existence is consistent with cache version
+ // first check the purgefile
// - if the cache is more recent that the purgefile we know no links can have been updated
if ($this->_time < @filemtime($conf['cachedir'].'/purgefile')) {
- $links = p_get_metadata($this->page,"relation references");
+# $links = p_get_metadata($this->page,"relation references");
+ $links = $metadata['relation']['references'];
if (!empty($links)) {
foreach ($links as $id => $exists) {
@@ -242,9 +250,20 @@ class cache_renderer extends cache_parser {
// renderer cache file dependencies ...
$files = array(
- DOKU_INC.'inc/parser/'.$this->mode.'.php', // ... the renderer
+ DOKU_INC.'inc/parser/'.$this->mode.'.php', // ... the renderer
);
- if (isset($this->page)) { $files[] = metaFN($this->page,'.meta'); } // ... the page's own metadata
+
+ // page implies metadata and possibly some other dependencies
+ if (isset($this->page)) {
+ $metafile = metaFN($this->page,'.meta');
+ if (@file_exists($metafile)) {
+ $files[] = $metafile; // ... the page's own metadata
+ $files[] = DOKU_INC.'inc/parser/metadata.php'; // ... the metadata renderer
+ } else {
+ $this->depends['purge'] = true; // ... purging cache will generate metadata
+ return;
+ }
+ }
$this->depends['files'] = !empty($this->depends['files']) ? array_merge($files, $this->depends['files']) : $files;
parent::_addDependencies();
diff --git a/inc/common.php b/inc/common.php
index 9a3cd6d8b..c2a6903ab 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -722,10 +722,8 @@ function saveWikiText($id,$text,$summary,$minor=false){
notify($id,'admin',$old,$summary,$minor);
notify($id,'subscribers',$old,$summary,$minor);
- //purge cache on add by updating the purgefile
- if($conf['purgeonadd'] && (!$old || $del)){
- io_saveFile($conf['cachedir'].'/purgefile',time());
- }
+ // update the purgefile (timestamp of the last time anything within the wiki was changed)
+ io_saveFile($conf['cachedir'].'/purgefile',time());
}
/**
diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php
index fea2d48f2..9704c0475 100644
--- a/inc/parser/metadata.php
+++ b/inc/parser/metadata.php
@@ -325,7 +325,15 @@ class Doku_Renderer_metadata extends Doku_Renderer {
if ($this->capture && $title) $this->doc .= '['.$title.']';
}
- function rss($url){}
+ function rss($url,$params) {
+ global $conf;
+
+ $this->meta['relation']['haspart'][$url] = true;
+ $this->meta['date']['valid']['end'] =
+ empty($this->meta['date']['valid']['end']) ?
+ time() + $conf['rss_update'] :
+ min($this->meta['date']['valid']['end'], time() + $conf['rss_update']);
+ }
function table_open($maxcols = NULL, $numrows = NULL){}
function table_close(){}
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index c805dae70..c56367f47 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -502,7 +502,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
}
//keep hash anchor
- list($id,$hash) = split('#',$id,2);
+ list($id,$hash) = explode('#',$id,2);
//prepare for formating
$link['target'] = $conf['target']['wiki'];
diff --git a/lib/plugins/config/lang/cs/lang.php b/lib/plugins/config/lang/cs/lang.php
index 82b06a452..937fc9dfa 100644
--- a/lib/plugins/config/lang/cs/lang.php
+++ b/lib/plugins/config/lang/cs/lang.php
@@ -102,7 +102,6 @@ $lang['canonical'] = 'Používat plně kanonická URL';
$lang['autoplural'] = 'Kontrolovat plurálové tvary v odkazech';
$lang['usegzip'] = 'Používat gzip pro archivní soubory';
$lang['cachetime'] = 'Maximální životnost cache (sekundy)';
-$lang['purgeonadd'] = 'Likvidovat cache, jakmile jsou přidány nové stránky';
$lang['locktime'] = 'Maximální životnost zámkových souborů (sekundy)';
$lang['notify'] = 'Posílat oznámení o změnách na následující emailovou adresu';
$lang['mailfrom'] = 'Emailová addresa, která se bude používat pro automatické maily';
diff --git a/lib/plugins/config/lang/da/lang.php b/lib/plugins/config/lang/da/lang.php
index 94feef1ab..303146ea5 100644
--- a/lib/plugins/config/lang/da/lang.php
+++ b/lib/plugins/config/lang/da/lang.php
@@ -104,7 +104,6 @@ $lang['canonical'] = 'Benyt fuldt kanoniske URLer';
$lang['autoplural'] = 'Check for flertalsendelser i links';
$lang['usegzip'] = 'Benyt gzip til attic filer';
$lang['cachetime'] = 'Maksimum levetid for cache (sek)';
-$lang['purgeonadd'] = 'Ryd cache når nye sider tilføjes';
$lang['locktime'] = 'Maksimum levetid for låsningsfiler (sek)';
$lang['fetchsize'] = 'Maksimum antal (bytes) fetch.php må downloade fra extern';
$lang['notify'] = 'Send ændringsnotifikationer til denne e-mailadresse';
diff --git a/lib/plugins/config/lang/de/lang.php b/lib/plugins/config/lang/de/lang.php
index 57372d396..f1f8b6548 100644
--- a/lib/plugins/config/lang/de/lang.php
+++ b/lib/plugins/config/lang/de/lang.php
@@ -97,7 +97,6 @@ $lang['canonical'] = 'Immer Links mit vollständigen URLs erzeugen';
$lang['autoplural'] = 'Bei Links automatisch nach vorhandenen Pluralformen suchen';
$lang['compression'] = 'Komprimierungsmethode für alte Seitenrevisionen';
$lang['cachetime'] = 'Maximale Cachespeicherung (Sek.)';
-$lang['purgeonadd'] = 'Seitencache leeren wenn eine neue Seite angelegt wurde';
$lang['locktime'] = 'Maximales Alter für Seitensperren (Sek.)';
$lang['fetchsize'] = 'Maximale Größe (bytes) die fetch.php von extern downloaden darf';
$lang['notify'] = 'Änderungsmitteilungen and diese E-Mail Adresse versenden';
diff --git a/lib/plugins/config/lang/el/lang.php b/lib/plugins/config/lang/el/lang.php
index 714378095..068a38fd2 100644
--- a/lib/plugins/config/lang/el/lang.php
+++ b/lib/plugins/config/lang/el/lang.php
@@ -60,7 +60,6 @@ $lang['proxy____pass'] = 'Κωδικός χρήστη Proxy';
$lang['proxy____port'] = 'Θύρα Proxy';
$lang['proxy____ssl'] = 'Χρήση ssl για σύνδεση με διακομιστή Proxy';
$lang['proxy____user'] = 'Όνομα χρήστη Proxy';
-$lang['purgeonadd'] = 'Διαγραφή cache κατα την προσθήκη νέων σελίδων';
$lang['recent'] = 'Αριθμός πρόσφατων αλλαγών ανά σελίδα';
$lang['refcheck'] = 'Πριν τη διαγραφή ενός αρχείου να ελέγχεται η ύπαρξη σελίδων που το χρησιμοποιούν';
$lang['refshow'] = 'Εμφανιζόμενος αριθμός σελίδων που χρησιμοποιούν ένα αρχείο';
diff --git a/lib/plugins/config/lang/en/lang.php b/lib/plugins/config/lang/en/lang.php
index db8c270b9..526ac4a0e 100644
--- a/lib/plugins/config/lang/en/lang.php
+++ b/lib/plugins/config/lang/en/lang.php
@@ -105,7 +105,6 @@ $lang['canonical'] = 'Use fully canonical URLs';
$lang['autoplural'] = 'Check for plural forms in links';
$lang['compression'] = 'Compression method for attic files';
$lang['cachetime'] = 'Maximum age for cache (sec)';
-$lang['purgeonadd'] = 'Purge cache when new pages are added';
$lang['locktime'] = 'Maximum age for lock files (sec)';
$lang['fetchsize'] = 'Maximum size (bytes) fetch.php may download from extern';
$lang['notify'] = 'Send change notifications to this email address';
diff --git a/lib/plugins/config/lang/es/lang.php b/lib/plugins/config/lang/es/lang.php
index 4b3f6d1fd..6a11997f4 100644
--- a/lib/plugins/config/lang/es/lang.php
+++ b/lib/plugins/config/lang/es/lang.php
@@ -106,7 +106,6 @@ $lang['canonical'] = 'Usar URLs totalmente canónicas';
$lang['autoplural'] = 'Controlar plurales en enlaces';
$lang['usegzip'] = 'Usar gzip para archivos del ático';
$lang['cachetime'] = 'Edad máxima para caché (segundos)';
-$lang['purgeonadd'] = 'Purgar el cache cuando se agregan nuevas páginas';
$lang['locktime'] = 'Edad máxima para archivos de lock (segundos)';
$lang['fetchsize'] = 'Tamañao máximo (bytes) que fetch.php puede descargar de sitios externos';
$lang['notify'] = 'Enviar notificación de cambios a esta dirección de correo electrónico';
diff --git a/lib/plugins/config/lang/fr/lang.php b/lib/plugins/config/lang/fr/lang.php
index 83bf7c817..e60cf0037 100644
--- a/lib/plugins/config/lang/fr/lang.php
+++ b/lib/plugins/config/lang/fr/lang.php
@@ -104,7 +104,6 @@ $lang['canonical'] = 'Utiliser des URLs canoniques';
$lang['autoplural'] = 'Rechercher les formes plurielles dans les liens';
$lang['usegzip'] = 'Utiliser gzip pour les fichiers dans attic';
$lang['cachetime'] = 'Âge maximum d\'un fichier en cache (sec)';
-$lang['purgeonadd'] = 'Purger le cache à l\'ajout de page';
$lang['locktime'] = 'Âge maximum des fichiers verrous (sec)';
$lang['fetchsize'] = 'Taille maximale (en octets) du fichier que fetch.php peut télécharger';
$lang['notify'] = 'Notifier les modifications à cette adresse de courriel';
diff --git a/lib/plugins/config/lang/it/lang.php b/lib/plugins/config/lang/it/lang.php
index 526af76d1..6c11c7538 100644
--- a/lib/plugins/config/lang/it/lang.php
+++ b/lib/plugins/config/lang/it/lang.php
@@ -107,7 +107,6 @@ $lang['canonical'] = 'Usa URL canoniche';
$lang['autoplural'] = 'Controlla il plurale nei collegamenti';
$lang['usegzip'] = 'Usa gzip (per l\'archivio)';
$lang['cachetime'] = 'Durata della cache (sec)';
-$lang['purgeonadd'] = 'Pulisci la cache quando si aggiungono nuove pagine';
$lang['locktime'] = 'Durata dei file di lock (sec)';
$lang['fetchsize'] = 'Dimensione massima (bytes) scaricabile da fetch.php da extern';
$lang['notify'] = 'Invia notifiche sulle modifiche a questo indirizzo';
diff --git a/lib/plugins/config/lang/ja/lang.php b/lib/plugins/config/lang/ja/lang.php
index cfa402302..ef764c75d 100644
--- a/lib/plugins/config/lang/ja/lang.php
+++ b/lib/plugins/config/lang/ja/lang.php
@@ -106,7 +106,6 @@ $lang['canonical'] = 'canonical URL(正準URL)を使用';
$lang['autoplural'] = '自動複数形処理';
$lang['compression'] = 'アーカイブファイルの圧縮方法';
$lang['cachetime'] = 'キャッシュ保持時間(秒)';
-$lang['purgeonadd'] = 'ファイル追加時にキャッシュを破棄';
$lang['locktime'] = 'ファイルロック期限(秒)';
$lang['fetchsize'] = '外部からのダウンロード最大サイズ';
$lang['notify'] = '変更を通知するメールアドレス';
diff --git a/lib/plugins/config/lang/pl/lang.php b/lib/plugins/config/lang/pl/lang.php
index 925ea659d..17e6a529c 100644
--- a/lib/plugins/config/lang/pl/lang.php
+++ b/lib/plugins/config/lang/pl/lang.php
@@ -105,7 +105,6 @@ $lang['canonical'] = 'Kanoniczne adresy URL';
$lang['autoplural'] = 'Automatyczne tworzenie liczby mnogiej';
$lang['usegzip'] = 'Kompresja gzip dla starych wersji';
$lang['cachetime'] = 'Maksymalny wiek cache w sekundach';
-$lang['purgeonadd'] = 'Czyść cache po dodaniu strony';
$lang['locktime'] = 'Maksymalny wiek blockad w sekundach';
$lang['notify'] = 'Wysyłanie powiadomień na adres e-mail';
$lang['registernotify'] = 'Prześlij informacje o nowych użytkownikach na adres e-mail';
diff --git a/lib/plugins/config/lang/ru/lang.php b/lib/plugins/config/lang/ru/lang.php
index 32bb72249..430e70155 100644
--- a/lib/plugins/config/lang/ru/lang.php
+++ b/lib/plugins/config/lang/ru/lang.php
@@ -101,7 +101,6 @@ $lang['canonical'] = 'Полные канонические адреса (URL)
$lang['autoplural'] = 'Автоматическое мн. число'; //try (non)plural form of nonexisting files?
$lang['usegzip'] = 'Использовать gzip (для истории правок)'; //gzip old revisions?
$lang['cachetime'] = 'Время жизни кэш-файла (сек.)'; //maximum age for cachefile in seconds (defaults to a day)
-$lang['purgeonadd'] = 'Обнулять кэш при создании страницы'; //purge cache when a new file is added (needed for up to date links)
$lang['locktime'] = 'Время блокировки страницы (сек.)'; //maximum age for lockfiles (defaults to 15 minutes)
$lang['notify'] = 'Е-мэйл для извещений'; //send change info to this email (leave blank for nobody)
$lang['mailfrom'] = 'Е-мэйл Вики (От:)'; //use this email when sending mails
diff --git a/lib/plugins/config/lang/uk/lang.php b/lib/plugins/config/lang/uk/lang.php
index 687563099..43241a458 100644
--- a/lib/plugins/config/lang/uk/lang.php
+++ b/lib/plugins/config/lang/uk/lang.php
@@ -107,7 +107,6 @@ $lang['canonical'] = 'Каноничні URL';
$lang['autoplural'] = 'Перевіряти множину у посиланнях';
$lang['usegzip'] = 'Використовувати gzip (для горища)';
$lang['cachetime'] = 'Максимальний від для кеша (сек)';
-$lang['purgeonadd'] = 'Очищувати кеш при доданні нових сторінок';
$lang['locktime'] = 'Час блокування (сек)';
$lang['fetchsize'] = 'Максимальний розмір (в байтах), що fetch.php може завантажувати з зовні';
$lang['notify'] = 'Email для сповіщень';
diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php
index 09d3736f3..697ae77bf 100644
--- a/lib/plugins/config/settings/config.metadata.php
+++ b/lib/plugins/config/settings/config.metadata.php
@@ -129,7 +129,6 @@ $meta['htmlok'] = array('onoff');
$meta['phpok'] = array('onoff');
$meta['notify'] = array('email');
$meta['subscribers'] = array('onoff');
-$meta['purgeonadd'] = array('onoff');
$meta['locktime'] = array('numeric');
$meta['cachetime'] = array('numeric');