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

view:clear attempts to delete "all files on server" if it cannot find dir #14811

Closed
vdhanaraj opened this issue Aug 13, 2016 · 2 comments
Closed

Comments

@vdhanaraj
Copy link

I apologize in advance for not implementing a fix and if I am violating any style guides, but this is the first issue I've ever reported.

If storage/framework/views does not exist and ./artisan view:clear is issued as root, the command deletes /bin and /usr/bin off the server. I am not sure what else is deleted, because at that point the server is pretty much dead. If you do not run it as root, I am not sure what it's going to delete, but it looks like it will try to delete "all files on server"

My preliminary search has lead me to the file : vendor\laravel\framework\src\Illuminate\Foundation\Console\ViewClearCommand.php

public function fire(){
    $views = $this->files->glob($this->laravel['config']['view.compiled'].'/*');
    foreach ($views as $view) {
        $this->files->delete($view);
    }
    $this->info('Compiled views cleared!');
}

I believe this needs an additional check for $this->laravel['config']['view.compiled'] returning null, for file existence of that or possibly restructuring the string building so that it is ALWAYS prefixed to the app_dir.

I will be attempting to patch it for myself, but I am not sure where else a string is being built and passed to "glob" in such a way that it may be interpreted as root, or if I have not identified the actual issue.

Thanks in advance for any advice.

@GrahamCampbell
Copy link
Member

Thanks for the report. Please check out #14812. :)

@vdhanaraj
Copy link
Author

Thanks. It seemed like a simple thing to do, but I've only ever looked through the source for "undocumented features" and wanted to make sure it was as simple as it sounded, since I dont know anything about $this->files is or $this->laravel. So many moving parts...

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

No branches or pull requests

2 participants