On one project, this strange situation happened:

The css files in web / assets are no longer updated.

I can not understand what could be the problem.

  • resources are published via $ sourcePath
  • everything worked before
  • rights to web / assets like sufficient 775 (not sure here, because no admin)
  • sub directories of type 1c5944bf, 2f827e2a are created in the directory ...

But, the crux of the problems:

* очистил полностью web/assets * изменил css файл во внутренней папке проекта * зашел на сайт. все ок. новые правила css видны. внутри web/assets появились 1c5944bf, 2f827e2a... полет отличный * снова изменил файл css * !!!зашел на сайт. css файлы остались старые.!!! * снова почистил папку web/assets * зашел на сайт. все ок. новые правила css видны. внутри web/assets появились 1c5944bf, 2f827e2a... полет отличный 

it was already a long time ago on one project - then I didn’t understand what the problem was, and again.

in essence, files in temporary (random) folders are not updated until the entire temporary (random) folder is deleted

tell me who faced where to dig


UPDATE: forgot to clarify. I myself can find search options such as 'linkAssets' => true, 'forceCopy' => true ...

I wonder exactly what could happen. because everything worked without these options. I try to understand where that I could hook, that everything has ceased to be updated

  • try this method: in composer.json check the permissions on the folder, it should be 0777 in setPermissions, delete the file composer.lock and make composer install , - MasterAlex

1 answer 1

As far as I understand the problem is known to the developers of the framework and will be solved in the next version.

The problem: https://github.com/yiisoft/yii2/issues/8197

Reason: https://stackoverflow.com/questions/3620684/directory-last-modate-date

temporary crutch

 $config['components']['assetManager']['hashCallback'] = function($path){ $mostRecentFileMTime = 0; $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::CHILD_FIRST); foreach ($iterator as $fileinfo) { if ($fileinfo->isFile() && $fileinfo->getMTime() > $mostRecentFileMTime) { $mostRecentFileMTime = $fileinfo->getMTime(); } } $path = (is_file($path) ? dirname($path) : $path) . $mostRecentFileMTime; return sprintf('%x', crc32($path . Yii::getVersion())); };