serendipity_event_entrylastmodified upgrade & comments
Posted: Fri Dec 02, 2005 12:38 pm
I made an improvement of serendipity_entry_lastmodified: and now it emits Last modified on ... when the entry really was modified. If there was no modification, it emits something like Not modified. Here is the code:
[was]
[changed to]
If this 'upgrade' is welcome, may it happens official in CVS ? Or may there be a config option to use the new behaviour or not ? Or for not modified entries config option to show 'Not modified' or nothing ? I can do it, but I'd like to hear some opinions here before that.
And now comments. First I tried to compare $eventData[$i]['timestamp'] and $eventData[$i]['last_modified'] and wondered why these always were different nevertheless that I did not made any changes to the test entry. At last I made a database select and here is the result:
Last entry is that I did not modified but there is different values for timestamp and last_modified fields. May be these receive their initial values independently ? I think that when the entry is saved for the first time in the database last_modified must get its value from timestamp.
[was]
Code: Select all
$eventData[$i]['add_footer'] .= sprintf(PLUGIN_EVENT_ENTRYLASTMODIFIED_HTML, serendipity_formatTime(DATE_FORMAT_SHORT, $eventData[$i]['last_modified']));Code: Select all
$tm_timestamp = sprintf(PLUGIN_EVENT_ENTRYLASTMODIFIED_HTML, serendipity_formatTime(DATE_FORMAT_SHORT, $eventData[$i]['timestamp']));
$tm_last_modified = sprintf(PLUGIN_EVENT_ENTRYLASTMODIFIED_HTML, serendipity_formatTime(DATE_FORMAT_SHORT, $eventData[$i]['last_modified']));
if (strcmp($tm_timestamp,$tm_last_modified) != 0) {
$eventData[$i]['add_footer'] .= $tm_last_modified;
} else {
$eventData[$i]['add_footer'] .= sprintf('<br /><div style="text-align: right">PLUGIN_EVENT_NOTMODIFIED</div>');
}And now comments. First I tried to compare $eventData[$i]['timestamp'] and $eventData[$i]['last_modified'] and wondered why these always were different nevertheless that I did not made any changes to the test entry. At last I made a database select and here is the result:
Code: Select all
mysql> select timestamp,last_modified from s9y_entries;
+------------+---------------+
| timestamp | last_modified |
+------------+---------------+
| 1132666902 | 1132691164 |
| 1132668434 | 1133517322 |
| 1133508101 | 1133508172 |
| 1133518270 | 1133518282 | <==============
+------------+---------------+
4 rows in set (0.00 sec)