Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
93078df174 | ||
|
e263eb3f0b |
|
@ -493,11 +493,20 @@ class database
|
|||
/**
|
||||
* Count
|
||||
*
|
||||
* @throws exception_runtime If the database is corrupted (counting result is float)
|
||||
*
|
||||
* @return int Amount of records
|
||||
*/
|
||||
public function count(): int{
|
||||
// Exit (success)
|
||||
return $this->length > 0 && file_exists($this->database) ? filesize($this->database) / $this->length : 0;
|
||||
public function count(): int
|
||||
{
|
||||
// Deleting the database file cache
|
||||
clearstatcache(true, $this->database);
|
||||
|
||||
// Counting
|
||||
$amount = $this->length > 0 && file_exists($this->database) ? filesize($this->database) / $this->length : 0;
|
||||
|
||||
// Exit (success/fail)
|
||||
return is_int($amount) ? $amount : throw new exception_runtime('The database is corrupted');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue