changed entry_cached_index, direct subclass... cache_filelister now probably useless; muted prev/next page for single; "last-entries" still broken; categories not tested yet

This commit is contained in:
real_nowhereman 2008-09-08 08:25:20 +00:00
parent 522d3616b8
commit 5572be3b3c
5 changed files with 43 additions and 13 deletions

View File

@ -94,6 +94,7 @@
define('LANG_DEFAULT', 'en-us');
define('BPT_SORT', SORT_DESC);
set_include_path(ABS_PATH);

View File

@ -1,14 +1,32 @@
<?php
class entry_cached_index extends cache_filelister {
class entry_cached_index extends caching_SBPT { #cache_filelister {
var $position = 0;
var $nodesize = 30;
var $keylen = 12;
/**
* opens the index belonging to a given category
* @params int $id_cat
*/
function entry_cached_index($id_cat=0) {
$this->_cachefile = INDEX_DIR.'index-'.$id_cat;
parent::cache_filelister();
$F = INDEX_DIR.'index-'.$id_cat.'.dat';
if (!file_exists($F)) {
trigger_error ("Can't find index '{$F}'", E_USER_ERROR);
}
parent::caching_SBPT(
fopen($F, 'rb'),
fopen(INDEX_DIR.'index.strings.dat', 'rb'),
256,
$this->position,
$this->nodesize,
$this->keylen
);
$this->open();
}
}

View File

@ -179,10 +179,15 @@
$qp =& $this->params;
if (!isset($entry_index[$qp->id])){
$key = entry_idtokey($qp->id);
if (!($entry_index->has_key($key))){
trigger_error("FPDB: no entry found for {$qp->id}", E_USER_WARNING);
return;
}
$this->walker =& $entry_index->walker($key, true);
/*
if ($this->counter < 0) {
$idlist = array_keys($entry_index);
@ -198,6 +203,11 @@
}
$this->pointer = $qp->start;
*/
$qp->start = 0;
$qp->count = 1;
$this->pointer = 0;
}
@ -345,8 +355,6 @@
$cont['comments'] = $this->comments->getCount();
/* index is updated with full-parsed entry */
#$this->local_index[$id] = $cont;
}
} else {
@ -427,6 +435,7 @@
function getNextPage() {
if ($this->single){
return false;
$id = $this->_getOffsetId(1, $this->params->start);
if ($id)
@ -450,6 +459,8 @@
function getPrevPage() {
if ($this->single) {
return false;
$id = $this->_getOffsetId(-1, $this->params->start);
if ($id)

View File

@ -22,6 +22,7 @@
require_once INCLUDES_DIR.'core.fileio.php';
require_once INCLUDES_DIR.'core.cache.php';
require_once INCLUDES_DIR.'core.blogdb.php';
require_once INCLUDES_DIR.'core.bplustree.class.php';
require_once INCLUDES_DIR.'core.administration.php';
@ -33,7 +34,6 @@
require_once INCLUDES_DIR.'core.static.php';
require_once INCLUDES_DIR.'core.draft.php';
require_once INCLUDES_DIR.'core.bplustree.class.php';
require_once INCLUDES_DIR.'core.fpdb.class.php';
require_once INCLUDES_DIR.'core.language.php';

View File

@ -184,7 +184,7 @@
$fpdb->query($params);
$q =& $fpdb->getQuery();
list($id, $e) = @$q->peekEntry();
list($id, $e) = $q->peekEntry();
/* no entry found : 404 */