You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$res = $this->fsview->fromTmpFile($file['tmp_name'], $filePath);
$basenameFilePath = basename($filePath);
if ($basenameFilePath !== $file['name']) {
$newFilePath = dirname($filePath) . '/' . $file['name'];
sleep(2); // line required to work properlyif ($this->fsview->rename($filePath, $newFilePath)) {
// force a change$this->fsview->touch($newFilePath);
}
}
Upload /foo/bar1.
Upload bar2 as version of bar1 (code above). This creates a new version of /foo/bar1 -> files_versions/foo/bar1.vT1 and rename bar1 to bar2, so the version should be renamed too.
We end with /foo/bar2 and files_versions/foo/bar2.vT1
Upload bar3 as version of bar2 (code above). This creates a new version of /foo/bar2 -> files_versions/foo/bar2.vT2 and rename both the file and the versions of the file.
However, at some point in the 3rd step, the rename of the versions doesn't work and the versions of the file are lost. There won't be any versions of the renamed file.
I've checked the DB that after step 3: there are two versions of /foo/bar2 (created in steps 2 and 3) but no versions of the /foo/bar3. I think the files were renamed correctly in the FS but not in the DB.
My guess is that there might be some issues regarding timestamps. That's why I've added the "sleep(2)" line. This will make sure that the write and rename operation happen in different seconds. After adding this line, the files_versions app works as expected.
The text was updated successfully, but these errors were encountered:
The timestamp is based on seconds, so you are right. If a file gets edited multiple times within one second then we will only have the oldest version within the second. But I think that's OK. We don't need to keep more than one version per seconds.
Consider the following piece of code:
We end with /foo/bar2 and files_versions/foo/bar2.vT1
However, at some point in the 3rd step, the rename of the versions doesn't work and the versions of the file are lost. There won't be any versions of the renamed file.
I've checked the DB that after step 3: there are two versions of /foo/bar2 (created in steps 2 and 3) but no versions of the /foo/bar3. I think the files were renamed correctly in the FS but not in the DB.
My guess is that there might be some issues regarding timestamps. That's why I've added the "sleep(2)" line. This will make sure that the write and rename operation happen in different seconds. After adding this line, the files_versions app works as expected.
The text was updated successfully, but these errors were encountered: