diff options
| -rwxr-xr-x | app/controllers/feedController.php | 4 | ||||
| -rwxr-xr-x | app/models/Entry.php | 2 | ||||
| -rw-r--r-- | lib/lib_rss.php | 12 |
3 files changed, 14 insertions, 4 deletions
diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index 02647e10f..a38614b3d 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -106,7 +106,7 @@ class feedController extends ActionController { $feed->keepHistory ()) { $values = $entry->toArray (); $values['id_feed'] = $feed->id (); - $values['id'] = min(time(), $entry->date (true)) . '.' . rand(0, 999999); + $values['id'] = min(time(), $entry->date (true)) . uSecString(); $values['is_read'] = $is_read; $entryDAO->addEntry ($values); } @@ -229,7 +229,7 @@ class feedController extends ActionController { $feed->keepHistory ())) { $values = $entry->toArray (); //Use declared date at first import, otherwise use discovery date - $values['id'] = empty($existingGuids) ? min(time(), $entry->date (true)) . '.' . rand(0, 999999) : microtime(true); + $values['id'] = empty($existingGuids) ? min(time(), $entry->date (true)) . uSecString() : uTimeString(); $values['is_read'] = $is_read; $entryDAO->addEntry ($values); } diff --git a/app/models/Entry.php b/app/models/Entry.php index 33d0c66bb..103a90706 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -196,7 +196,7 @@ class Entry extends Model { class EntryDAO extends Model_pdo { public function addEntry ($valuesTmp) { $sql = 'INSERT INTO `' . $this->prefix . 'entry`(id, guid, title, author, content_bin, link, date, is_read, is_favorite, id_feed, tags) ' - . 'VALUES(CAST(? * 1000000 AS SIGNED INTEGER), ?, ?, ?, COMPRESS(?), ?, ?, ?, ?, ?, ?)'; + . 'VALUES(?, ?, ?, ?, COMPRESS(?), ?, ?, ?, ?, ?, ?)'; $stm = $this->bd->prepare ($sql); $values = array ( diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 8d4cecf44..4f5b90b61 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -255,6 +255,16 @@ function lazyimg($content) { ); } +function uTimeString() { + $t = @gettimeofday(); + return $t['sec'] . str_pad($t['usec'], 6, '0'); +} + +function uSecString() { + $t = @gettimeofday(); + return str_pad($t['usec'], 6, '0'); +} + function invalidateHttpCache() { - file_put_contents(DATA_PATH . '/touch.txt', microtime(true)); + file_put_contents(DATA_PATH . '/touch.txt', uTimeString()); } |
