Skip to content

Commit

Permalink
Use Horde_Db's BLOB/CLOB features (Bug #14262).
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Feb 19, 2016
1 parent 53a4e7c commit c1c6b69
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 12 deletions.
52 changes: 41 additions & 11 deletions ingo/lib/Storage/Sql.php
Expand Up @@ -108,14 +108,22 @@ protected function _loadFromBackend()

try {
$data = $this->_params['db']->selectOne($query, $values);
$columns = $this->_params['db']->columns(
$this->_params['table_forwards']
);
} catch (Horde_Db_Exception $e) {
throw new Ingo_Exception($e);
}

if (empty($data)) {
$disable = true;
} else {
$ob->addresses = explode("\n", $data['forward_addresses']);
$ob->addresses = explode(
"\n",
$columns['forward_addresses']->binaryToString(
$data['forward_addresses']
)
);
$ob->keep = $data['forward_keep'];
}
break;
Expand Down Expand Up @@ -150,20 +158,35 @@ protected function _loadFromBackend()

try {
$data = $this->_params['db']->selectOne($query, $values);
$columns = $this->_params['db']->columns(
$this->_params['table_vacations']
);
} catch (Horde_Db_Exception $e) {
throw new Ingo_Exception($e);
}

if (empty($data)) {
$disable = true;
} else {
$ob->addresses = explode("\n", $data['vacation_addresses']);
$ob->addresses = explode(
"\n",
$columns['vacation_addresses']->binaryToString(
$data['vacation_addresses']
)
);
$ob->days = $data['vacation_days'];
$ob->end = $data['vacation_end'];
$ob->exclude = explode("\n", $data['vacation_excludes']);
$ob->exclude = explode(
"\n",
$columns['vacation_excludes']->binaryToString(
$data['vacation_excludes']
)
);
$ob->ignore_list = $data['vacation_ignorelists'];
$ob->reason = Horde_String::convertCharset(
$data['vacation_reason'],
$columns['vacation_reason']->binaryToString(
$data['vacation_reason']
),
$this->_params['charset'],
'UTF-8'
);
Expand Down Expand Up @@ -195,11 +218,16 @@ protected function _loadFromBackend()
break;

default:
$columns = $this->_db->columns($this->_params['table_rules']);
$ob->combine = intval($row['rule_combine']);
$ob->conditions = empty($row['rule_conditions'])
? null :
Horde_String::convertCharset(
unserialize($row['rule_conditions']),
unserialize(
$columns['rule_conditions']->binaryToString(
$row['rule_conditions']
)
),
$this->_params['charset'],
'UTF-8'
);
Expand Down Expand Up @@ -286,7 +314,7 @@ protected function _storeBackend($action, $rule)
$d['action'],
$d['value'],
$d['flags'],
$d['conditions'],
new Horde_Db_Value_Text($d['conditions']),
$d['combine'],
$d['stop'],
$d['active'],
Expand Down Expand Up @@ -416,7 +444,9 @@ protected function _storeBackend($action, $rule)

case 'Ingo_Rule_System_Forward':
$values = array(
implode("\n", $rule->addresses),
new Horde_Db_Value_Text(
implode("\n", $rule->addresses)
),
intval($rule->keep),
Ingo::getUser()
);
Expand Down Expand Up @@ -472,21 +502,21 @@ protected function _storeBackend($action, $rule)

case 'Ingo_Rule_System_Vacation':
$values = array(
implode("\n", $rule->addresses),
new Horde_Db_Value_Text(implode("\n", $rule->addresses)),
Horde_String::convertCharset(
$rule->subject,
'UTF-8',
$this->_params['charset']
),
Horde_String::convertCharset(
new Horde_Db_Value_Text(Horde_String::convertCharset(
$rule->reason,
'UTF-8',
$this->_params['charset']
),
)),
$rule->days,
$rule->start,
$rule->end,
implode("\n", $rule->exclude),
new Horde_Db_Value_Text(implode("\n", $rule->exclude)),
intval($rule->ignore_list),
Ingo::getUser()
);
Expand Down
15 changes: 14 additions & 1 deletion ingo/package.xml
Expand Up @@ -1643,7 +1643,7 @@
<stability>
<release>stable</release>
<api>stable</api></stability>
<date>2015-10-20</date>
<date>2016-02-02</date>
<license uri="http://www.horde.org/licenses/apache">ASL</license>
<notes>
* [jan] Fix editing shared rulesets (Bug #12694).
Expand All @@ -1654,6 +1654,19 @@
* [mjr] Fix invalid URLs in certain forms when cookies are disabled (Bug #14148).
</notes>
</release>
<release>
<version>
<release>3.2.9</release>
<api>3.2.0</api></version>
<stability>
<release>stable</release>
<api>stable</api></stability>
<date>2016-02-02</date>
<license uri="http://www.horde.org/licenses/apache">ASL</license>
<notes>
* [jan] Fix Oracle compatibility (Bug #14262).
</notes>
</release>
<release>
<date>2016-01-13</date>
<version>
Expand Down

0 comments on commit c1c6b69

Please sign in to comment.