Last active
March 31, 2016 10:50
-
-
Save c33s/2f238ed200b4ea2e3d3da87c512f2597 to your computer and use it in GitHub Desktop.
filesytem.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dummy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
λ composer update | |
creating backup of json file | |
converting to json | |
The "franzl/studio" plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example). | |
Loading composer repositories with package information | |
Updating dependencies (including require-dev) | |
Your requirements could not be resolved to an installable set of packages. | |
Problem 1 | |
- symfony/filesystem 3.1.x-dev requires php >=5.5.9 -> your PHP version (5.6.17) overriden by "config.platform.php" version (5.3.9) does not satisfy that requirement. | |
- symfony/filesystem 3.1.x-dev requires php >=5.5.9 -> your PHP version (5.6.17) overriden by "config.platform.php" version (5.3.9) does not satisfy that requirement. | |
- symfony/filesystem 3.0.x-dev requires php >=5.5.9 -> your PHP version (5.6.17) overriden by "config.platform.php" version (5.3.9) does not satisfy that requirement. | |
- symfony/filesystem 3.0.x-dev requires php >=5.5.9 -> your PHP version (5.6.17) overriden by "config.platform.php" version (5.3.9) does not satisfy that requirement. | |
- sensio/distribution-bundle v5.0.5 requires symfony/filesystem ~2.3|~3.0 -> satisfiable by symfony/filesystem[3.1.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev]. | |
- sensio/distribution-bundle v5.0.4 requires symfony/filesystem ~2.3|~3.0 -> satisfiable by symfony/filesystem[3.1.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev]. | |
- sensio/distribution-bundle v5.0.3 requires symfony/filesystem ~2.3|~3.0 -> satisfiable by symfony/filesystem[3.1.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev]. | |
- sensio/distribution-bundle v5.0.2 requires symfony/filesystem ~2.3|~3.0 -> satisfiable by symfony/filesystem[3.1.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev]. | |
- sensio/distribution-bundle v5.0.1 requires symfony/filesystem ~2.3|~3.0 -> satisfiable by symfony/filesystem[3.1.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev]. | |
- sensio/distribution-bundle v5.0.0 requires symfony/filesystem ~2.3|~3.0 -> satisfiable by symfony/filesystem[3.1.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev]. | |
- sensio/distribution-bundle v5.0.5 requires symfony/filesystem ~2.3|~3.0 -> satisfiable by symfony/filesystem[3.1.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev]. | |
- Can only install one of: symfony/filesystem[2.3.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.4.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.5.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.6.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.7.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.8.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.3.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.4.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.5.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.6.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.7.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.8.x-dev, dev-c33s-fs-win-symlink]. | |
- Installation request for symfony/filesystem dev-c33s-fs-win-symlink -> satisfiable by symfony/filesystem[dev-c33s-fs-win-symlink]. | |
- Installation request for sensio/distribution-bundle ~5.0 -> satisfiable by sensio/distribution-bundle[v5.0.0, v5.0.1, v5.0.2, v5.0.3, v5.0.4, v5.0.5]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
λ composer update | |
creating backup of json file | |
converting to json | |
The "franzl/studio" plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example). | |
Loading composer repositories with package information | |
Updating dependencies (including require-dev) | |
Your requirements could not be resolved to an installable set of packages. | |
Problem 1 | |
- sensio/distribution-bundle v5.0.5 requires symfony/filesystem ~2.3|~3.0 -> satisfiable by symfony/filesystem[3.1.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev]. | |
- sensio/distribution-bundle v5.0.0 requires symfony/filesystem ~2.3|~3.0 -> satisfiable by symfony/filesystem[3.1.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev]. | |
- sensio/distribution-bundle v5.0.1 requires symfony/filesystem ~2.3|~3.0 -> satisfiable by symfony/filesystem[3.1.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev]. | |
- sensio/distribution-bundle v5.0.2 requires symfony/filesystem ~2.3|~3.0 -> satisfiable by symfony/filesystem[3.1.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev]. | |
- sensio/distribution-bundle v5.0.3 requires symfony/filesystem ~2.3|~3.0 -> satisfiable by symfony/filesystem[3.1.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev]. | |
- sensio/distribution-bundle v5.0.4 requires symfony/filesystem ~2.3|~3.0 -> satisfiable by symfony/filesystem[3.1.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev]. | |
- sensio/distribution-bundle v5.0.5 requires symfony/filesystem ~2.3|~3.0 -> satisfiable by symfony/filesystem[3.1.x-dev, 2.3.x-dev, 2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev]. | |
- Can only install one of: symfony/filesystem[2.3.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.4.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.5.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.6.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.7.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.8.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.3.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.4.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.5.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.6.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.7.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[2.8.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[3.0.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[3.0.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[3.1.x-dev, dev-c33s-fs-win-symlink]. | |
- Can only install one of: symfony/filesystem[3.1.x-dev, dev-c33s-fs-win-symlink]. | |
- Installation request for symfony/filesystem dev-c33s-fs-win-symlink -> satisfiable by symfony/filesystem[dev-c33s-fs-win-symlink]. | |
- Installation request for sensio/distribution-bundle ~5.0 -> satisfiable by sensio/distribution-bundle[v5.0.0, v5.0.1, v5.0.2, v5.0.3, v5.0.4, v5.0.5]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: symfony/framework-standard-edition | |
license: MIT | |
type: project | |
description: 'The "Symfony Standard Edition" distribution' | |
repositories: | |
- | |
type: vcs | |
url: 'https://github.com/c33s/filesystem' | |
autoload: | |
psr-4: { '': src/ } | |
classmap: [app/AppKernel.php, app/AppCache.php] | |
require: | |
php: '>=5.3.9' | |
symfony/symfony: '2.8.*' | |
doctrine/orm: ^2.4.8 | |
doctrine/doctrine-bundle: ~1.4 | |
symfony/swiftmailer-bundle: ~2.3 | |
symfony/monolog-bundle: ~2.4 | |
sensio/distribution-bundle: ~5.0 | |
sensio/framework-extra-bundle: ^3.0.2 | |
incenteev/composer-parameter-handler: ~2.0 | |
symfony/filesystem: dev-c33s-fs-win-symlink | |
require-dev: | |
sensio/generator-bundle: ~3.0 | |
symfony/phpunit-bridge: ~2.7 | |
scripts: | |
post-install-cmd: ['Incenteev\ParameterHandler\ScriptHandler::buildParameters', 'Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap', 'Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache', 'Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets', 'Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile', 'Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget'] | |
post-update-cmd: ['Incenteev\ParameterHandler\ScriptHandler::buildParameters', 'Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap', 'Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache', 'Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets', 'Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile', 'Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget'] | |
config: | |
bin-dir: bin | |
platform: { php: 5.3.9 } | |
extra: | |
symfony-app-dir: app | |
symfony-web-dir: web | |
symfony-assets-install: relative | |
incenteev-parameters: { file: app/config/parameters.yml } | |
branch-alias: { dev-master: 2.8-dev } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
protected function existsMklinkExecutable() | |
{ | |
if ($this->getMklinkExecutable()) { | |
return true; | |
} | |
return false; | |
} | |
protected function getMklinkExecutable() | |
{ | |
//$executableFinder = new ExecutableFinder(); | |
//$executableFinder->find('mklink'); | |
$cmd = 'mklink'; | |
return $cmd; | |
} | |
protected function createWindowsJunction($originDir, $targetDir) | |
{ | |
$linker = $this->getMklinkExecutable(); | |
$targetBaseDir = dirname($targetDir); | |
$linkName = basename($targetDir); | |
$process = new Process("cd $targetBaseDir && $linker /J /D \"$linkName\" \"$originDir\""); | |
$process | |
->setTimeout(null) | |
->run(function ($type, $buffer) { | |
echo '> '.$buffer; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
λ php bin/console app:islink ../link_check | |
+--------------------------+----------------+--------+----------+--------+---------+----------------------------------+--------------------+--------------------+--------------------+-------------+ | |
| filename | should be link | isLink | filetype | is_dir | is_link | readlink | lstat | stat | array_diff | file_exists | | |
+--------------------------+----------------+--------+----------+--------+---------+----------------------------------+--------------------+--------------------+--------------------+-------------+ | |
| broken-hardlink-file.txt | false | NULL | file | | false | path: 'broken-hardlink-file.txt' | 'mode' => 33206, | 'mode' => 33206, | empty array | true | | |
| | | | | | | | 'size' => 0, | 'size' => 0, | | | | |
| broken-symlink-file.txt | false | NULL | link | | true | false | 'mode' => 41398, | 'mode' => 33206, | 'mode' => 33206, | false | | |
| | | | | | | | 'size' => 0, | 'size' => 0, | | | | |
| dir_broken_junction | false | NULL | unknown | 1 | false | false | 'mode' => 0, | 'mode' => 16895, | 'mode' => 16895, | false | | |
| | | | | | | | 'size' => 0, | 'size' => 0, | | | | |
| dir_junction | true | NULL | unknown | 1 | false | path: 'junction' | 'mode' => 0, | 'mode' => 16895, | 'mode' => 16895, | true | | |
| | | | | | | | 'size' => 0, | 'size' => 0, | | | | |
| dir_realdir | false | NULL | dir | 1 | false | path: 'dir_realdir' | 'mode' => 16895, | 'mode' => 16895, | empty array | true | | |
| | | | | | | | 'size' => 0, | 'size' => 0, | | | | |
| dir_symlink | true | NULL | link | 1 | true | path: 'symlink' | 'mode' => 41398, | 'mode' => 16895, | 'mode' => 16895, | true | | |
| | | | | | | | 'size' => 0, | 'size' => 0, | | | | |
| hardlink-file.txt | true | NULL | file | | false | path: 'hardlink-file.txt' | 'mode' => 33206, | 'mode' => 33206, | empty array | true | | |
| | | | | | | | 'size' => 2, | 'size' => 2, | | | | |
| realfile.txt | false | NULL | file | | false | path: 'realfile.txt' | 'mode' => 33206, | 'mode' => 33206, | empty array | true | | |
| | | | | | | | 'size' => 0, | 'size' => 0, | | | | |
| symlink-file.txt | true | NULL | link | | true | path: 'symlink-file.txt' | 'mode' => 41398, | 'mode' => 33206, | 'mode' => 33206, | true | | |
| | | | | | | | 'size' => 0, | 'size' => 0, | | | | |
+--------------------------+----------------+--------+----------+--------+---------+----------------------------------+--------------------+--------------------+--------------------+-------------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function isLink($filename) | |
{ | |
if ('\\' !== DIRECTORY_SEPARATOR){ | |
return is_link($filename); | |
} | |
// handle windows stuff | |
clearstatcache(); | |
// symlink | |
if (is_link($filename) && @filetype($filename) == 'link' && @readlink($filename)) { | |
return true; | |
} | |
$lstat = @lstat($filename); | |
$stat = @stat($filename); | |
// junction | |
if (file_exists($filename) && @filetype($filename) == 'unknown' && !empty(@array_diff( $stat, $lstat))) { | |
return true; | |
} | |
// file hardlink | |
if (@filetype($filename) == 'file' && is_array($lstat) && array_key_exists('size', $stat) && $stat['size'] == 2) { | |
return true; | |
} | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function symlink($originDir, $targetDir, $copyOnWindows = false) | |
{ | |
// var_dump('mine'); | |
if ('\\' === DIRECTORY_SEPARATOR && $copyOnWindows) { | |
$this->mirror($originDir, $targetDir); | |
return; | |
} | |
// var_dump('after copy'); | |
$this->mkdir(dirname($targetDir)); | |
$ok = false; | |
if ($this->isLink($targetDir)) { | |
if (readlink($targetDir) != $originDir) { | |
$this->remove($targetDir); | |
} else { | |
$ok = true; | |
} | |
} | |
// var_dump('after islink check'); | |
if ('\\' === DIRECTORY_SEPARATOR && $this->existsMklinkExecutable()) { | |
// var_dump('here'); | |
$this->createWindowsJunction($originDir, $targetDir); | |
$ok = true; | |
} | |
if (!$ok && true !== @symlink($originDir, $targetDir)) { | |
$report = error_get_last(); | |
if (is_array($report)) { | |
if ('\\' === DIRECTORY_SEPARATOR && false !== strpos($report['message'], 'error code(1314)')) { | |
throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', 0, null, $targetDir); | |
} | |
} | |
throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment