Skip to content

Conversation

nicolas-grekas
Copy link
Member

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #12893
License MIT
Doc PR -

Reading comment on #12893 stating that using absolute paths works around the pb, I tried using realpath(),
and it works!
Pending work on #12955 can be done quietly now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If $realCacheDir does not exists, realpath file returns false

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path exists because we checked it a few lines above with is_writable()

@1ed
Copy link
Contributor

1ed commented Dec 16, 2014

@nicolas-grekas great catch.

It works great, but this way cache:warmup and cache:clear not produces the same result, but I think it doesn't really matter.

Here are my results:

    public function getCacheDir()
    {
        return '/tmp/sf/'.$this->getEnvironment();
    }

The partial diff of cache:warmup vs cache:clear

             'kernel.root_dir' => '/home/egabor/dev/OSS/symfony-standard/app',
             'kernel.environment' => 'dev',
             'kernel.debug' => true,
-            'kernel.name' => 'app',
+            'kernel.name' => 'ap_',
             'kernel.cache_dir' => __DIR__,
             'kernel.logs_dir' => '/home/egabor/dev/OSS/symfony-standard/app/logs',
             'kernel.bundles' => array(
    public function getCacheDir()
    {
        return __DIR__.'/../../../../../../../tmp/sf/'.$this->getEnvironment();
    }

The partial diff of cache:warmup vs cache:clear

             'kernel.root_dir' => '/home/egabor/dev/OSS/symfony-standard/app',
             'kernel.environment' => 'dev',
             'kernel.debug' => true,
-            'kernel.name' => 'app',
-            'kernel.cache_dir' => ('/home/egabor/dev/OSS/symfony-standard/app/../../../../../../..'.__DIR__),
+            'kernel.name' => 'ap_',
+            'kernel.cache_dir' => __DIR__,
             'kernel.logs_dir' => '/home/egabor/dev/OSS/symfony-standard/app/logs',
             'kernel.bundles' => array(

@nicolas-grekas
Copy link
Member Author

I added a realpath() in the Kernel that removes the diff for kernel.cache_dir.
The diff for kernel.name is not new, and thus not related to the issue we're working on.
Kernel::getKernelParameters() is always called after the dirs are created thus this realpath should never fail

@fabpot
Copy link
Member

fabpot commented Dec 17, 2014

Thank you @nicolas-grekas.

@fabpot fabpot merged commit a14153a into symfony:2.3 Dec 17, 2014
fabpot added a commit that referenced this pull request Dec 17, 2014
This PR was merged into the 2.3 branch.

Discussion
----------

[FrameworkBundle] fix cache:clear command

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12893
| License       | MIT
| Doc PR        | -

Reading comment on #12893 stating that using absolute paths works around the pb, I tried using realpath(),
and it works!
Pending work on #12955 can be done quietly now.

Commits
-------

a14153a [FrameworkBundle] fix cache:clear command
@nicolas-grekas nicolas-grekas deleted the fix-12893 branch December 24, 2014 07:14
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.

6 participants