/** * update user in dbmail db * * @param array $userData * @param mixed $where */ protected function _update($userData, $where) { if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) { Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . " Update user {$userData[$this->_propertyMapping['emailUsername']]} in {$this->_userTable}"); } if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) { Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . " " . print_r($userData, TRUE)); } $this->_db->update($this->_userTable, $userData, $where); }
/** * updates email properties for an existing user * * @param Tinebase_Model_FullUser $_updatedUser * @param Tinebase_Model_FullUser $_newUserProperties */ protected function _updateUser(Tinebase_Model_FullUser $_updatedUser, Tinebase_Model_FullUser $_newUserProperties) { $imapSettings = $this->_recordToRawData($_updatedUser, $_newUserProperties); if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) { Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Updating Dbmail user ' . $imapSettings[$this->_propertyMapping['emailUsername']]); } if ($this->_hasTine20Userid === true) { $where = array($this->_db->quoteInto($this->_db->quoteIdentifier($this->_propertyMapping['emailUserId']) . ' = ?', $_updatedUser->getId()), $this->_db->quoteInto($this->_db->quoteIdentifier($this->_propertyMapping['emailGID']) . ' = ?', $this->_config['emailGID'])); } else { $where = array($this->_db->quoteInto($this->_db->quoteIdentifier($this->_propertyMapping['emailUserId']) . ' = ?', $this->_convertToInt($_updatedUser->getId())), $this->_db->quoteInto($this->_db->quoteIdentifier($this->_propertyMapping['emailGID']) . ' = ?', $this->_convertToInt($this->_config['emailGID']))); } unset($imapSettings[$this->_propertyMapping['emailMailSize']]); unset($imapSettings[$this->_propertyMapping['emailSieveSize']]); unset($imapSettings[$this->_propertyMapping['emailLastLogin']]); unset($imapSettings[$this->_propertyMapping['emailUserId']]); $this->_db->update($this->_userTable, $imapSettings, $where); $this->inspectGetUserByProperty($_updatedUser); }
/** * Updates existing rows. * * Columns must be in underscore format. * * @param array $data Column-value pairs. * @param string $where An SQL WHERE clause. * @return int The number of rows updated. */ public function update(&$data, $where) { return $this->_db->update($this->_name, $data, $where); }
/** * updates email properties for an existing user * * @param Tinebase_Model_FullUser $_updatedUser * @param Tinebase_Model_FullUser $_newUserProperties */ protected function _updateUser(Tinebase_Model_FullUser $_updatedUser, Tinebase_Model_FullUser $_newUserProperties) { $imapSettings = $this->_recordToRawData($_updatedUser, $_newUserProperties); if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) { Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Updating Dovecot user ' . $imapSettings[$this->_propertyMapping['emailUsername']]); } #if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($imapSettings, TRUE)); $where = array($this->_db->quoteInto($this->_db->quoteIdentifier($this->_propertyMapping['emailUserId']) . ' = ?', $imapSettings[$this->_propertyMapping['emailUserId']])); // append domain if set or domain IS NULL if (array_key_exists('domain', $this->_config) && !empty($this->_config['domain'])) { $where[] = $this->_db->quoteInto($this->_db->quoteIdentifier($this->_userTable . '.domain') . ' = ?', $this->_config['domain']); } else { $where[] = $this->_db->quoteIdentifier($this->_userTable . '.domain') . ' IS NULL'; } #if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($where, TRUE)); try { $this->_db->update($this->_userTable, $imapSettings, $where); $this->inspectGetUserByProperty($_updatedUser); } catch (Zend_Db_Statement_Exception $zdse) { Tinebase_TransactionManager::getInstance()->rollBack(); Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' Error while updating email user: ' . $zdse->getMessage()); } }
/** * updates email properties for an existing user * * @param Tinebase_Model_FullUser $_updatedUser * @param Tinebase_Model_FullUser $_newUserProperties */ protected function _updateUser(Tinebase_Model_FullUser $_updatedUser, Tinebase_Model_FullUser $_newUserProperties) { $smtpSettings = $this->_recordToRawData($_updatedUser, $_newUserProperties); if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) { Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Updating postfix user ' . $smtpSettings[$this->_propertyMapping['emailUsername']]); } #if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($smtpSettings, TRUE)); $where = array($this->_db->quoteInto($this->_db->quoteIdentifier($this->_propertyMapping['emailUserId']) . ' = ?', $smtpSettings[$this->_propertyMapping['emailUserId']])); // append domain if set or "domain IS NULL" if (!empty($this->_clientId)) { $where[] = $this->_db->quoteInto($this->_db->quoteIdentifier($this->_userTable . '.client_idnr') . ' = ?', $this->_clientId); } else { $where[] = $this->_db->quoteIdentifier($this->_userTable . '.client_idnr') . ' IS NULL'; } try { $transactionId = Tinebase_TransactionManager::getInstance()->startTransaction($this->_db); $values = $smtpSettings; unset($values[$this->_propertyMapping['emailForwards']]); unset($values[$this->_propertyMapping['emailAliases']]); $this->_db->update($this->_userTable, $values, $where); // add forwards and aliases $this->_setAliases($smtpSettings); Tinebase_TransactionManager::getInstance()->commitTransaction($transactionId); $this->inspectGetUserByProperty($_updatedUser); } catch (Zend_Db_Statement_Exception $zdse) { Tinebase_TransactionManager::getInstance()->rollBack(); Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' Error while updating postfix email user: ' . $zdse->getMessage()); } }