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


PHP PhingFile::getCanonicalFile方法代码示例

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


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

示例1: prepare

 /**
  * Prepares the command building and execution, i.e.
  * changes to the specified directory.
  *
  * @return void
  */
 protected function prepare()
 {
     if ($this->dir === null) {
         return;
     }
     // expand any symbolic links first
     if (!$this->dir->getCanonicalFile()->isDirectory()) {
         throw new BuildException("'" . (string) $this->dir . "' is not a valid directory");
     }
     $this->currdir = getcwd();
     @chdir($this->dir->getPath());
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:18,代码来源:ExecTask.php

示例2: execute

 /**
  * Executes a program and returns the return code.
  * Output from command is logged at INFO level.
  * @return int Return code from execution.
  */
 public function execute()
 {
     // test if os match
     $myos = Phing::getProperty("os.name");
     $this->log("Myos = " . $myos, Project::MSG_VERBOSE);
     if ($this->os !== null && strpos($this->os, $myos) === false) {
         // this command will be executed only on the specified OS
         $this->log("Not found in " . $this->os, Project::MSG_VERBOSE);
         return 0;
     }
     if ($this->dir !== null) {
         // expand any symbolic links first
         if ($this->dir->getCanonicalFile()->isDirectory()) {
             $currdir = getcwd();
             @chdir($this->dir->getPath());
         } else {
             throw new BuildException("'" . (string) $this->dir . "' is not a valid directory");
         }
     }
     if ($this->escape == true) {
         // FIXME - figure out whether this is correct behavior
         $this->command = escapeshellcmd($this->command);
     }
     if ($this->error !== null) {
         $this->command .= ' 2> ' . $this->error->getPath();
         $this->log("Writing error output to: " . $this->error->getPath(), $this->logLevel);
     }
     if ($this->output !== null) {
         $this->command .= ' 1> ' . $this->output->getPath();
         $this->log("Writing standard output to: " . $this->output->getPath(), $this->logLevel);
     } elseif ($this->spawn) {
         $this->command .= ' 1>/dev/null';
         $this->log("Sending ouptut to /dev/null", $this->logLevel);
     }
     // If neither output nor error are being written to file
     // then we'll redirect error to stdout so that we can dump
     // it to screen below.
     if ($this->output === null && $this->error === null) {
         $this->command .= ' 2>&1';
     }
     // we ignore the spawn boolean for windows
     if ($this->spawn) {
         $this->command .= ' &';
     }
     $this->log("Executing command: " . $this->command, $this->logLevel);
     $output = array();
     $return = null;
     if ($this->passthru) {
         passthru($this->command, $return);
     } else {
         exec($this->command, $output, $return);
     }
     if ($this->dir !== null) {
         @chdir($currdir);
     }
     foreach ($output as $line) {
         $this->log($line, $this->logOutput ? Project::MSG_INFO : Project::MSG_VERBOSE);
     }
     if ($this->returnProperty) {
         $this->project->setProperty($this->returnProperty, $return);
     }
     if ($this->outputProperty) {
         $this->project->setProperty($this->outputProperty, implode("\n", $output));
     }
     if ($return != 0 && $this->checkreturn) {
         throw new BuildException("Task exited with code {$return}");
     }
     return $return;
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:74,代码来源:ExecTask.php


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