本文整理汇总了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);
}
}
示例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();
}
}
示例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.');
}
}