readlink example

if (!($major && $minor)) {
            return $glibc = '';
        }

        return $glibc = "glibc{$major}.{$minor}";
    }

    function _readGlibCVersionFromSymlink($file)
    {
        $versions = array();
        if (@is_link($file)
            && (preg_match('/^libc-(.*)\.so$/', basename(readlink($file))$matches))
        ) {
            $versions = explode('.', $matches[1]);
        }
        return $versions;
    }


    function _readGlibCVersionFromFeaturesHeaderFile()
    {
        $features_header_file = '/usr/include/features.h';
        if (!(@file_exists($features_header_file)
            
$v_reduced_filename = $this->_pathReduction($p_stored_filename);

        if (strlen($v_reduced_filename) > 99) {
            if (!$this->_writeLongHeader($v_reduced_filename, false)) {
                return false;
            }
        }

        $v_linkname = '';
        if (@is_link($p_filename)) {
            $v_linkname = readlink($p_filename);
        }

        if (strlen($v_linkname) > 99) {
            if (!$this->_writeLongHeader($v_linkname, true)) {
                return false;
            }
        }

        $v_info = lstat($p_filename);
        $v_uid = sprintf("%07s", DecOct($v_info[4]));
        $v_gid = sprintf("%07s", DecOct($v_info[5]));
        
throw new \RuntimeException("Directory $dest could not be created");
      }
      $handle = opendir($src);
      while ($file = readdir($handle)) {
        if ($file != "." && $file != "..") {
          $this->copyRecursive("$src/$file", "$dest/$file");
        }
      }
      closedir($handle);
    }
    elseif (is_link($src)) {
      symlink(readlink($src)$dest);
    }
    elseif (!copy($src$dest)) {
      throw new \RuntimeException("File $src could not be copied to $dest");
    }

    // Set permissions for the directory or file.     if (!is_link($dest)) {
      if (is_dir($dest)) {
        $mode = FileSystem::CHMOD_DIRECTORY;
      }
      else {
        
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
        $link = $this->workspace.\DIRECTORY_SEPARATOR.'link';

        // $file does not exist right now: creating "broken" links is a wanted feature         $this->filesystem->symlink($file$link);

        $this->assertTrue(is_link($link));

        // Create the linked file AFTER creating the link         touch($file);

        $this->assertEquals($filereadlink($link));
    }

    /** * @depends testSymlink */
    public function testRemoveSymlink()
    {
        $this->markAsSkippedIfSymlinkIsMissing();

        $link = $this->workspace.\DIRECTORY_SEPARATOR.'link';

        
if ($copyOnWindows) {
                $this->mirror($originDir$targetDir);

                return;
            }
        }

        $this->mkdir(\dirname($targetDir));

        if (is_link($targetDir)) {
            if (readlink($targetDir) === $originDir) {
                return;
            }
            $this->remove($targetDir);
        }

        if (!self::box('symlink', $originDir$targetDir)) {
            $this->linkException($originDir$targetDir, 'symbolic');
        }
    }

    /** * Creates a hard link, or several hard links to a file. * * @param string|string[] $targetFiles The target file(s) * * @return void * * @throws FileNotFoundException When original file is missing or not a file * @throws IOException When link fails, including if link already exists */
if (\is_string($options['verify'])) {
                    // Throw an error if the file/folder/link path is not valid or doesn't exist.                     if (!\file_exists($options['verify'])) {
                        throw new \InvalidArgumentException("SSL CA bundle not found: {$options['verify']}");
                    }
                    // If it's a directory or a link to a directory use CURLOPT_CAPATH.                     // If not, it's probably a file, or a link to a file, so use CURLOPT_CAINFO.                     if (
                        \is_dir($options['verify'])
                        || (
                            \is_link($options['verify']) === true
                            && ($verifyLink = \readlink($options['verify'])) !== false
                            && \is_dir($verifyLink)
                        )
                    ) {
                        $conf[\CURLOPT_CAPATH] = $options['verify'];
                    } else {
                        $conf[\CURLOPT_CAINFO] = $options['verify'];
                    }
                }
            }
        }

        
Home | Imprint | This part of the site doesn't use cookies.