suppressing "file not found" errors for indices, fall back to 404 error; correctly return seek position when inserting into SBPlusTrees
This commit is contained in:
parent
13dc0b6cb4
commit
29a9e6bbd1
@ -2537,6 +2537,7 @@ class SBPlusTree extends BPlusTree {
|
|||||||
function setitem($key, $val) {
|
function setitem($key, $val) {
|
||||||
$seek = $this->setstring($val);
|
$seek = $this->setstring($val);
|
||||||
parent::setitem($key, $seek);
|
parent::setitem($key, $seek);
|
||||||
|
return $seek;
|
||||||
}
|
}
|
||||||
|
|
||||||
function walker(
|
function walker(
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
var $nodesize = 30;
|
var $nodesize = 30;
|
||||||
var $keylen = 12;
|
var $keylen = 12;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* opens the index belonging to a given category
|
* opens the index belonging to a given category
|
||||||
* @params int $id_cat
|
* @params int $id_cat
|
||||||
@ -15,6 +16,7 @@
|
|||||||
|
|
||||||
if (!file_exists($F)) {
|
if (!file_exists($F)) {
|
||||||
trigger_error ("Can't find index '{$F}'", E_USER_ERROR);
|
trigger_error ("Can't find index '{$F}'", E_USER_ERROR);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::caching_SBPT(
|
parent::caching_SBPT(
|
||||||
@ -121,8 +123,8 @@
|
|||||||
$main =& $this->get_index();
|
$main =& $this->get_index();
|
||||||
$main->delitem($key);
|
$main->delitem($key);
|
||||||
|
|
||||||
if (isset($entry['categories']) && is_array($entry['categories'])) {
|
if (isset($entry['CATEGORIES']) && is_array($entry['CATEGORIES'])) {
|
||||||
foreach ($entry['categories'] as $cat) {
|
foreach ($entry['CATEGORIES'] as $cat) {
|
||||||
if (!is_numeric($cat)) continue;
|
if (!is_numeric($cat)) continue;
|
||||||
$this_index =& $this->get_index($cat);
|
$this_index =& $this->get_index($cat);
|
||||||
$this_index->delitem($key);
|
$this_index->delitem($key);
|
||||||
@ -323,6 +325,21 @@
|
|||||||
return $entry_index;
|
return $entry_index;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function &entry_cached_index($id_cat) {
|
||||||
|
|
||||||
|
$F = INDEX_DIR.'index-'.$id_cat.'.dat';
|
||||||
|
|
||||||
|
if (!file_exists($F)) {
|
||||||
|
$o = false;
|
||||||
|
} else {
|
||||||
|
$o =& new entry_cached_index($id_cat);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
function entry_query($params=array()){
|
function entry_query($params=array()){
|
||||||
|
@ -163,6 +163,15 @@
|
|||||||
$fpdb->init();
|
$fpdb->init();
|
||||||
|
|
||||||
$entry_index =& $fpdb->get_index($this->params->category);
|
$entry_index =& $fpdb->get_index($this->params->category);
|
||||||
|
|
||||||
|
$this->counter++;
|
||||||
|
|
||||||
|
if (!$entry_index) {
|
||||||
|
$this->params->start = 0;
|
||||||
|
$this->params->count = 0;
|
||||||
|
$this->pointer = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->single) {
|
if ($this->single) {
|
||||||
$this->_prepare_single($entry_index);
|
$this->_prepare_single($entry_index);
|
||||||
@ -173,7 +182,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->counter++;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -324,7 +332,12 @@
|
|||||||
function &peekEntry() {
|
function &peekEntry() {
|
||||||
|
|
||||||
global $post;
|
global $post;
|
||||||
|
|
||||||
|
if (!$this->hasMore()) {
|
||||||
|
$false = array(false, false);
|
||||||
|
return $false;
|
||||||
|
}
|
||||||
|
|
||||||
$qp =& $this->params;
|
$qp =& $this->params;
|
||||||
|
|
||||||
|
|
||||||
@ -368,7 +381,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$cont) {
|
if (!$cont) {
|
||||||
return false;
|
$cont = false;
|
||||||
|
return $cont;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($qp->comments) {
|
if ($qp->comments) {
|
||||||
@ -563,7 +577,7 @@
|
|||||||
|
|
||||||
function &get_index($cat_id = 0) {
|
function &get_index($cat_id = 0) {
|
||||||
if (!isset($this->_indexer[$cat_id])) {
|
if (!isset($this->_indexer[$cat_id])) {
|
||||||
$this->_indexer[$cat_id] =& new entry_cached_index($cat_id);
|
$this->_indexer[$cat_id] =& entry_cached_index($cat_id);
|
||||||
}
|
}
|
||||||
return $this->_indexer[$cat_id];
|
return $this->_indexer[$cat_id];
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
if(check_write(SETUPTEMP_FILE, 2)) {
|
if(check_write(SETUPTEMP_FILE, 2)) {
|
||||||
|
|
||||||
$r = fs_mkdir(CACHE_DIR);
|
$r = fs_mkdir(CACHE_DIR);
|
||||||
|
|
||||||
|
$r &= fs_mkdir(INDEX_DIR);
|
||||||
|
|
||||||
$r &= fs_copy(CONFIG_DEFAULT, CONFIG_FILE);
|
$r &= fs_copy(CONFIG_DEFAULT, CONFIG_FILE);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user