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


PHP PhingFile::isDirectory方法代码示例

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


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

示例1: main

 public function main()
 {
     if ($this->dataDir === null || !$this->dataDir->isDirectory()) {
         $path = $this->dataDir ? $this->dataDir->getAbsolutePath() : '';
         $message = sprintf('Unable to apply migrations. EC-CUBE data directory not available at "%s"', $path);
         throw new BuildException($message);
     }
     if ($this->htmlDir === null || !$this->htmlDir->isDirectory()) {
         $path = $this->htmlDir ? $this->htmlDir->getAbsolutePath() : '';
         $message = sprintf('Unable to apply migrations. EC-CUBE html directory not available at "%s"', $path);
         throw new BuildException($message);
     }
     $this->setupDatabase();
 }
开发者ID:zenith6,项目名称:eccube-zeclib,代码行数:14,代码来源:MigrationSetupTask.php

示例2: checkPreconditions

 /**
  * @throws BuildException
  */
 private function checkPreconditions()
 {
     if (is_null($this->destinationFile)) {
         throw new BuildException("destfile attribute must be set!", $this->getLocation());
     }
     if ($this->destinationFile->exists() && $this->destinationFile->isDirectory()) {
         throw new BuildException("destfile is a directory!", $this->getLocation());
     }
     if (!$this->destinationFile->canWrite()) {
         throw new BuildException("Can not write to the specified destfile!", $this->getLocation());
     }
     if (!is_null($this->baseDirectory)) {
         if (!$this->baseDirectory->exists()) {
             throw new BuildException("basedir '" . (string) $this->baseDirectory . "' does not exist!", $this->getLocation());
         }
     }
     if ($this->signatureAlgorithm == Phar::OPENSSL) {
         if (!extension_loaded('openssl')) {
             throw new BuildException("PHP OpenSSL extension is required for OpenSSL signing of Phars!", $this->getLocation());
         }
         if (is_null($this->key)) {
             throw new BuildException("key attribute must be set for OpenSSL signing!", $this->getLocation());
         }
         if (!$this->key->exists()) {
             throw new BuildException("key '" . (string) $this->key . "' does not exist!", $this->getLocation());
         }
         if (!$this->key->canRead()) {
             throw new BuildException("key '" . (string) $this->key . "' cannot be read!", $this->getLocation());
         }
     }
 }
开发者ID:namesco,项目名称:phing,代码行数:34,代码来源:PharPackageTask.php

示例3: 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

示例4: main

 /**
  *  Run the task.
  *
  * @throws BuildException  trouble, probably file IO
  */
 public function main()
 {
     if ($this->prefix != null && $this->regex != null) {
         throw new BuildException("Please specify either prefix or regex, but not both", $this->getLocation());
     }
     //copy the properties file
     $allProps = array();
     /* load properties from file if specified, otherwise use Phing's properties */
     if ($this->inFile == null) {
         // add phing properties
         $allProps = $this->getProject()->getProperties();
     } elseif ($this->inFile != null) {
         if ($this->inFile->exists() && $this->inFile->isDirectory()) {
             $message = "srcfile is a directory!";
             $this->failOnErrorAction(null, $message, Project::MSG_ERR);
             return;
         }
         if ($this->inFile->exists() && !$this->inFile->canRead()) {
             $message = "Can not read from the specified srcfile!";
             $this->failOnErrorAction(null, $message, Project::MSG_ERR);
             return;
         }
         try {
             $props = new Properties();
             $props->load(new PhingFile($this->inFile));
             $allProps = $props->getProperties();
         } catch (IOException $ioe) {
             $message = "Could not read file " . $this->inFile->getAbsolutePath();
             $this->failOnErrorAction($ioe, $message, Project::MSG_WARN);
             return;
         }
     }
     $os = null;
     try {
         if ($this->destfile == null) {
             $os = Phing::getOutputStream();
             $this->saveProperties($allProps, $os);
             $this->log($os, Project::MSG_INFO);
         } else {
             if ($this->destfile->exists() && $this->destfile->isDirectory()) {
                 $message = "destfile is a directory!";
                 $this->failOnErrorAction(null, $message, Project::MSG_ERR);
                 return;
             }
             if ($this->destfile->exists() && !$this->destfile->canWrite()) {
                 $message = "Can not write to the specified destfile!";
                 $this->failOnErrorAction(null, $message, Project::MSG_ERR);
                 return;
             }
             $os = new FileOutputStream($this->destfile);
             $this->saveProperties($allProps, $os);
         }
     } catch (IOException $ioe) {
         $this->failOnErrorAction($ioe);
     }
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:61,代码来源:EchoProperties.php

示例5: 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 = $this->baseDir != null ? $this->baseDir : $fs->getDir($this->project);
             $filesToZip = array();
             foreach ($files as $file) {
                 $f = new PhingFile($fsBasedir, $file);
                 $fileAbsolutePath = $f->getPath();
                 $fileDir = rtrim(dirname($fileAbsolutePath), '/\\');
                 $fileBase = basename($fileAbsolutePath);
                 // Only use lowercase for $disallowedBases because we'll convert $fileBase to lowercase
                 $disallowedBases = array('.ds_store', '.svn', '.gitignore', 'thumbs.db');
                 $fileBaseLower = strtolower($fileBase);
                 if (in_array($fileBaseLower, $disallowedBases)) {
                     continue;
                 }
                 if (substr($fileDir, -4) == '.svn') {
                     continue;
                 }
                 if (substr(rtrim($fileAbsolutePath, '/\\'), -4) == '.svn') {
                     continue;
                 }
                 $filesToZip[] = $fileAbsolutePath;
             }
             $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:Coyotejld,项目名称:buildfiles,代码行数:60,代码来源:ZipmeTask.php

示例6: main

 /**
  * {@inheritdoc}
  *
  * @throws BuildException
  * @throws IOException
  */
 public function main()
 {
     if ($this->dir == null) {
         throw new BuildException("missing dir");
     }
     if ($this->name == null) {
         throw new BuildException("missing name");
     }
     if ($this->pathRefId == null) {
         throw new BuildException("missing pathrefid");
     }
     if (!$this->dir->isDirectory()) {
         throw new BuildException($this->dir->toString() . " is not a directory");
     }
     $path = $this->getProject()->getReference($this->pathRefId);
     if ($path == null) {
         throw new BuildException("Unknown reference " . $this->pathRefId);
     }
     if (!$path instanceof Path) {
         throw new BuildException($this->pathRefId . " is not a path");
     }
     $sources = $path->listPaths();
     $fileSet = new FileSet();
     $fileSet->setProject($this->getProject());
     $fileSet->setDir($this->dir);
     $fileUtils = new FileUtils();
     $dirNormal = $fileUtils->normalize($this->dir->getAbsolutePath());
     $dirNormal = rtrim($dirNormal, PhingFile::$separator) . PhingFile::$separator;
     $atLeastOne = false;
     for ($i = 0; $i < count($sources); ++$i) {
         $sourceFile = new PhingFile($sources[$i]);
         if (!$sourceFile->exists()) {
             continue;
         }
         $includePattern = $this->getIncludePattern($dirNormal, $sourceFile);
         if ($includePattern === false && !$this->ignoreNonRelative) {
             throw new BuildException($sources[$i] . " is not relative to " . $this->dir->getAbsolutePath());
         }
         if ($includePattern === false) {
             continue;
         }
         $fileSet->createInclude()->setName($includePattern);
         $atLeastOne = true;
     }
     if (!$atLeastOne) {
         $fileSet->createInclude()->setName("a:b:c:d//THis si &&& not a file !!! ");
     }
     $this->getProject()->addReference($this->name, $fileSet);
 }
开发者ID:nhallpot,项目名称:CSCrew2015-back,代码行数:55,代码来源:PathToFileSet.php

示例7: checkPreconditions

 /**
  * @throws BuildException
  */
 private function checkPreconditions()
 {
     if (is_null($this->destinationFile)) {
         throw new BuildException("destfile attribute must be set!", $this->getLocation());
     }
     if ($this->destinationFile->exists() && $this->destinationFile->isDirectory()) {
         throw new BuildException("destfile is a directory!", $this->getLocation());
     }
     if (!$this->destinationFile->canWrite()) {
         throw new BuildException("Can not write to the specified destfile!", $this->getLocation());
     }
     if (!is_null($this->baseDirectory)) {
         if (!$this->baseDirectory->exists()) {
             throw new BuildException("basedir '" . (string) $this->baseDirectory . "' does not exist!", $this->getLocation());
         }
     }
 }
开发者ID:altesien,项目名称:FinalProject,代码行数:20,代码来源:PharPackageTask.php

示例8: validateAttributes

 /**
  * Validates attributes coming in from XML
  *
  * @return void
  * @throws BuildException
  */
 protected function validateAttributes()
 {
     if ($this->file === null && count($this->filesets) === 0) {
         throw new BuildException("Specify at least one source compressed archive - a file or a fileset.");
     }
     if ($this->todir === null) {
         throw new BuildException("todir must be set.");
     }
     if ($this->todir !== null && $this->todir->exists() && !$this->todir->isDirectory()) {
         throw new BuildException("todir must be a directory.");
     }
     if ($this->file !== null && $this->file->exists() && $this->file->isDirectory()) {
         throw new BuildException("Compressed archive file cannot be a directory.");
     }
     if ($this->file !== null && !$this->file->exists()) {
         throw new BuildException("Could not find compressed archive file " . $this->file->__toString() . " to extract.");
     }
 }
开发者ID:Ingewikkeld,项目名称:phing,代码行数:24,代码来源:ExtractBaseTask.php

示例9: main

 /**
  * do the work
  *
  * @throws BuildException
  */
 public function main()
 {
     if ($this->jpaFile === null) {
         throw new BuildException("jpafile attribute must be set!", $this->getLocation());
     }
     if ($this->jpaFile->exists() && $this->jpaFile->isDirectory()) {
         throw new BuildException("jpafile is a directory!", $this->getLocation());
     }
     if ($this->jpaFile->exists() && !$this->jpaFile->canWrite()) {
         throw new BuildException("Can not write to the specified jpafile!", $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 JPA: " . $this->jpaFile->__toString(), Project::MSG_INFO);
         $jpa = new JPAMaker();
         $res = $jpa->create($this->jpaFile->getAbsolutePath());
         if ($res !== true) {
             throw new Exception("JPAMaker::open() failed: " . $jpa->error);
         }
         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]);
                 $pathInJPA = $this->prefix . $f->getPathWithoutBase($fsBasedir);
                 $jpa->addFile($f->getPath(), $pathInJPA);
                 $this->log("Adding " . $f->getPath() . " as " . $pathInJPA . " to archive.", Project::MSG_VERBOSE);
             }
         }
         $jpa->finalize();
     } catch (IOException $ioe) {
         $msg = "Problem creating JPA: " . $ioe->getMessage();
         $this->filesets = $savedFileSets;
         throw new BuildException($msg, $ioe, $this->getLocation());
     }
     $this->filesets = $savedFileSets;
 }
