Neos\Flow\Core\Migrations\Git::move PHP Метод

move() публичный статический Метод

public static move ( string $source, string $target ) : integer
$source string
$target string
Результат integer
    public static function move($source, $target)
    {
        $result = 255;
        system('git mv ' . escapeshellarg($source) . ' ' . escapeshellarg($target), $result);
        return $result;
    }

Usage Example

 /**
  * Applies all registered moveFile operations.
  *
  * @return void
  */
 protected function applyFileOperations()
 {
     foreach ($this->operations['moveFile'] as $operation) {
         $oldPath = Files::concatenatePaths(array($this->targetPackageData['path'] . '/' . $operation[0]));
         $newPath = Files::concatenatePaths(array($this->targetPackageData['path'] . '/' . $operation[1]));
         if (substr($oldPath, -1) === '*') {
             $oldPath = substr($oldPath, 0, -1);
             if (!file_exists($oldPath)) {
                 continue;
             }
             if (!file_exists($newPath)) {
                 Files::createDirectoryRecursively($newPath);
             }
             if (!is_dir($newPath)) {
                 continue;
             }
             foreach (Files::getRecursiveDirectoryGenerator($this->targetPackageData['path'], null, true) as $pathAndFilename) {
                 if (substr_compare($pathAndFilename, $oldPath, 0, strlen($oldPath)) === 0) {
                     $relativePathAndFilename = substr($pathAndFilename, strlen($oldPath));
                     if (!is_dir(dirname(Files::concatenatePaths(array($newPath, $relativePathAndFilename))))) {
                         Files::createDirectoryRecursively(dirname(Files::concatenatePaths(array($newPath, $relativePathAndFilename))));
                     }
                     Git::move($pathAndFilename, Files::concatenatePaths(array($newPath, $relativePathAndFilename)));
                 }
             }
         } else {
             $oldPath = Files::concatenatePaths(array($this->targetPackageData['path'] . '/' . $operation[0]));
             $newPath = Files::concatenatePaths(array($this->targetPackageData['path'] . '/' . $operation[1]));
             Git::move($oldPath, $newPath);
         }
     }
     foreach ($this->operations['deleteFile'] as $operation) {
         $filename = Files::concatenatePaths(array($this->targetPackageData['path'] . '/' . $operation[0]));
         if (file_exists($filename)) {
             Git::remove($filename);
         }
     }
 }