当前位置: 首页>>代码示例>>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;未经允许,请勿转载。