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


PHP Task::init方法代码示例

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


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

示例1: load

 public function load($clusterName)
 {
     $result = $this->awsClient->listTasks(['cluster' => $clusterName, 'serviceName' => $this->serviceName, 'maxResults' => 99, 'nextToken' => '']);
     //get existing tasks
     foreach ($result['taskArns'] as $taskArn) {
         $task = new Task();
         $task->setArn($taskArn);
         if (!$task->init($this->creds)) {
             return false;
         }
         if (!$task->load($clusterName)) {
             return false;
         }
         $this->tasks[$taskArn] = $task;
     }
     //get task def
     $details = $this->awsClient->describeServices(['cluster' => $clusterName, 'services' => [$this->serviceName]]);
     $this->taskDefinition = $details['services'][0]['taskDefinition'];
     $this->taskDef = new TaskDef();
     $this->taskDef->init($this->creds);
     $this->taskDef->load($this->taskDefinition);
     //other service items
     $this->status = $details['services'][0]['status'];
     $this->minHealthyPercent = $details['services'][0]['deploymentConfiguration']['minimumHealthyPercent'];
     $this->maxPercent = $details['services'][0]['deploymentConfiguration']['maximumPercent'];
     $this->desiredTaskCount = $details['services'][0]['desiredCount'];
     $this->pendingTaskCount = $details['services'][0]['pendingCount'];
     $this->runningTaskCount = $details['services'][0]['runningCount'];
     return true;
 }
开发者ID:cablelabs,项目名称:aws-php,代码行数:30,代码来源:Service.php

示例2: init

 /**
  * Called by the parser to let the task initialize properly.
  * Should throw a BuildException if something goes wrong with the build
  *
  * This is abstract here, but may not be overloaded by subclasses.
  *
  * @throws \BuildException
  */
 public function init()
 {
     if (!defined('SW_PATH') && $this->checkSWPath()) {
         $this->includeSWAutoloader();
     }
     // if
     return parent::init();
 }
开发者ID:b3nl,项目名称:phing-shopware,代码行数:16,代码来源:Base.php

示例3: init

 /**
  * Executes initialization actions required to setup the data structures
  * related to the tag.
  * <p>
  * This includes:
  * <ul>
  * <li>creation of the task object</li>
  * <li>calling the setters for attributes</li>
  * <li>adding the task to the container object</li>
  * <li>adding a reference to the task (if id attribute is given)</li>
  * <li>executing the task if the container is the &lt;project&gt;
  * element</li>
  * </ul>
  *
  * @param string $tag The tag that comes in
  * @param array $attrs Attributes the tag carries
  * @throws ExpatParseException if attributes are incomplete or invalid
  */
 function init($tag, $attrs)
 {
     // shorthands
     try {
         $configurator = $this->configurator;
         $project = $this->configurator->project;
         $this->task = $project->createTask($tag);
     } catch (BuildException $be) {
         // swallow here, will be thrown again in
         // UnknownElement->maybeConfigure if the problem persists.
         print "Swallowing exception: " . $be->getMessage() . "\n";
     }
     // if the task is not known beforehand, wrap it
     // in an UnknownElement object to enable runtime configuration
     // NB: this is also done for ConditionBase objects to allow
     // dynamic conditions without breaking BC for all tasks
     if ($this->task === null) {
         $this->task = new UnknownElement($tag);
         $this->task->setProject($project);
         $this->task->setTaskType($tag);
         $this->task->setTaskName($tag);
     }
     // add file position information to the task (from parser)
     // should be used in task exceptions to provide details
     $this->task->setLocation($this->parser->getLocation());
     $configurator->configureId($this->task, $attrs);
     if ($this->container) {
         $this->container->addTask($this->task);
     }
     // Top level tasks don't have associated targets
     // FIXME: if we do like Ant 1.6 and create an implicitTarget in the projectconfigurator object
     // then we don't need to check for null here ... but there's a lot of stuff that will break if we
     // do that at this point.
     if ($this->target !== null) {
         $this->task->setOwningTarget($this->target);
         $this->task->init();
         $this->wrapper = $this->task->getRuntimeConfigurableWrapper();
         $this->wrapper->setAttributes($attrs);
         /*
         Commenting this out as per thread on Premature configurate of ReuntimeConfigurables 
         with Matthias Pigulla: http://phing.tigris.org/servlets/ReadMsg?list=dev&msgNo=251
         
         if ($this->parentWrapper !== null) { // this may not make sense only within this if-block, but it
                                             // seems to address current use cases adequately
             $this->parentWrapper->addChild($this->wrapper);
         }
         */
     } else {
         $this->task->init();
         $configurator->configure($this->task, $attrs, $project);
     }
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:70,代码来源:TaskHandler.php

示例4: init

 /**
  * Initializes this task.
  */
 public function init()
 {
     parent::init();
     $this->defaultValue = "";
     $this->promptCharacter = "?";
     $this->useExistingValue = false;
 }
开发者ID:sergeytsivin,项目名称:haru,代码行数:10,代码来源:PropertyPromptTask.php

示例5: isMilestoneOrVersion

        return $tasks;
    }
    public function isMilestoneOrVersion()
    {
        return $this->isOfCategory(array(TCATEGORY_MILESTONE, TCATEGORY_VERSION));
    }
    public function isOfCategory($cat)
    {
        if (is_array($cat)) {
            foreach ($cat as $c) {
                if ($this->category == $c) {
                    return true;
                }
            }
            return false;
        } elseif ($this->category == $cat) {
            return true;
        }
        return false;
    }
    public function isDocumentation()
    {
        return isOfCategory(TCATEGORY_DOCU);
    }
    public function isBug()
    {
        return isOfCategory(TCATEGORY_BUG);
    }
}
Task::init();
开发者ID:Bremaweb,项目名称:streber-1,代码行数:30,代码来源:class_task.inc.php

示例6: initTask

 /**
  * 初始化一些定时任务
  * @return void
  */
 protected static function initTask()
 {
     // 任务初始化
     Task::init();
     // 测试环境定时获取worker包含的文件
     if (PHPServerConfig::get('ENV') == 'dev') {
         // 定时获取worker包含的文件
         Task::add(self::$commonWaitTimeLong, array('PHPServer', 'sendCmdToAll'), array(Cmd::CMD_REPORT_INCLUDE_FILE));
         // 定时检测终端是否关闭
         Task::add(self::$commonWaitTimeLong, array('PHPServer', 'checkTty'));
     } else {
         // 定时发送alarm命令
         Task::add(self::$commonWaitTimeLong, array('PHPServer', 'sendCmdToAll'), array(Cmd::CMD_PING));
     }
     // 如果不支持inotify则上报文件给FileMonitor进程来监控文件更新
     Task::add(self::$checkFilesTimeLong, function () {
         Reporter::reportIncludedFiles(PHPServer::getFilesToInotify());
     });
     // 检查worker内存占用情况
     Task::add(self::$checkStatusTimeLong, array('PHPServer', 'checkWorkersMemory'));
     // 检查心跳情况
     Task::add(self::$checkStatusTimeLong, array('PHPServer', 'checkPingInfo'));
     // 开发环境定时清理master输出
     if (PHPServerConfig::get('ENV') == 'dev') {
         Task::add(self::$commonWaitTimeLong, function () {
             @ob_clean();
         });
     }
 }
开发者ID:nangong92t,项目名称:go_src,代码行数:33,代码来源:PHPServer.php

示例7: execute

 /**
  * Access point for this special page.
  */
 public function execute($parameters)
 {
     global $wgOut, $wgTranslateBlacklist, $wgRequest;
     $wgOut->addModules('ext.translate.special.translate');
     $this->setHeaders();
     // @todo Move to api or so
     if ($parameters === 'editpage') {
         $editpage = TranslationEditPage::newFromRequest($wgRequest);
         if ($editpage) {
             $editpage->execute();
             return;
         }
     }
     $this->setup($parameters);
     $errors = array();
     if ($this->options['group'] === '') {
         TranslateUtils::addSpecialHelpLink($wgOut, 'Help:Extension:Translate/Translation_example');
         $this->groupInformation();
         return;
     }
     $codes = Language::getLanguageNames(false);
     if (!$this->options['language'] || !isset($codes[$this->options['language']])) {
         $errors['language'] = wfMsgExt('translate-page-no-such-language', array('parse'));
         $this->options['language'] = $this->defaults['language'];
     }
     if (!$this->task instanceof TranslateTask) {
         $errors['task'] = wfMsgExt('translate-page-no-such-task', array('parse'));
         $this->options['task'] = $this->defaults['task'];
     }
     if (!$this->group instanceof MessageGroup) {
         $errors['group'] = wfMsgExt('translate-page-no-such-group', array('parse'));
         $this->options['group'] = $this->defaults['group'];
     }
     TranslateUtils::addSpecialHelpLink($wgOut, 'Help:Extension:Translate/Translation_example');
     // Show errors nicely.
     $wgOut->addHTML($this->settingsForm($errors));
     if (count($errors)) {
         return;
     } else {
         $checks = array($this->options['group'], strtok($this->options['group'], '-'), '*');
         foreach ($checks as $check) {
             $reason = @$wgTranslateBlacklist[$check][$this->options['language']];
             if ($reason !== null) {
                 $wgOut->addWikiMsg('translate-page-disabled', $reason);
                 return;
             }
         }
     }
     // Proceed.
     $taskOptions = new TaskOptions($this->options['language'], $this->options['limit'], $this->options['offset'], array($this, 'cbAddPagingNumbers'));
     // Initialise and get output.
     $this->task->init($this->group, $taskOptions);
     $output = $this->task->execute();
     if ($this->task->plainOutput()) {
         $wgOut->disable();
         header('Content-type: text/plain; charset=UTF-8');
         echo $output;
     } else {
         $description = $this->getGroupDescription($this->group);
         $taskid = $this->options['task'];
         if (in_array($taskid, array('untranslated', 'reviewall'), true)) {
             $hasOptional = count($this->group->getTags('optional'));
             if ($hasOptional) {
                 $linker = class_exists('DummyLinker') ? new DummyLinker() : new Linker();
                 $linktext = wfMessage('translate-page-description-hasoptional-open')->escaped();
                 $params = array('task' => 'optional') + $this->nondefaults;
                 $link = $linker->link($this->getTitle(), $linktext, array(), $params);
                 $note = wfMessage('translate-page-description-hasoptional')->rawParams($link)->parseAsBlock();
                 if ($description) {
                     $description .= '<br>' . $note;
                 } else {
                     $description = $note;
                 }
             }
         }
         $status = $this->getWorkflowStatus();
         if ($status !== false) {
             $description = $status . $description;
         }
         if ($description) {
             $description = Xml::fieldset(wfMsg('translate-page-description-legend'), $description);
         }
         $links = $this->doStupidLinks();
         if ($this->paging['count'] === 0) {
             $wgOut->addHTML($description . $links);
         } else {
             $wgOut->addHTML($description . $links . $output . $links);
         }
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:93,代码来源:SpecialTranslate.php


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