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


PHP FileUtil::makePath方法代码示例

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


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

示例1: createTargetDir

 /**
  * @see Installer::createTargetDir()
  */
 protected function createTargetDir()
 {
     if (!@is_dir($this->targetDir)) {
         if (!FileUtil::makePath($this->targetDir, IS_APACHE_MODULE ? 0777 : 0755)) {
             throw new SystemException("Could not create dir '" . $this->targetDir . "'", 11011);
         }
     }
     if (IS_APACHE_MODULE || !is_writeable($this->targetDir)) {
         $this->makeWriteable($this->targetDir);
     }
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:14,代码来源:FileInstaller.class.php

示例2: cloneDirectory

 /**
  * Clones a directory.
  * 
  * @param	string		$buildDirectory
  * @param	string		$path
  */
 protected function cloneDirectory($buildDirectory, $path)
 {
     $path = FileUtil::addTrailingSlash($path);
     // ensure source directory exists
     if (!is_dir($this->resourceDirectory . $path)) {
         throw new SystemException("Required path '" . $path . "' within resource directory is not available.");
     }
     // create path
     if (!is_dir($buildDirectory . $path)) {
         FileUtil::makePath($buildDirectory . $path);
     }
     // copy files recursively
     $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->resourceDirectory . $path));
     while ($it->valid()) {
         if (!$it->isDot()) {
             // ignore .svn directories
             $tmp = explode('/', FileUtil::unifyDirSeperator($it->getSubPath()));
             if (in_array('.svn', $tmp)) {
                 $it->next();
                 continue;
             }
             $subPath = FileUtil::addTrailingSlash($it->getSubPath());
             if (!is_dir($buildDirectory . $path . $subPath)) {
                 FileUtil::makePath($buildDirectory . $path . $subPath);
             }
             copy($it->key(), $buildDirectory . $path . $it->getSubPathName());
         }
         $it->next();
     }
 }
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:36,代码来源:StandalonePackageBuilder.class.php

示例3: verifyPackages

 /**
  * Verifies if all neccessary packages are present
  *
  * @param	string	$packageType
  * @param	string	$directory
  */
 public function verifyPackages($packageType, $directory)
 {
     $directory = $this->source->sourceDirectory . $directory;
     // break if package type is unknown
     if (!isset($this->package[$packageType])) {
         return;
     }
     foreach ($this->package[$packageType] as $packageName => $package) {
         // we do not care about referenced packages with an empty file attribute
         if (empty($package['file'])) {
             continue;
         }
         // check for file in optionals/requiredments folder
         if (file_exists($directory . $package['file'])) {
             continue;
         }
         // look for previously built packages
         $location = PackageHelper::searchPackage($packageName);
         if (!is_null($location)) {
             if (!@copy($location, $directory . $package['file'])) {
                 throw new SystemException('Unable to copy archive (' . $package['file'] . '), check permissions for directory ' . $directory);
             }
             // register temporary file
             PackageHelper::registerTemporaryFile($directory . $package['file']);
             continue;
         }
         // set minimum required version or null if version does not matter
         $minVersion = isset($package['minversion']) ? $package['minversion'] : null;
         // search within cached packages
         $location = PackageHelper::searchCachedPackage($this->source->sourceID, $packageName, $minVersion);
         if (!is_null($location)) {
             $packageData = new PackageReader($this->source, $location);
             $pb = new PackageBuilder($this->source, $packageData, $location, 'pn', array(), true, true);
             // add directory if it does not exist
             FileUtil::makePath(dirname($directory . $package['file']), 0777);
             // copy archive
             if (!@copy($pb->getArchiveLocation(), $directory . $package['file'])) {
                 throw new SystemException('Unable to copy archive (' . $package['file'] . '), check permissions for directory ' . $directory);
             }
             // register temporary file
             PackageHelper::registerTemporaryFile($directory . $package['file']);
             continue;
         }
         // we were unable to locate or build package, thus we have no chance to build this package
         throw new SystemException('Can not build package, ' . $package['file'] . ' not found.');
     }
 }
开发者ID:ZerGabriel,项目名称:PackageBuilder,代码行数:53,代码来源:PackageBuilder.class.php


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