-
During development we often have conflicts with the I was wondering why the modification-time of the file is not used instead, that would save a lot of time. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
Checking file modification times isn’t performant, because directory modification dates don’t get updated when a nested file is modified. So we can’t just look at the Craft does come with a |
Beta Was this translation helpful? Give feedback.
-
Know I understand: All files below I have seen that |
Beta Was this translation helpful? Give feedback.
-
Changes of So if a fixed |
Beta Was this translation helpful? Give feedback.
-
If you are always executing use Craft;
use craft\helpers\ProjectConfig as ProjectConfigHelper;
use craft\services\ProjectConfig as ProjectConfigService;
// ...
Craft::$app->getProjectConfig()->on(
ProjectConfigService::EVENT_AFTER_WRITE_YAML_FILES,
function() {
ProjectConfigHelper::touch(9999999999);
Craft::$app->getProjectConfig()->updateParsedConfigTimes(); // Ensure the cached value of when the project config was last parsed is updated.
}
); |
Beta Was this translation helpful? Give feedback.
Changes of
dateModified
inconfig/project/project.yaml
means that any of the files in the directoryconfig/project/
could have been changed and therefore the complete configuration is parsed again.So if a fixed
dateModified
-value is used, thencraft project-config/apply
must be executed to re-read the configuration.