-
Notifications
You must be signed in to change notification settings - Fork 239
Tracking original IDs or general order #1420
Description
During work on test infrastructure we found a problem with order of posts on cloned site. When there are several posts (or other items) published at the same time and ordered by that time, their order can be different on original and cloned site, see example in #1409 (comment).
Order on original site is based on ID (order from database storage), but cloned site depends on loading .ini files through iterators:
versionpress/plugins/versionpress/src/Storages/DirectoryStorage.php
Lines 157 to 168 in e220983
| private function getEntityFiles() | |
| { | |
| if (!is_dir($this->directory)) { | |
| return []; | |
| } | |
| $directoryIterator = new RecursiveDirectoryIterator($this->directory); | |
| $recursiveIterator = new RecursiveIteratorIterator($directoryIterator); | |
| $iniFilesIterator = new RegexIterator($recursiveIterator, '~^.+\.ini$~i', RecursiveRegexIterator::GET_MATCH); | |
| return array_keys(iterator_to_array($iniFilesIterator)); | |
| } |
And VersionPress ignores original IDs, so there is currently no way to order posts by their original ID on cloned sites.
Maybe there is a time to start tracking original IDs (VP could make a clean clone with original IDs which could be helpful in some cases) or general order (VP could generally know order of created items at least).