diff options
author | Ben Coburn <btcoburn@silicodon.net> | 2006-08-30 20:27:53 +0200 |
---|---|---|
committer | Ben Coburn <btcoburn@silicodon.net> | 2006-08-30 20:27:53 +0200 |
commit | 71726d7801bdcbf41dfdc79d244f09a0988529c0 (patch) | |
tree | 4923946228e6b3cd26107aa310a877ad5bc948a9 /inc/init.php | |
parent | 19a3223378923679493484987e6719c16b5f5997 (diff) | |
download | rpg-71726d7801bdcbf41dfdc79d244f09a0988529c0.tar.gz rpg-71726d7801bdcbf41dfdc79d244f09a0988529c0.tar.bz2 |
scalable changelog redesign
This patch provides a rewritten changelog system that is designed to run
efficiently on both small and large wikis. The patch includes a plugin to
convert changelogs from the current format. The conversion is
non-destructive and happens automatically. For more information on the new
changelog format see "http://wiki.splitbrain.org/wiki:changelog".
Structure
In short the changelog is now stored in per-page changelog files, with a
recent changes cache. The recent changes cache is kept in
"/data/meta/_dokuwiki.changes" and trimmed daily. The per-page changelogs
are kept in "/data/meta/<ns>/<page_id>.changes" files. To preserve
revision information for revisions stored in the attic, the "*.changes"
files are not removed when their page is deleted. This allows the full
life-cycle of page creation, deletion, and reversion to be tracked.
Format
The changelog line format now uses a general "line type" field in place of
the special "minor" change syntax. There is also an extra field that can
be used to store arbitrary data associated with special line types. The
reverted line type (R) is a good example. There the extra field holds the
revision date used as the source for reverting the page. See the wiki for
the complete syntax description.
Code Notes
The changelog functions have been rewritten to load the whole file only if
it is small. For larger files, the function loads only the relevant
chunk(s). Parsed changelog lines are cached in memory to speed future
function calls.
getRevisionInfo
A binary search is used to locate the chunk expected to contain the
requested revision. The whole chunk is parsed, and adjacent lines are
optimistically cached to speed consecutive calls.
getRevisions
Reads the changelog file backwards (newest first) in chunks until the
requested number of lines have been read. Parsed changelog lines are
cached for subsequent calls to getRevisionInfo. Because revisions are read
from the changelog they are no longer guaranteed to exist in the attic.
(Note: Even with lines of arbitrary length getRevisionInfo and
getRevisions never split changelog lines while reading. This is done by
sliding the "file pointer" forward to the end of a line after each blind
seek.)
isMinor
Removed. To detect a minor edit check the type as follows:
$parsed_logline['type']
darcs-hash:20060830182753-05dcb-1c5ea17f581197a33732a8d11da223d809c03506.gz
Diffstat (limited to 'inc/init.php')
-rw-r--r-- | inc/init.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/inc/init.php b/inc/init.php index 01d2f7469..bfa22e001 100644 --- a/inc/init.php +++ b/inc/init.php @@ -24,8 +24,8 @@ else { error_reporting(DOKU_E_LEVEL); } // init memory caches - global $cache_wikifn; $cache_wikifn = array(); - global $cache_wikifn; $cache_cleanid = array(); + $cache_wikifn = array(); + $cache_cleanid = array(); //prepare config array() global $conf; @@ -128,8 +128,7 @@ function init_paths(){ 'mediadir' => 'media', 'metadir' => 'meta', 'cachedir' => 'cache', - 'lockdir' => 'locks', - 'changelog' => 'changes.log'); + 'lockdir' => 'locks'); foreach($paths as $c => $p){ if(!$conf[$c]) $conf[$c] = $conf['savedir'].'/'.$p; @@ -139,6 +138,12 @@ function init_paths(){ Or maybe you want to <a href=\"install.php\">run the installer</a>?"); } + + // path to old changelog only needed for upgrading + $conf['changelog_old'] = init_path((isset($conf['changelog']))?($conf['changelog']):($conf['savedir'].'/changes.log')); + if ($conf['changelog_old']=='') { unset($conf['changelog_old']); } + // hardcoded changelog because it is now a cache that lives in meta + $conf['changelog'] = $conf['metadir'].'/_dokuwiki.changes'; } /** |