public function cleanup()
{
$keysToDelete = $this->db->fetchCol("SELECT `key` FROM " . static::getTableName() . " as tbl1 WHERE\n (SELECT count(*) FROM " . static::getTableName() . " WHERE `key` = tbl1.`key` AND (`text` IS NULL OR `text` = ''))\n = (SELECT count(*) FROM " . static::getTableName() . " WHERE `key` = tbl1.`key`) GROUP BY `key`;");
if (is_array($keysToDelete) && !empty($keysToDelete)) {
$preparedKeys = [];
foreach ($keysToDelete as $value) {
if (strpos($value, ":") === false) {
// colon causes problems due to a ZF bug, so we exclude them
$preparedKeys[] = $this->db->quote($value);
}
}
if (!empty($preparedKeys)) {
$this->db->delete(static::getTableName(), "`key` IN (" . implode(",", $preparedKeys) . ")");
}
}
}