public function digipolisSwitchPrevious($releasesDir, $currentSymlink)
    {
        $finder = new Finder();
        // Get all releases.
        $releases = iterator_to_array(
            $finder
                ->directories()
                ->in($releasesDir)
                ->sortByName()
                ->depth(0)
                ->getIterator()
        );
        // Last element is the current release.
        array_pop($releases);
        if ($releases) {
            // Normalize the paths.
            $currentDir = readlink($currentSymlink);
            $releasesDir = realpath($releasesDir);
            // Get the right folder within the release dir to symlink.
            $relativeRootDir = substr($currentDir, strlen($releasesDir . '/'));
            $parts = explode('/', $relativeRootDir);
            array_shift($parts);
            $relativeWebDir = implode('/', $parts);
            $previous = end($releases)->getRealPath() . '/' . $relativeWebDir;
            return $this->taskExec('ln -s -T -f ' . $previous . ' ' . $currentSymlink)
                ->run();
        }
    }