| @@ -187,9 +187,18 @@ | ||
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | public function readIndexes($key) |
| 190 | 190 | { |
| 191 | - return $this->hasIndexed($key); | |
| 191 | + if (!$this->hasIndexed($key)) { | |
| 192 | + return false; | |
| 193 | + } | |
| 194 | + | |
| 195 | + // Treat a zero-record index as missing so it can be rebuilt | |
| 196 | + if (!isset($this->config['count'][$key]) || intval($this->config['count'][$key]) < 1) { | |
| 197 | + return false; | |
| 198 | + } | |
| 199 | + | |
| 200 | + return true; | |
| 192 | 201 | } |
| 193 | 202 | |
| 194 | 203 | public function storeIndexes($key, $buffer = false) |
| 195 | 204 | { |
| @@ -233,9 +242,13 @@ | ||
| 233 | 242 | } |
| 234 | 243 | |
| 235 | 244 | public function getRecordCount($key) |
| 236 | 245 | { |
| 237 | - return $this->config['count'][$key]; | |
| 246 | + if (!isset($this->config['count'][$key])) { | |
| 247 | + return 0; | |
| 248 | + } | |
| 249 | + | |
| 250 | + return intval($this->config['count'][$key]); | |
| 238 | 251 | } |
| 239 | 252 | |
| 240 | 253 | public function getIndexFile($key) |
| 241 | 254 | { |