当前位置: 首页>>代码示例>>PHP>>正文


PHP Director::execDirector方法代码示例

本文整理汇总了PHP中Director::execDirector方法的典型用法代码示例。如果您正苦于以下问题:PHP Director::execDirector方法的具体用法?PHP Director::execDirector怎么用?PHP Director::execDirector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Director的用法示例。


在下文中一共展示了Director::execDirector方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: listjobtotalsAction

 function listjobtotalsAction()
 {
     $this->view->title = $this->view->translate->_("List of Job Totals");
     // do Bacula ACLs
     $command = 'list';
     if (!$this->bacula_acl->doOneBaculaAcl($command, 'command')) {
         $msg = sprintf($this->view->translate->_('You try to run Bacula Console with command "%s".'), $command);
         $this->_forward('bacula-access-denied', 'error', null, array('msg' => $msg));
         // action, controller
         return;
     }
     $director = new Director();
     if (!$director->isFoundBconsole()) {
         $this->view->result_error = 'NOFOUND_BCONSOLE';
         $this->render();
         return;
     }
     $astatusdir = $director->execDirector(" <<EOF\nlist jobtotals\n@quit\nEOF");
     $this->view->command_output = $astatusdir['command_output'];
     // check return status of the executed command
     if ($astatusdir['return_var'] != 0) {
         $this->view->result_error = $astatusdir['result_error'];
     }
     $this->view->meta_refresh = 300;
     // meta http-equiv="refresh"
 }
开发者ID:staser,项目名称:webacula,代码行数:26,代码来源:DirectorController.php

示例2: statusClientIdAction

 function statusClientIdAction()
 {
     // http://localhost/webacula/client/status-client-id/id/1/name/local.fd
     $client_name = $this->_getParam('name');
     $this->view->title = $this->view->translate->_("Client") . " " . $client_name;
     // do Bacula ACLs
     $command = 'status';
     if (!$this->bacula_acl->doOneBaculaAcl($command, 'command')) {
         $msg = sprintf($this->view->translate->_('You try to run Bacula Console with command "%s".'), $command);
         $this->_forward('bacula-access-denied', 'error', null, array('msg' => $msg));
         // action, controller
         return;
     }
     $director = new Director();
     if (!$director->isFoundBconsole()) {
         $this->view->result_error = 'NOFOUND_BCONSOLE';
         $this->render();
         return;
     }
     $astatusdir = $director->execDirector(" <<EOF\nstatus client=\"{$client_name}\"\n.\n@quit\nEOF");
     $this->view->command_output = $astatusdir['command_output'];
     // check return status of the executed command
     if ($astatusdir['return_var'] != 0) {
         $this->view->result_error = $astatusdir['result_error'];
     }
     $this->view->meta_refresh = 300;
     // meta http-equiv="refresh"
 }
开发者ID:staser,项目名称:webacula,代码行数:28,代码来源:ClientController.php

示例3: cmdAction

 function cmdAction()
 {
     $bcommand = addslashes(trim($this->_request->getPost('bcommand')));
     $this->view->bcommand = $bcommand;
     if ($this->_helper->hasHelper('layout')) {
         $this->_helper->layout->disableLayout();
         // disable layouts
     }
     list($cmd) = explode(' ', $bcommand);
     // do Bacula ACLs
     if (!$this->bacula_acl->doOneBaculaAcl($cmd, 'command')) {
         $this->view->msg = sprintf($this->view->translate->_('You try to run Bacula Console with command "%s".'), $cmd) . '<br><b>Bacula ACLs : ' . $this->view->translate->_('Access denied.') . '</b><br>';
         $this->render();
         return;
     }
     $director = new Director();
     if (!$director->isFoundBconsole()) {
         $this->view->msg = '<b>' . $this->view->translate->_('ERROR: bconsole not found.') . '</b><br>';
         $this->render();
         return;
     }
     $astatusdir = $director->execDirector("<<EOF\n{$bcommand}\n@quit\nEOF");
     $this->view->command_output = $astatusdir['command_output'];
     // check return status of the executed command
     $this->view->return_var = $astatusdir['return_var'];
 }
开发者ID:staser,项目名称:webacula,代码行数:26,代码来源:BconsoleController.php

