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


PHP PhingFile::getAbsolutePath方法代码示例

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


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

示例1: doApply

 protected function doApply()
 {
     $dataDir = $this->dataDir->getAbsolutePath();
     $htmlDir = $this->htmlDir->getAbsolutePath();
     define('HTML_REALDIR', rtrim(realpath($htmlDir), '/\\') . '/');
     require_once HTML_REALDIR . '/define.php';
     require_once HTML_REALDIR . HTML2DATA_DIR . '/require_base.php';
     $query = SC_Query_Ex::getSingletonInstance();
     $storage = new Zeclib_DefaultMigrationStorage($query, $this->system);
     $storage->versionTable = $this->versionTable;
     $storage->containerDirectories[] = $this->containerDir->getPath();
     $migrator = new Zeclib_Migrator($storage, $query);
     $migrator->logger = new Zeclib_Phing_TaskMigrationLogger($this);
     $migrations = array();
     $versions = preg_split('/[,\\s]+/', $this->version, 0, PREG_SPLIT_NO_EMPTY);
     foreach ($versions as $version) {
         try {
             $migrations[] = $migrator->loadMigration($version);
         } catch (Zeclib_MigrationException $e) {
             $message = $e->getMessage();
             $this->log($message, Zeclib_MigrationLogger::TYPE_WARNING);
         }
     }
     $num = $migrator->apply($migrations);
     $this->log(sprintf('%d migrations are applied.', $num));
 }
开发者ID:zenith6,项目名称:eccube-zeclib,代码行数:26,代码来源:MigrationApplyTask.php

示例2: read

 /**
  * Returns the stream with an additional linebreak.
  *
  * @return the resulting stream, or -1
  *         if the end of the resulting stream has been reached
  *
  * @throws IOException if the underlying stream throws an IOException
  *                        during reading
  */
 function read($len = null)
 {
     if ($this->processed === true) {
         return -1;
         // EOF
     }
     // Read
     $php = null;
     while (($buffer = $this->in->read($len)) !== -1) {
         $php .= $buffer;
     }
     if ($php === null) {
         // EOF?
         return -1;
     }
     if (empty($php)) {
         $this->log("File is empty!", Project::MSG_WARN);
         return '';
         // return empty string
     }
     // write buffer to a temporary file, since php_strip_whitespace() needs a filename
     $file = new PhingFile(tempnam(PhingFile::getTempDir(), 'stripwhitespace'));
     file_put_contents($file->getAbsolutePath(), $php);
     $output = file_get_contents($file->getAbsolutePath()) . "\r\n";
     unlink($file->getAbsolutePath());
     $this->processed = true;
     return $output;
 }
开发者ID:ThorstenSuckow,项目名称:conjoon,代码行数:37,代码来源:AddLinebreak.php

