本文整理匯總了PHP中Pool::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP Pool::update方法的具體用法?PHP Pool::update怎麽用?PHP Pool::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pool
的用法示例。
在下文中一共展示了Pool::update方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: updateAction
function updateAction()
{
// ****************************** UPDATE record **********************************
$media_id = trim($this->_request->getPost('mediaid'));
$pool_id = trim($this->_request->getPost('poolid'));
$volume_name = trim($this->_request->getPost('volumename'));
if (!empty($media_id) && !empty($pool_id)) {
$media = new Media();
// remember old value of poolid for this mediaid
$old_pool_id = $media->getPoolId($media_id);
// update Media record
$data = array('poolid' => $pool_id, 'volstatus' => trim($this->_request->getPost('volstatus')), 'volretention' => (int) trim($this->_request->getPost('volretention')) * 86400, 'voluseduration' => (int) trim($this->_request->getPost('voluseduration')), 'recycle' => trim($this->_request->getPost('recycle')), 'slot' => trim($this->_request->getPost('slot')), 'inchanger' => trim($this->_request->getPost('inchanger')), 'maxvoljobs' => trim($this->_request->getPost('maxvoljobs')), 'maxvolfiles' => trim($this->_request->getPost('maxvolfiles')), 'comment' => trim($this->_request->getPost('comment')));
$where = $media->getAdapter()->quoteInto('MediaId = ?', $media_id);
$res = $media->update($data, $where);
// if Volume moved to another Pool
if ($old_pool_id != $pool_id) {
// to count Volume count on both Pools
$old_volume_count = $media->getVolumeCountByPool($old_pool_id);
$volume_count = $media->getVolumeCountByPool($pool_id);
$pool = new Pool();
// update old Pool record
$data = array('numvols' => $old_volume_count);
$where = $pool->getAdapter()->quoteInto('PoolId = ?', $old_pool_id);
$res = $pool->update($data, $where);
// update new Pool record
$data = array('numvols' => $volume_count);
$where = $pool->getAdapter()->quoteInto('PoolId = ?', $pool_id);
$res = $pool->update($data, $where);
}
// send email
if ($res) {
$email = new MyClass_SendEmail();
// $from_email, $from_name, $to_email, $to_name, $subj, $body
$email->mySendEmail($this->view->config->webacula->email->from, 'Webacula Volume controller', $this->view->config->webacula->email->to_admin, 'Webacula admin', $this->view->translate->_('Webacula : Updated Volume parameters'), $this->view->translate->_('Media Id') . ': ' . $media_id . "\n" . $this->view->translate->_('Volume Name') . ': ' . $volume_name . "\n\n");
}
}
$this->_redirect("/volume/detail/mediaid/{$media_id}");
return;
}