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


PHP Command::create方法代码示例

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


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

示例1: parseInput

 /**
  * Фабрикует класс, обрабатывающий сообщение
  * @param  array $m Сообщение на вход
  * @return object    Класс, ответственный за данный тип сообщения
  */
 public static function parseInput($m)
 {
     if (empty($m['message_id'])) {
         return NULL;
     }
     if (!empty($m['text'])) {
         $command = Command::create($m);
         return $command ? $command : TextMessage::create($m);
     } elseif (!empty($m['location'])) {
         return Location::create($m);
     }
 }
开发者ID:steelice,项目名称:TelegramBot,代码行数:17,代码来源:Message.php

示例2: run

 public function run()
 {
     DB::table('commands')->delete();
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'notify-host-by-email', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '/usr/bin/printf "%b" "***** Nagios *****\\n\\nNotification Type: $NOTIFICATIONTYPE$\\nHost: $HOSTNAME$\\nState: $HOSTSTATE$\\nAddress: $HOSTADDRESS$\\nInfo: $HOSTOUTPUT$\\n\\nDate/Time: $LONGDATETIME$\\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'notify-service-by-email', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '/usr/bin/printf "%b" "***** Nagios *****\\n\\nNotification Type: $NOTIFICATIONTYPE$\\n\\nService: $SERVICEDESC$\\nHost: $HOSTALIAS$\\nAddress: $HOSTADDRESS$\\nState: $SERVICESTATE$\\n\\nDate/Time: $LONGDATETIME$\\n\\nAdditional Info:\\n\\n$SERVICEOUTPUT$\\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check-host-alive', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_local_disk', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_local_load', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_load -w $ARG1$ -c $ARG2$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_local_procs', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_local_users', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_users -w $ARG1$ -c $ARG2$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_local_swap', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_swap -w $ARG1$ -c $ARG2$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_local_mrtgtraf', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_ftp', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_hpjd', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_snmp', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_http', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_http -I $HOSTADDRESS$ $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_ssh', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_ssh $ARG1$ $HOSTADDRESS$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_dhcp', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_dhcp $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_ping', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_pop', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_pop -H $HOSTADDRESS$ $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_imap', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_imap -H $HOSTADDRESS$ $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_smtp', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_tcp', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_udp', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_nt', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'process-host-perfdata', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '/usr/bin/printf "%b" "$LASTHOSTCHECK$\\t$HOSTNAME$\\t$HOSTSTATE$\\t$HOSTATTEMPT$\\t$HOSTSTATETYPE$\\t$HOSTEXECUTIONTIME$\\t$HOSTOUTPUT$\\t$HOSTPERFDATA$\\n" >> /var/log/nagios/host-perfdata.out']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'process-service-perfdata', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '/usr/bin/printf "%b" "$LASTSERVICECHECK$\\t$HOSTNAME$\\t$SERVICEDESC$\\t$SERVICESTATE$\\t$SERVICEATTEMPT$\\t$SERVICESTATETYPE$\\t$SERVICEEXECUTIONTIME$\\t$SERVICELATENCY$\\t$SERVICEOUTPUT$\\t$SERVICEPERFDATA$\\n" >> /var/log/nagios/service-perfdata.out']);
 }
开发者ID:krcs17,项目名称:stigma2-dev,代码行数:76,代码来源:CommandsTableSeeder.php

示例3: register

 public static function register($panel, $group = 'Doctrine')
 {
     $panel->addCommand($group, Command::create('Create Schema', function ($container) {
         $em = $container->entityManager;
         $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
         $metadatas = $em->getMetadataFactory()->getAllMetadata();
         $schemaTool->createSchema($metadatas);
     }));
     $panel->addCommand($group, Command::create('Update Schema', function ($container) {
         $em = $container->entityManager;
         $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
         $metadatas = $em->getMetadataFactory()->getAllMetadata();
         $schemaTool->updateSchema($metadatas);
     }));
     $panel->addCommand($group, Command::create('Drop Schema', function ($container) {
         $em = $container->entityManager;
         $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
         $metadatas = $em->getMetadataFactory()->getAllMetadata();
         $schemaTool->dropSchema($metadatas);
     }));
 }
开发者ID:Clansuite,项目名称:Clansuite,代码行数:21,代码来源:DoctrineAdminController.php

