Symfony2 - 混淆缓存清除尝试写入pro_ [英] Symfony2 - confused cache clear trying to write to pro_
问题描述
我的Symfony安装似乎已经弄糊涂了某处(可能是在一个失败的高速缓存清除)。它似乎认为生产缓存文件夹应该调用 pro _
而不是 prod
。
首先,当我试图运行 $ php控制台缓存:clear --env = prod
我得到错误消息:
[Symfony\Component\Filesystem\Exception\IOException]
无法将... cache / pro_重命名为 ... cache / pro_。
我在Windows开发机上运行(所以没有文件系统权限问题) / p>
所以,我试着手动删除所有的 cache / *
文件/文件夹,然后重试。这次缓存:清除经过并产生一个 prod
文件夹。
但是当我打开prod前端控制器(例如 http://
致命错误:require function.require]:
需要打开失败'... cache / pro_ / doctrine / orm / Proxies\__CG__AcmeDemoBundleEntityFoo.php'
(include_path ='blah,blah,blah')
in ... \vendor\doctrine\common\lib\Doctrine\Common\Proxy\AbstractProxyFactory.php on line 165
从这个看起来,它试图访问pro_而不是prod(再次)的缓存文件。
缓存文件夹我可以看到 __ CG__AcmeDemoBundleEntityFoo.php
存在于cache\prod下,但现在有一个pro_文件夹与注释和会话子文件夹。
发生了什么,我如何让Symfony忘记 pro _
,以便可以回到使用 prod
我认为一切都与缓存有关,存储在缓存文件夹下...有其他的东西吗? (某处)存储一些对 pro _
的引用?
appProdProjectContainer.php
包含对 ... / cache / pro _
的16个引用。如果我手动搜索并替换这些到 ... / cache / prod
该网站工作。但是下次我运行控制台缓存:清除
时,它会将它们重置为 pro _
。这个错误的行为可能来自哪里? Edit2:确定,我到了这个底部,并提交了一个PR到Symfony核心尝试和解决它。问题是由于我们的缓存路径包含'\'字符,然后在缓存文件中转义,并且无法匹配一个搜索/替换命令,这意味着清理它们。
这是Symfony处理带有反斜线的缓存路径时出现的错误。
长期有一个修复,发布为 https://github.com/symfony/symfony/pull/9184 ,将很快纳入核心代码。
My Symfony installation seems to have gotten confused somewhere (probably during a failed cache clear). It seems to think that the production cache folder should be called pro_
instead of prod
.
First, when I tried to run $ php console cache:clear --env=prod
I got the error message:
[Symfony\Component\Filesystem\Exception\IOException]
Cannot rename "...cache/pro_" to "...cache/pro_".
I'm running on a windows dev machine (so there are no file system permissions issues).
So, I tried deleting all of the cache/*
files/folders manually and trying again. This time the cache:clear went through and produced a single prod
folder. That folder has subfolders for annotations, assetic, doctrine, sessions and twig.
But when I open the prod front controller (e.g. http://devsite/
in a browser) it fails with the message:
Fatal error: require() [function.require]:
Failed opening required '...cache/pro_/doctrine/orm/Proxies\__CG__AcmeDemoBundleEntityFoo.php'
(include_path='blah, blah, blah')
in ...\vendor\doctrine\common\lib\Doctrine\Common\Proxy\AbstractProxyFactory.php on line 165
From the looks of this it's trying to access cache files in pro_ instead of prod (again).
Looking in the cache folder I can see that __CG__AcmeDemoBundleEntityFoo.php
exists under cache\prod but there is now a pro_ folder with annotations and sessions sub-folders.
What's going on and how do I make Symfony forget about pro_
so it can go back to using prod
for everything?
I thought everything to do with the cache was stored under the cache folder... is there something else (somewhere) that's storing some reference to pro_
? Or am I looking in the wrong place for the solution to this problem?
Edit: Done some more searching and appProdProjectContainer.php
contains 16 references to .../cache/pro_
. If I manually search and replace these to .../cache/prod
the site works. But the next time I run console cache:clear
it resets them back to pro_
. Where could this errant behaviour be coming from?
Edit2: OK, I got to the bottom of this and have submitted a PR to the Symfony core to try and fix it. The problem was caused by our cache path containing '\' characters which were then escaped in the cache files and failing to match a search/replace command which was meant to clean them up.
This was a bug in Symfony's handling of cache paths with back-slashes in them.
The short term workaround is to replace them with forward slashes.
Longer term there is a fix posted as https://github.com/symfony/symfony/pull/9184 which will be brought into the core code soon.
这篇关于Symfony2 - 混淆缓存清除尝试写入pro_的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!