本文整理汇总了PHP中PhingFile::isLink方法的典型用法代码示例。如果您正苦于以下问题:PHP PhingFile::isLink方法的具体用法?PHP PhingFile::isLink怎么用?PHP PhingFile::isLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhingFile
的用法示例。
在下文中一共展示了PhingFile::isLink方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _checkFile1
private function _checkFile1(PhingFile $file)
{
// Resolve symbolic links
if ($this->followSymlinks && $file->isLink()) {
$file = new PhingFile($file->getLinkTarget());
}
if ($this->type !== null) {
if ($this->type === "dir") {
return $file->isDirectory();
} else {
if ($this->type === "file") {
return $file->isFile();
}
}
}
return $file->exists();
}
示例2: copy
/**
* Copy a file, takes care of symbolic links
*
* @param PhingFile $src Source path and name file to copy.
* @param PhingFile $dest Destination path and name of new file.
*
* @return void
* @throws Exception if file cannot be copied.
*/
function copy(PhingFile $src, PhingFile $dest)
{
global $php_errormsg;
if (!$src->isLink()) {
return parent::copy($src, $dest);
}
$srcPath = $src->getAbsolutePath();
$destPath = $dest->getAbsolutePath();
$linkTarget = $src->getLinkTarget();
if (false === @symlink($linkTarget, $destPath)) {
$msg = "FileSystem::copy() FAILED. Cannot create symlink from {$destPath} to {$linkTarget}.";
throw new Exception($msg);
}
}
示例3: addFilesetsToArchive
/**
* @param $zip
*/
private function addFilesetsToArchive($zip)
{
foreach ($this->filesets as $fs) {
$fsBasedir = null != $this->baseDir ? $this->baseDir : $fs->getDir($this->project);
$files = $fs->getFiles($this->project, $this->includeEmpty);
for ($i = 0, $fcount = count($files); $i < $fcount; $i++) {
$f = new PhingFile($fsBasedir, $files[$i]);
$pathInZip = $this->prefix . $f->getPathWithoutBase($fsBasedir);
$pathInZip = str_replace('\\', '/', $pathInZip);
if ($this->ignoreLinks && $f->isLink()) {
continue;
} elseif ($f->isDirectory()) {
if ($pathInZip != '.') {
$zip->addEmptyDir($pathInZip);
}
} else {
$zip->addFile($f->getAbsolutePath(), $pathInZip);
}
$this->log("Adding " . $f->getPath() . " as " . $pathInZip . " to archive.", Project::MSG_VERBOSE);
}
}
}
示例4: _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();
}
示例5: 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->isLink()) {
if ($this->type == 'link') {
return true;
}
$this->log($file->getAbsolutePath() . " is a link, proceeding with " . $file->getCanonicalPath() . " instead.", Project::MSG_DEBUG);
$file = new PhingFile($file->getCanonicalPath());
}
if ($file->isDirectory()) {
return $this->type === 'dir';
} else {
return $this->type === 'file';
}
}