示例4: display

 protected function display()
 {
     if (Tools::isConnectedUser()) {
         if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
             $this->smartyHelper->assign('isEditGranted', FALSE);
         } else {
             // only managers can edit the SC
             $isManager = $this->session_user->isTeamManager($this->teamid);
             if (!$isManager) {
                 return;
             }
             $this->smartyHelper->assign('isEditGranted', true);
             // -------- CHECK  --------
             // this will check all existing commands (from all teams !) and remove issues that have been deleted from mantis
             Command::checkCommands();
             // use the cmdid set in the form, if not defined (first page call) use session cmdid
             $cmdid = 0;
             if (isset($_POST['cmdid'])) {
                 $cmdid = $_POST['cmdid'];
                 $_SESSION['cmdid'] = $cmdid;
             } else {
                 if (isset($_GET['cmdid'])) {
                     $cmdid = $_GET['cmdid'];
                     $_SESSION['cmdid'] = $cmdid;
                 } else {
                     if (isset($_SESSION['cmdid'])) {
                         $cmdid = $_SESSION['cmdid'];
                     }
                 }
             }
             // use the commandsetid set in the form, if not defined (first page call) use session commandsetid
             // Note: It is used for createEnv but will be overridden by the displayed command's commandsetid.
             $commandsetid = 0;
             if (isset($_POST['commandsetid'])) {
                 $commandsetid = $_POST['commandsetid'];
                 $_SESSION['commandsetid'] = $commandsetid;
             } else {
                 if (isset($_SESSION['commandsetid'])) {
                     $commandsetid = $_SESSION['commandsetid'];
                 }
             }
             $action = isset($_POST['action']) ? $_POST['action'] : '';
             if (0 == $cmdid) {
                 // -------- CREATE CMD -------
                 if ("createCmd" == $action) {
                     //$this->teamid = Tools::getSecurePOSTIntValue('teamid');
                     //$_SESSION['teamid'] = $this->teamid;
                     if (self::$logger->isDebugEnabled()) {
                         self::$logger->debug("create new Command for team {$this->teamid}<br>");
                     }
                     $cmdName = Tools::getSecurePOSTStringValue('cmdName');
                     // TODO UGLY WORKAROUND: command name cannot contain commas (,) because it is used as field separator in FilterManager
                     $cmdName = str_replace(",", ' ', $cmdName);
                     try {
                         $cmdid = Command::create($cmdName, $this->teamid);
                         $this->smartyHelper->assign('commandid', $cmdid);
                         $cmd = CommandCache::getInstance()->getCommand($cmdid);
                     } catch (Exception $e) {
                         // Smartify
                         echo "Can't create the command because the command name is already used";
                     }
                 }
                 // ------ Display Empty Command Form
                 // Note: this will be overridden by the 'update' section if the 'createCmd' action has been called.
                 $this->smartyHelper->assign('cmdInfoFormBtText', T_('Create'));
                 $this->smartyHelper->assign('cmdInfoFormAction', 'createCmd');
                 $this->smartyHelper->assign('cmdStateList', CommandTools::getCommandStateList());
                 $this->smartyHelper->assign('commandsetid', $commandsetid);
                 $this->smartyHelper->assign('commandsets', CommandSetTools::getCommandSets($this->teamid, $commandsetid));
             }
             if (0 != $cmdid) {
                 // -------- UPDATE CMD -------
                 $cmd = CommandCache::getInstance()->getCommand($cmdid);
                 // Actions
                 if ("addCmdIssue" == $action) {
                     $bugid = Tools::getSecurePOSTIntValue('bugid');
                     if (self::$logger->isDebugEnabled()) {
                         self::$logger->debug("add Issue {$bugid} on Command {$cmdid} team {$this->teamid}");
                     }
                     $cmd->addIssue($bugid, true);
                     // DBonly
                 } else {
                     if ("addCmdIssueList" == $action) {
                         $bugid_list = $_POST['bugid_list'];
                         if (self::$logger->isDebugEnabled()) {
                             self::$logger->debug("add Issues ({$bugid_list}) on Command {$cmdid} team {$this->teamid}");
                         }
                         $bugids = explode(',', $bugid_list);
                         //$cmd->addIssueList($bugids, true); // DBonly
                         foreach ($bugids as $id) {
                             if (is_numeric(trim($id))) {
                                 $cmd->addIssue(intval($id), true);
                                 // DBonly
                             } else {
                                 self::$logger->error('Attempt to set non_numeric value (' . $id . ')');
                                 die("<span style='color:red'>ERROR: Please contact your CodevTT administrator</span>");
                             }
                         }
                     } else {
                         if ("removeCmdIssue" == $action) {
//.........这里部分代码省略.........
开发者ID:fg-ok,项目名称:codev,代码行数:101,代码来源:command_edit.php


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