Permalink
Browse files

fixed getTotalSpace of dba adapter

  • Loading branch information...
1 parent a72007a commit 043a4ac2b4eec901e56e21d7822a409b5b2ebb03 @marc-mabe marc-mabe committed with weierophinney Oct 4, 2012
Showing with 5 additions and 4 deletions.
  1. +5 −4 library/Zend/Cache/Storage/Adapter/Dba.php
@@ -117,19 +117,20 @@ public function getOptions()
*/
public function getTotalSpace()
{
- if ($this->totalSpace !== null) {
+ if ($this->totalSpace === null) {
$pathname = $this->getOptions()->getPathname();
if ($pathname === '') {
throw new Exception\LogicException('No pathname to database file');
}
ErrorHandler::start();
- $total = disk_total_space($pathname);
+ $total = disk_total_space(dirname($pathname));
$error = ErrorHandler::stop();
if ($total === false) {
throw new Exception\RuntimeException("Can't detect total space of '{$pathname}'", 0, $error);
}
+ $this->totalSpace = $total;
// clean total space buffer on change pathname
$events = $this->getEventManager();
@@ -142,7 +143,7 @@ public function getTotalSpace()
$events->detach($handle);
}
};
- $handle = $events->attach($callback);
+ $handle = $events->attach('option', $callback);
}
return $this->totalSpace;
@@ -164,7 +165,7 @@ public function getAvailableSpace()
}
ErrorHandler::start();
- $avail = disk_free_space($pathname);
+ $avail = disk_free_space(dirname($pathname));
$error = ErrorHandler::stop();
if ($avail === false) {
throw new Exception\RuntimeException("Can't detect free space of '{$pathname}'", 0, $error);

0 comments on commit 043a4ac

Please sign in to comment.