Skip to content

Commit e4f5781

Browse files
committed
fix db quota messages
1 parent e8f8b1f commit e4f5781

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

server/lib/classes/cron.d/100-monitor_database_size.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ public function onRunJob() {
9595
if(!is_numeric($quota)) continue;
9696

9797
if($quota < 1 || $quota > $data[$i]['size']) {
98-
print $rec['database_name'] . ' does not exceed quota qize: ' . $quota . ' > ' . $data[$i]['size'] . "\n";
98+
print 'database ' . $rec['database_name'] . ' size does not exceed quota: ' . $quota . ' (quota) > ' . $data[$i]['size'] . " (used)\n";
9999
if($rec['quota_exceeded'] == 'y') {
100100
$app->dbmaster->datalogUpdate('web_database', array('quota_exceeded' => 'n'), 'database_id', $rec['database_id']);
101101
}
102102
} elseif($rec['quota_exceeded'] == 'n') {
103-
print $rec['database_name'] . ' exceeds quota qize: ' . $quota . ' < ' . $data[$i]['size'] . "\n";
103+
print 'database ' . $rec['database_name'] . ' size exceeds quota: ' . $quota . ' (quota) < ' . $data[$i]['size'] . " (used)\n";
104104
$app->dbmaster->datalogUpdate('web_database', array('quota_exceeded' => 'y'), 'database_id', $rec['database_id']);
105105
}
106106
}

server/lib/classes/db_mysql.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,12 +634,12 @@ public function getDatabaseSize($database_name) {
634634

635635
$result = $this->_query("SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".$this->escape($database_name)."'");
636636
if(!$result) {
637-
$this->_sqlerror('Unable to get the database-size for ' . $database_name);
637+
$this->_sqlerror('Unable to determine the size of database ' . $database_name);
638638
return;
639639
}
640640
$database_size = $result->getAsRow();
641641
$result->free();
642-
return $database_size[0];
642+
return $database_size[0] ? $database_size[0] : 0;
643643
}
644644

645645
//** Function to fill the datalog with a full differential record.

0 commit comments

Comments
 (0)