Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage symlink download #9

Closed
wants to merge 1 commit into from
Closed

Manage symlink download #9

wants to merge 1 commit into from

Conversation

CharlyP
Copy link

@CharlyP CharlyP commented Apr 16, 2014

Fixes #8 by modifying the realPath of a File if it is a symlink

@touki653
Copy link
Owner

I don't feel like it should be handled this way. This looks like a job for the factory to fetch a new Filesystem type.

Something similar to:

<?php

class Symlink extends File
{
    protected $origin;
    protected $target;

    public function __construct($origin, File $target)
    {
        $this->origin = $origin;
        $this->target = $target;
    }

    public function getRealpath()
    {
        return $this->target->getRealpath();
    }

    public function getTarget()
    {
        return $this->target;
    }

    public function getOriginalRealpath()
    {
        return $this->realpath;
    }
}

@CharlyP
Copy link
Author

CharlyP commented Apr 16, 2014

Indeed I agree, this was a quickfix and the solution you suggest is much more elegant. I'll try spend some time implementing it and will keep you noticed.

@CharlyP CharlyP closed this Apr 16, 2014
@CharlyP
Copy link
Author

CharlyP commented Apr 16, 2014

Your example would indeed manage Symlink for files but you'll still have to manage it for directories. I'm not sure it should extend File but remain generic instead by extending directly Filesystem

@touki653 touki653 changed the title BUGFIX: Manage symlink download Manage symlink download Apr 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Symlink Management
2 participants