示例4: autochangerContentAction

 function autochangerContentAction()
 {
     /* Display Autochanger Content http://www.bacula.org/3.0.x-manuals/en/concepts/concepts/New_Features_in_3_0_0.html
      *
      * update slots storage="LTO1" drive=0
      * status slots storage="LTO1" drive=0
      */
     $changer = '';
     $storage_name = addslashes($this->_request->getParam('name'));
     // do Bacula ACLs
     $command = 'status';
     if (!$this->bacula_acl->doOneBaculaAcl($command, 'command')) {
         $msg = sprintf($this->view->translate->_('You try to run Bacula Console with command "%s".'), $command);
         $this->_forward('bacula-access-denied', 'error', null, array('msg' => $msg));
         // action, controller
         return;
     }
     // do bacula acl
     if (!$this->bacula_acl->doOneBaculaAcl($storage_name, 'storage')) {
         $this->view->result_error = 'BACULA_ACCESS_DENIED';
         $this->view->command_output = null;
         echo $this->renderScript('storage/status-id.phtml');
         return;
     }
     if (!empty($storage_name)) {
         $this->view->title = $this->view->translate->_("Storage") . " " . $storage_name . ' ' . $this->view->translate->_("autochanger content");
         $director = new Director();
         if (!$director->isFoundBconsole()) {
             $this->view->result_error = 'NOFOUND_BCONSOLE';
             $this->render();
             return;
         }
         /*
                     deleted by fixed ID: 3325149 "Display Autochanger Contents"
                     update slots storage=\"$storage_name\" drive=0
                     wait
         */
         $astatusdir = $director->execDirector(" <<EOF\nstatus slots storage=\"{$storage_name}\" drive=0\nwait\n@quit\nEOF");
         $this->view->command_output = $astatusdir['command_output'];
         // check return status of the executed command
         if ($astatusdir['return_var'] != 0) {
             $this->view->result_error = $astatusdir['result_error'];
             echo $this->renderScript('storage/status-id.phtml');
             return;
         }
     } else {
         $this->view->command_output = null;
     }
     echo $this->renderScript('storage/status-id.phtml');
 }
开发者ID:neverstoplwy,项目名称:contrib-webacula,代码行数:50,代码来源:StorageController.php

示例5: getListJobs

 /**
  * Get Listing All Jobs
  *
  */
 function getListJobs()
 {
     $director = new Director();
     // check access to bconsole
     if (!$director->isFoundBconsole()) {
         $aresult[] = 'ERROR: bconsole not found.';
         return $aresult;
     }
     $astatusdir = $director->execDirector("<<EOF\nrun\n.\n@quit\nEOF");
     // check return status of the executed command
     if ($astatusdir['return_var'] != 0) {
         $aresult[] = 'ERROR';
         $aresult[] = 'bconsole output:<b>';
         foreach ($astatusdir['command_output'] as $line) {
             $aresult[] = $line;
         }
         $aresult[] = '</b>';
         return $aresult;
     }
     /* Parsing Director's output.
              * Example :
     The defined Job resources are:
          1: restore.files
          2: job.name.test.1
          3: job name test 2
     Select Job resource (1-3):
         	 */
     $strs = 'The defined Job resources are:';
     $str_end = 'Select Job resource';
     // признак конца списка
     $start = 0;
     $aresult = array();
     foreach ($astatusdir['command_output'] as $line) {
         if (strlen($line) == 0) {
             continue;
         }
         if ($start == 0 && !(strpos($line, $strs) === FALSE)) {
             $start = 1;
             // parsing
             list($number, $name_job) = preg_split("/:+/", $line, 2);
             if (!empty($name_job)) {
                 $aresult[]['jobname'] = trim($name_job);
             }
             continue;
         }
         // задания закончились
         if ($start == 1 && !(strpos($line, $str_end) === FALSE)) {
             break;
         }
         if ($start == 1) {
             // parsing
             list($number, $name_job) = preg_split("/:+/", $line, 2);
             if (!empty($name_job)) {
                 $aresult[]['jobname'] = trim($name_job);
             }
         } else {
             continue;
         }
     }
     // do Bacula ACLs
     $res2dim = $this->bacula_acl->doBaculaAcl($aresult, 'jobname', 'job');
     /*
      * convert two dimensional $res2dim to one dimension array $res1dim
      * для корректного отображения в форме нужен ординарный массив
      */
     $res1dim = array();
     foreach ($res2dim as $res2) {
         $res1dim[] = $res2['jobname'];
     }
     return $res1dim;
 }
开发者ID:neverstoplwy,项目名称:contrib-webacula,代码行数:75,代码来源:Job.php

示例6: showJobAction

 /**
  * show job
  * http://www.bacula.org/3.0.x-manuals/en/console/console/Bacula_Console.html
  * show job=<xxx>
  */
 function showJobAction()
 {
     // do Bacula ACLs
     $command = 'show';
     if (!$this->bacula_acl->doOneBaculaAcl($command, 'command')) {
         $msg = sprintf($this->view->translate->_('You try to run Bacula Console with command "%s".'), $command);
         $this->_forward('bacula-access-denied', 'error', null, array('msg' => $msg));
         // action, controller
         return;
     }
     $this->view->title = $this->view->translate->_("Show Job resource");
     $jobname = trim($this->_request->getParam('jobname'));
     $this->view->jobname = $jobname;
     $director = new Director();
     if (!$director->isFoundBconsole()) {
         $this->view->result_error = 'NOFOUND_BCONSOLE';
         $this->render();
         return;
     }
     $astatusdir = $director->execDirector(" <<EOF\nshow job=\"{$jobname}\"\nEOF");
     $this->view->command_output = $astatusdir['command_output'];
     // check return status of the executed command
     if ($astatusdir['return_var'] != 0) {
         $this->view->result_error = $astatusdir['result_error'];
     }
 }
开发者ID:staser,项目名称:webacula,代码行数:31,代码来源:JobController.php

示例7: runRestoreSingleFileAction

 /**
  * Run Restore single File + Bacula ACLs
  * http://www.bacula.org/rel-manual/Restore_Command.html
  */
 function runRestoreSingleFileAction()
 {
     // do Bacula ACLs
     $command = 'restore';
     if (!$this->bacula_acl->doOneBaculaAcl($command, 'command')) {
         $msg = sprintf($this->view->translate->_('You try to run Bacula Console with command "%s".'), $command);
         $this->_forward('bacula-access-denied', 'error', null, array('msg' => $msg));
         // action, controller
         return;
     }
     $this->view->title = $this->view->translate->_('Restore Single File');
     // получаем значения из формы FormRestoreOptions
     $this->getParamFromForm();
     // get File data
     Zend_Loader::loadClass('Job');
     $job = new Job();
     $file = $job->getByFileId($this->fileid);
     // do Bacula ACL
     if (!$file) {
         return;
     }
     // check access to bconsole
     Zend_Loader::loadClass('Director');
     $director = new Director();
     if (!$director->isFoundBconsole()) {
         $this->view->result_error = 'NOFOUND_BCONSOLE';
         $this->renderScript('restorejob/run-restore.phtml');
         return;
     }
     //******************************* запуск задания ***************************************
     // perform the command line  (формируем командную строку)
     // restore jobid=9713 file=<"/tmp/webacula_restore_9713.tmp" client="local.fd" yes
     // restore storage=<storage-name> client=<backup-client-name> where=<path> pool=<pool-name>
     //      fileset=<fileset-name> restoreclient=<restore-client-name>  select current all done
     $cmd = 'restore jobid=' . $file[0]['jobid'] . ' file="' . $file[0]['path'] . $file[0]['filename'] . '"' . $this->getCmdRestore() . ' yes';
     $comment = __METHOD__;
     $astatusdir = $director->execDirector(" <<EOF\n@#\n@# {$comment}\n@#\n{$cmd}\nquit\nEOF");
     $this->view->command_output = $astatusdir['command_output'];
     // check return status of the executed command
     if ($astatusdir['return_var'] == 0) {
         $this->deleteTmpTables();
         $this->mySessionStop();
     } else {
         $this->view->result_error = $astatusdir['result_error'];
     }
     //echo "<pre>3 command_output:<br>" . print_r($command_output) . "<br><br>return_var = " . $return_var . "</pre>"; exit;
     $this->renderScript('restorejob/run-restore.phtml');
 }
开发者ID:staser,项目名称:webacula,代码行数:52,代码来源:RestorejobController.php


注:本文中的Director::execDirector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。