From: Michael J. Rubinsky Date: Mon, 28 Jun 2010 22:56:25 +0000 (-0400) Subject: Jonah_Driver will only be dealing with internal channels, simplify. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=e2f4bc6f60a2b96f50e4e8671e3036dcc17c8624;p=horde.git Jonah_Driver will only be dealing with internal channels, simplify. Remove the type parameter, use Jonah_Exception etc... --- diff --git a/jonah/lib/Driver/Sql.php b/jonah/lib/Driver/Sql.php index 273d1f4d3..71338d5c7 100644 --- a/jonah/lib/Driver/Sql.php +++ b/jonah/lib/Driver/Sql.php @@ -115,38 +115,23 @@ class Jonah_Driver_Sql extends Jonah_Driver /** * Get a list of stored channels. * - * @param integer $type The type of channel to filter for. Possible - * values are either JONAH_INTERNAL_CHANNEL - * to fetch only a list of internal channels, - * or JONAH_EXTERNAL_CHANNEL for only external. - * If null both channel types are returned. - * * @return mixed An array of channels or PEAR_Error on error. + * @throws Jonah_Exception */ - public function getChannels($type = null) + public function getChannels() { if (is_a(($result = $this->_connect()), 'PEAR_Error')) { - return $result; - } - - $wsql = ''; - if (!is_null($type)) { - if (!is_array($type)) { - $type = array($type); - } - for ($i = 0, $i_max = count($type); $i < $i_max; ++$i) { - $type[$i] = 'channel_type = ' . (int)$type[$i]; - } - $wsql = 'WHERE ' . implode(' OR ', $type); + throw new Jonah_Exception($result); } - $sql = sprintf('SELECT channel_id, channel_name, channel_type, channel_updated FROM jonah_channels %s ORDER BY channel_name', $wsql); - + // @TODO: Remove the channel_type clause when we get rid of external channels + $wsql = 'WHERE channel_type = ' . Jonah::INTERNAL_CHANNEL; + $sql = sprintf('SELECT channel_id, channel_name, channel_type, channel_updated FROM jonah_channels WHERE channel_type = ' . Jonah::INTERNAL_CHANNEL . ' ORDER BY channel_name', $wsql); Horde::logMessage('SQL Query by Jonah_Driver_sql::getChannels(): ' . $sql, 'DEBUG'); $result = $this->_db->getAll($sql, DB_FETCHMODE_ASSOC); if (is_a($result, 'PEAR_Error')) { Horde::logMessage($result, 'ERR'); - return $result; + throw new Jonah_Exception($result); } for ($i = 0; $i < count($result); $i++) { $result[$i]['channel_name'] = Horde_String::convertCharset($result[$i]['channel_name'], $this->_params['charset']);