當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Pool::update方法代碼示例

本文整理匯總了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;
 }
開發者ID:neverstoplwy,項目名稱:contrib-webacula,代碼行數:39,代碼來源:VolumeController.php


注:本文中的Pool::update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。