开发者ID:Coyotejld,项目名称:buildfiles,代码行数:48,代码来源:JPATask.php

示例10: checkPreconditions

 /**
  * @throws BuildException
  */
 private function checkPreconditions()
 {
     if (!extension_loaded('phar')) {
         throw new BuildException("PharDataTask require either PHP 5.3 or better or the PECL's Phar extension");
     }
     if (is_null($this->destinationFile)) {
         throw new BuildException("destfile attribute must be set!", $this->getLocation());
     }
     if ($this->destinationFile->exists() && $this->destinationFile->isDirectory()) {
         throw new BuildException("destfile is a directory!", $this->getLocation());
     }
     if (!$this->destinationFile->canWrite()) {
         throw new BuildException("Can not write to the specified destfile!", $this->getLocation());
     }
     if (is_null($this->baseDirectory)) {
         throw new BuildException("basedir cattribute must be set", $this->getLocation());
     }
     if (!$this->baseDirectory->exists()) {
         throw new BuildException("basedir '" . (string) $this->baseDirectory . "' does not exist!", $this->getLocation());
     }
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:24,代码来源:PharDataTask.php

示例11: main

 /**
  * Execute the touch operation.
  * @throws BuildException
  */
 public function main()
 {
     $savedMillis = $this->millis;
     if ($this->file === null && count($this->filesets) === 0) {
         throw new BuildException("Specify at least one source - a file or a fileset.");
     }
     if ($this->file !== null && $this->file->exists() && $this->file->isDirectory()) {
         throw new BuildException("Use a fileset to touch directories.");
     }
     try {
         // try to touch file
         if ($this->dateTime !== null) {
             $this->setMillis(strtotime($this->dateTime));
             if ($this->millis < 0) {
                 throw new BuildException("Date of {$this->dateTime} results in negative milliseconds value relative to epoch (January 1, 1970, 00:00:00 GMT).");
             }
         }
         $this->_touch();
     } catch (Exception $ex) {
         throw new BuildException("Error touch()ing file", $ex, $this->location);
     }
     $this->millis = $savedMillis;
 }
开发者ID:kenguest,项目名称:phing,代码行数:27,代码来源:TouchTask.php

示例12: deleteDir

 /** Go and delete the directory tree. */
 private function deleteDir($d)
 {
     $list = $d->listDir();
     if ($list === null) {
         return;
         // on an io error list() can return null
     }
     foreach ($list as $fname) {
         $f = new PhingFile($d, $fname);
         if ($f->isDirectory()) {
             $this->deleteDir($f);
         } else {
             throw new BuildException("UNEXPECTED ERROR - The file " . $f->getAbsolutePath() . " should not exist!");
         }
     }
     $this->log("Deleting directory " . $d->getPath(), $this->verbosity);
     try {
         $d->delete();
     } catch (Exception $e) {
         throw new BuildException("Unable to delete directory " . $d->__toString() . ": " . $e->getMessage());
     }
 }
开发者ID:halfer,项目名称:Meshing,代码行数:23,代码来源:MoveTask.php

示例13: _checkFile1

 /**
  * @param PhingFile $file
  * @return bool
  * @throws IOException
  */
 private function _checkFile1(PhingFile $file)
 {
     // Resolve symbolic links
     if ($this->followSymlinks && $file->isLink()) {
         $linkTarget = new PhingFile($file->getLinkTarget());
         if ($linkTarget->isAbsolute()) {
             $file = $linkTarget;
         } else {
             $fs = FileSystem::getFileSystem();
             $file = new PhingFile($fs->resolve($fs->normalize($file->getParent()), $fs->normalize($file->getLinkTarget())));
         }
     }
     if ($this->type !== null) {
         if ($this->type === "dir") {
             return $file->isDirectory();
         } else {
             if ($this->type === "file") {
                 return $file->isFile();
             }
         }
     }
     return $file->exists();
 }
开发者ID:Ingewikkeld,项目名称:phing,代码行数:28,代码来源:AvailableTask.php

示例14: isSelected

 /**
  * The heart of the matter. This is where the selector gets to decide
  * on the inclusion of a file in a particular fileset.
  *
  * @param PhingFile $basedir the base directory the scan is being done from
  * @param string $filename is the name of the file to check
  * @param PhingFile $file is a PhingFile object the selector can use
  * @return boolean Whether the file should be selected or not
  */
 public function isSelected(PhingFile $basedir, $filename, PhingFile $file)
 {
     // throw BuildException on error
     $this->validate();
     if ($file->isDirectory()) {
         return $this->type === 'dir';
     } else {
         return $this->type === 'file';
     }
 }
开发者ID:sensorsix,项目名称:app,代码行数:19,代码来源:TypeSelector.php

示例15: isSelected

 /**
  * The heart of the matter. This is where the selector gets to decide
  * on the inclusion of a file in a particular fileset.
  *
  * @param PhingFile $basedir
  * @param string $filename
  * @param PhingFile $file
  *
  * @throws BuildException
  *
  * @internal param the $basedir base directory the scan is being done from
  * @internal param is $filename the name of the file to check
  * @internal param a $file PhingFile object the selector can use
  *
  * @return bool whether the file should be selected or not
  */
 public function isSelected(PhingFile $basedir, $filename, PhingFile $file)
 {
     $this->validate();
     if ($file->isDirectory()) {
         return true;
     }
     $userstr = $this->contains;
     if (!$this->casesensitive) {
         $userstr = strtolower($this->contains);
     }
     $in = null;
     try {
         $in = new BufferedReader(new FileReader($file));
         $teststr = $in->readLine();
         while ($teststr !== null) {
             if (!$this->casesensitive) {
                 $teststr = strtolower($teststr);
             }
             if (strpos($teststr, $userstr) !== false) {
                 return true;
             }
             $teststr = $in->readLine();
         }
         $in->close();
         return false;
     } catch (IOException $ioe) {
         if ($in) {
             $in->close();
         }
         throw new BuildException("Could not read file " . $filename);
     }
 }
开发者ID:tammyd,项目名称:phing,代码行数:48,代码来源:ContainsSelector.php


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