My plugin Count Views works fine in *nix environments, but it doesn’t work in Windows.
The problem is these lines here:
// Open data file
$datafh = File::instance($path);
$datafh->lock();
$data = Yaml::parse($datafh->content());
if ($data === null) {
$data = array();
}
No matter what, $datafh->content() is returning null on Windows, even though it loaded the file fine on lines 63-66. The only difference is the file locking.
I added an if/then and indeed the file is getting locked. So what do I have to do to read the file now? Why is it different on Windows?
And I can confirm that if I remove the lock()
line, everything works as expected.
Any help appreciated. Thanks!