示例3: main

 /**
  * do the work
  * @throws BuildException
  */
 public function main()
 {
     $this->validateAttributes();
     $filesToExtract = array();
     if ($this->file !== null) {
         if (!$this->isDestinationUpToDate($this->file)) {
             $filesToExtract[] = $this->file;
         } else {
             $this->log('Nothing to do: ' . $this->todir->getAbsolutePath() . ' is up to date for ' . $this->file->getCanonicalPath(), Project::MSG_INFO);
         }
     }
     foreach ($this->filesets as $compressedArchiveFileset) {
         $compressedArchiveDirScanner = $compressedArchiveFileset->getDirectoryScanner($this->project);
         $compressedArchiveFiles = $compressedArchiveDirScanner->getIncludedFiles();
         $compressedArchiveDir = $compressedArchiveFileset->getDir($this->project);
         foreach ($compressedArchiveFiles as $compressedArchiveFilePath) {
             $compressedArchiveFile = new PhingFile($compressedArchiveDir, $compressedArchiveFilePath);
             if ($compressedArchiveFile->isDirectory()) {
                 throw new BuildException($compressedArchiveFile->getAbsolutePath() . ' compressed archive cannot be a directory.');
             }
             if (!$this->isDestinationUpToDate($compressedArchiveFile)) {
                 $filesToExtract[] = $compressedArchiveFile;
             } else {
                 $this->log('Nothing to do: ' . $this->todir->getAbsolutePath() . ' is up to date for ' . $compressedArchiveFile->getCanonicalPath(), Project::MSG_INFO);
             }
         }
     }
     foreach ($filesToExtract as $compressedArchiveFile) {
         $this->extractArchive($compressedArchiveFile);
     }
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:35,代码来源:ExtractBaseTask.php

示例4: setDir

 public function setDir(PhingFile $dir)
 {
     if (!$dir->exists()) {
         throw new BuildException("Can not find asset directory: " . $dir->getAbsolutePath(), $this->location);
     }
     $this->assetDir = $dir->getAbsolutePath();
 }
开发者ID:rcrowe,项目名称:phing-asset,代码行数:7,代码来源:Assets.php

示例5: main

 public function main()
 {
     $plugin = $this->plugin->getAbsolutePath();
     $infoFile = $plugin . '/' . self::INFO_FILE;
     if (!file_exists($infoFile)) {
         $message = sprintf('Unable to read plugin_info.php file at "%s"', $plugin);
         throw new BuildException($message);
     }
     require_once $infoFile;
     $class = new ReflectionClass('plugin_info');
     try {
         $value = $class->getStaticPropertyValue($this->key);
     } catch (Exception $e) {
         $message = sprintf('Unable to read property with "%s"', $this->key);
         throw new BuildException($message, $e);
     }
     if (!is_string($value) && !is_int($value) && !is_float($value)) {
         $value = json_encode($value);
     }
     if ($this->to != '') {
         $this->project->setProperty($this->to, $value);
     } else {
         $this->log($value);
     }
 }
开发者ID:zenith6,项目名称:eccube-zeclib,代码行数:25,代码来源:PluginInfoGetTask.php

示例6: destroyDatabase

 protected function destroyDatabase()
 {
     $dataDir = $this->dataDir->getAbsolutePath();
     $htmlDir = $this->htmlDir->getAbsolutePath();
     define('HTML_REALDIR', rtrim(realpath($htmlDir), '/\\') . '/');
     require_once HTML_REALDIR . '/define.php';
     require_once HTML_REALDIR . HTML2DATA_DIR . '/require_base.php';
     $query = SC_Query_Ex::getSingletonInstance();
     $mdb2 = $query->conn;
     $mdb2->loadModule('Manager');
     $result = $mdb2->dropTable($this->versionTable);
     if (PEAR::isError($result)) {
         throw new BuildException($result->getMessage());
     }
 }
开发者ID:zenith6,项目名称:eccube-zeclib,代码行数:15,代码来源:MigrationDestroyTask.php

示例7: __construct

 /**
  * Construct a new FileInputStream.
  * 
  * @param PhingFile|string $file Path to the file
  * @param boolean $append Whether to append (ignored)
  * @throws Exception - if invalid argument specified.
  * @throws IOException - if unable to open file.
  */
 public function __construct($file, $append = false)
 {
     if ($file instanceof PhingFile) {
         $this->file = $file;
     } elseif (is_string($file)) {
         $this->file = new PhingFile($file);
     } else {
         throw new Exception("Invalid argument type for \$file.");
     }
     $stream = @fopen($this->file->getAbsolutePath(), "rb");
     if ($stream === false) {
         throw new IOException("Unable to open " . $this->file->__toString() . " for reading: " . $php_errormsg);
     }
     parent::__construct($stream);
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:23,代码来源:FileInputStream.php

示例8: __construct

 /**
  * Constructs a new ProjectConfigurator object
  * This constructor is private. Use a static call to
  * <code>configureProject</code> to configure a project.
  *
  * @param  Project $project     the Project instance this configurator should use
  * @param  PhingFile $buildFile the buildfile object the parser should use
  */
 public function __construct(Project $project, PhingFile $buildFile)
 {
     $this->project = $project;
     $this->buildFile = new PhingFile($buildFile->getAbsolutePath());
     $this->buildFileParent = new PhingFile($this->buildFile->getParent());
     $this->parseEndTarget = new Target();
 }
开发者ID:xxspartan16,项目名称:BMS-Market,代码行数:15,代码来源:ProjectConfigurator.php

示例9: build

 /**
  * Uses a builder class to create the output class.
  * This method assumes that the DataModelBuilder class has been initialized with the build properties.
  * @param      OMBuilder $builder
  * @param      boolean $overwrite Whether to overwrite existing files with te new ones (default is YES).
  * @todo       -cPropelOMTask Consider refactoring build() method into AbstractPropelDataModelTask (would need to be more generic).
  */
 protected function build(OMBuilder $builder, $overwrite = true)
 {
     $path = $builder->getClassFilePath();
     $this->ensureDirExists(dirname($path));
     $_f = new PhingFile($this->getOutputDirectory(), $path);
     // skip files already created once
     if ($_f->exists() && !$overwrite) {
         $this->log("\t-> (exists) " . $builder->getClassFilePath(), Project::MSG_VERBOSE);
         return 0;
     }
     $script = $builder->build();
     foreach ($builder->getWarnings() as $warning) {
         $this->log($warning, Project::MSG_WARN);
     }
     // skip unchanged files
     if ($_f->exists() && $script == $_f->contents()) {
         $this->log("\t-> (unchanged) " . $builder->getClassFilePath(), Project::MSG_VERBOSE);
         return 0;
     }
     // write / overwrite new / changed files
     $action = $_f->exists() ? 'Updating' : 'Creating';
     $this->log(sprintf("\t-> %s %s (table: %s, builder: %s)", $action, $builder->getClassFilePath(), $builder->getTable()->getName(), get_class($builder)));
     file_put_contents($_f->getAbsolutePath(), $script);
     return 1;
 }
开发者ID:rodolfobais,项目名称:proylectura,代码行数:32,代码来源:PropelOMTask.php

示例10: archiveIsUpToDate

 /**
  * @param array $files array of filenames
  * @param PhingFile $dir
  * @return boolean
  */
 protected function archiveIsUpToDate($files, $dir)
 {
     $sfs = new SourceFileScanner($this);
     $mm = new MergeMapper();
     $mm->setTo($this->zipFile->getAbsolutePath());
     return count($sfs->restrict($files, $dir, null, $mm)) == 0;
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:12,代码来源:ZipTask.php

示例11: parseFile

    /**
     *
     */
    public function parseFile($xmlFile)
    {
        try {

            $this->data = array();
			
            try {
                $fr = new FileReader($xmlFile);
            } catch (Exception $e) {
                $f = new PhingFile($xmlFile);
                throw new BuildException("XML File not found: " . $f->getAbsolutePath());
            }

            $br = new BufferedReader($fr);

            $this->parser = new ExpatParser($br);
            $this->parser->parserSetOption(XML_OPTION_CASE_FOLDING, 0);
            $this->parser->setHandler($this);

            try {
                $this->parser->parse();
            } catch (Exception $e) {
                print $e->getMessage() . "\n";
                $br->close();
            }
            $br->close();
        } catch (Exception $e) {
            print $e->getMessage() . "\n";
            print $e->getTraceAsString();
        }

        return $this->data;
    }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:36,代码来源:XmlToData.php

示例12: parseFile

 /**
  * {@inheritDoc}
  */
 public function parseFile(PhingFile $file)
 {
     if (!$file->canRead()) {
         throw new IOException("Unable to read file: " . $file);
     }
     try {
         // We load the Yaml class without the use of namespaces to prevent
         // parse errors in PHP 5.2.
         $parserClass = '\\Symfony\\Component\\Yaml\\Parser';
         $parser = new $parserClass();
         // Cast properties to array in case parse() returns null.
         $properties = (array) $parser->parse(file_get_contents($file->getAbsolutePath()));
     } catch (Exception $e) {
         if (is_a($e, '\\Symfony\\Component\\Yaml\\Exception\\ParseException')) {
             throw new IOException("Unable to parse contents of " . $file . ": " . $e->getMessage());
         }
         throw $e;
     }
     $flattenedProperties = $this->flattenArray($properties);
     foreach ($flattenedProperties as $key => $flattenedProperty) {
         if (is_array($flattenedProperty)) {
             $flattenedProperties[$key] = implode(',', $flattenedProperty);
         }
     }
     return $flattenedProperties;
 }
开发者ID:Geeklog-Japan,项目名称:geeklog-japan,代码行数:29,代码来源:YamlFileParser.php

示例13: checkFileExists

 public function checkFileExists()
 {
     //Get the correct path to asset
     switch ($this->type) {
         case Asset::ASSET_TYPE_CSS:
             $this->assetFolder = $this->paths['css'];
             break;
         case Asset::ASSET_TYPE_JS:
             $this->assetFolder = $this->paths['js'];
             break;
         case Asset::ASSET_TYPE_IMAGE:
             $this->assetFolder = $this->paths['images'];
             break;
         default:
             $folder = '';
     }
     //Path to file
     $file = new PhingFile($this->assetsDir . '/' . $this->assetFolder . $this->file);
     //Check file exists
     if (!$file->exists()) {
         throw new BuildException("Unable to find asset file: " . $file->getAbsolutePath());
     }
     //Check we can read it
     if (!$file->canRead()) {
         throw IOException("Unable to read asset file: " . $file->getPath());
     }
     return $file;
 }
开发者ID:rcrowe,项目名称:phing-asset,代码行数:28,代码来源:Asset.php

示例14: main

 /**
  * do the work
  * @throws BuildException
  */
 public function main()
 {
     if ($this->zipFile === null) {
         throw new BuildException("zipFile attribute must be set!", $this->getLocation());
     }
     if ($this->zipFile->exists() && $this->zipFile->isDirectory()) {
         throw new BuildException("zipFile is a directory!", $this->getLocation());
     }
     if ($this->zipFile->exists() && !$this->zipFile->canWrite()) {
         throw new BuildException("Can not write to the specified zipFile!", $this->getLocation());
     }
     // shouldn't need to clone, since the entries in filesets
     // themselves won't be modified -- only elements will be added
     $savedFileSets = $this->filesets;
     try {
         if (empty($this->filesets)) {
             throw new BuildException("You must supply some nested filesets.", $this->getLocation());
         }
         $this->log("Building ZIP: " . $this->zipFile->__toString(), Project::MSG_INFO);
         $zip = new PclZip($this->zipFile->getAbsolutePath());
         if ($zip->errorCode() != 1) {
             throw new Exception("PclZip::open() failed: " . $zip->errorInfo());
         }
         foreach ($this->filesets as $fs) {
             $files = $fs->getFiles($this->project, $this->includeEmpty);
             $fsBasedir = null != $this->baseDir ? $this->baseDir : $fs->getDir($this->project);
             $filesToZip = array();
             for ($i = 0, $fcount = count($files); $i < $fcount; $i++) {
                 $f = new PhingFile($fsBasedir, $files[$i]);
                 //$filesToZip[] = realpath($f->getPath());
                 $fileAbsolutePath = $f->getPath();
                 $fileDir = rtrim(dirname($fileAbsolutePath), '/\\');
                 $fileBase = basename($fileAbsolutePath);
                 if (substr($fileDir, -4) == '.svn') {
                     continue;
                 }
                 if ($fileBase == '.svn') {
                     continue;
                 }
                 if (substr(rtrim($fileAbsolutePath, '/\\'), -4) == '.svn') {
                     continue;
                 }
                 //echo "\t\t$fileAbsolutePath\n";
                 $filesToZip[] = $f->getPath();
             }
             /*
             $zip->add($filesToZip,
             	PCLZIP_OPT_ADD_PATH, is_null($this->prefix) ? '' : $this->prefix ,
             	PCLZIP_OPT_REMOVE_PATH, realpath($fsBasedir->getPath()) );
             */
             $zip->add($filesToZip, PCLZIP_OPT_ADD_PATH, is_null($this->prefix) ? '' : $this->prefix, PCLZIP_OPT_REMOVE_PATH, $fsBasedir->getPath());
         }
     } catch (IOException $ioe) {
         $msg = "Problem creating ZIP: " . $ioe->getMessage();
         $this->filesets = $savedFileSets;
         throw new BuildException($msg, $ioe, $this->getLocation());
     }
     $this->filesets = $savedFileSets;
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:63,代码来源:ZipmeTask.php

示例15: run

 /**
  * Runs phpDocumentor 2 
  */
 public function run()
 {
     $this->initializePhpDocumentor();
     $cache = $this->app['descriptor.cache'];
     $cache->getOptions()->setCacheDir($this->destDir->getAbsolutePath());
     $this->parseFiles();
     $this->project->log("Transforming...", Project::MSG_VERBOSE);
     $this->transformFiles();
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:12,代码来源:PhpDocumentor2Wrapper.php


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