Skip to content

Commit

Permalink
This variable is only used in one class (and not even where it is def…
Browse files Browse the repository at this point in the history
…ined)
  • Loading branch information
slusarz committed Feb 9, 2015
1 parent 682b484 commit f74ab0c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 37 deletions.
27 changes: 0 additions & 27 deletions ingo/lib/Storage/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ class Ingo_Storage_Rule
*/
protected $_obtype;

/**
* Whether the rule has been saved (if being saved separately).
*
* @var boolean
*/
protected $_saved = false;

/**
* Returns the object rule type.
*
Expand All @@ -46,26 +39,6 @@ public function obType()
return $this->_obtype;
}

/**
* Marks the rule as saved or unsaved.
*
* @param boolean $data Whether the rule has been saved.
*/
public function setSaved($data)
{
$this->_saved = $data;
}

/**
* Returns whether the rule has been saved.
*
* @return boolean True if the rule has been saved.
*/
public function isSaved()
{
return $this->_saved;
}

/**
* Function to manage an internal address list.
*
Expand Down
27 changes: 17 additions & 10 deletions ingo/lib/Storage/Sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
*/
class Ingo_Storage_Sql extends Ingo_Storage
{
/**
* Whether the rule has been saved (if being saved separately).
*
* @var boolean
*/
protected $_saved = false;

/**
* Retrieves the specified data from the storage backend.
*
Expand Down Expand Up @@ -87,7 +94,7 @@ protected function _retrieve($field, $readonly = false)
if (!empty($data)) {
$ob->setForwardAddresses(explode("\n", $data['forward_addresses']));
$ob->setForwardKeep((bool)$data['forward_keep']);
$ob->setSaved(true);
$this->_saved = true;
} elseif ($data = @unserialize($GLOBALS['prefs']->getDefault('forward'))) {
$ob->setForwardAddresses($data['a']);
$ob->setForwardKeep($data['k']);
Expand All @@ -113,7 +120,7 @@ protected function _retrieve($field, $readonly = false)
$ob->setVacationIgnorelist((bool)$data['vacation_ignorelists']);
$ob->setVacationReason(Horde_String::convertCharset($data['vacation_reason'], $this->_params['charset'], 'UTF-8'));
$ob->setVacationSubject(Horde_String::convertCharset($data['vacation_subject'], $this->_params['charset'], 'UTF-8'));
$ob->setSaved(true);
$this->_saved = true;
} elseif ($data = @unserialize($GLOBALS['prefs']->getDefault('vacation'))) {
$ob->setVacationAddresses($data['addresses'], false);
$ob->setVacationDays($data['days']);
Expand Down Expand Up @@ -143,7 +150,7 @@ protected function _retrieve($field, $readonly = false)
if (!empty($data)) {
$ob->setSpamFolder($data['spam_folder']);
$ob->setSpamLevel((int)$data['spam_level']);
$ob->setSaved(true);
$this->_saved = true;
} elseif ($data = @unserialize($GLOBALS['prefs']->getDefault('spam'))) {
$ob->setSpamFolder($data['folder']);
$ob->setSpamLevel($data['level']);
Expand Down Expand Up @@ -207,7 +214,7 @@ protected function _store($ob)
throw new Ingo_Exception($e);
}
}
$ob->setSaved(true);
$this->_saved = true;
break;

case self::ACTION_FORWARD:
Expand All @@ -216,7 +223,7 @@ protected function _store($ob)
(int)(bool)$ob->getForwardKeep(),
Ingo::getUser());
try {
if ($ob->isSaved()) {
if ($this->_saved) {
$query = sprintf('UPDATE %s SET forward_addresses = ?, forward_keep = ? WHERE forward_owner = ?', $this->_params['table_forwards']);
$this->_params['db']->update($query, $values);
} else {
Expand All @@ -226,7 +233,7 @@ protected function _store($ob)
} catch (Horde_Db_Exception $e) {
throw new Ingo_Exception($e);
}
$ob->setSaved(true);
$this->_saved = true;
break;

case self::ACTION_VACATION:
Expand All @@ -246,7 +253,7 @@ protected function _store($ob)
Ingo::getUser()
);
try {
if ($ob->isSaved()) {
if ($this->_saved) {
$query = sprintf('UPDATE %s SET vacation_addresses = ?, vacation_subject = ?, vacation_reason = ?, vacation_days = ?, vacation_start = ?, vacation_end = ?, vacation_excludes = ?, vacation_ignorelists = ? WHERE vacation_owner = ?', $this->_params['table_vacations']);
$this->_params['db']->update($query, $values);
} else {
Expand All @@ -256,7 +263,7 @@ protected function _store($ob)
} catch (Horde_Db_Exception $e) {
throw new Ingo_Exception($e);
}
$ob->setSaved(true);
$this->_saved = true;
break;

case self::ACTION_SPAM:
Expand All @@ -265,7 +272,7 @@ protected function _store($ob)
$ob->getSpamFolder(),
Ingo::getUser());
try {
if ($ob->isSaved()) {
if ($this->_saved) {
$query = sprintf('UPDATE %s SET spam_level = ?, spam_folder = ? WHERE spam_owner = ?', $this->_params['table_spam']);
$this->_params['db']->update($query, $values);
} else {
Expand All @@ -275,7 +282,7 @@ protected function _store($ob)
} catch (Horde_Db_Exception $e) {
throw new Ingo_Exception($e);
}
$ob->setSaved(true);
$this->_saved = true;
break;
}
}
Expand Down

0 comments on commit f74ab0c

Please sign in to comment.