dragomano / Optimus

A simple SEO mod for SMF
https://custom.simplemachines.org/mods/index.php?mod=2659
Artistic License 2.0
6 stars 8 forks source link

Postgres support #14

Closed albertlast closed 6 years ago

albertlast commented 6 years ago

When you care about postgres some changes are needed: https://github.com/dragomano/Optimus/blob/e5f931dedeef0937078fdbaac3813515499c6ea6/Sources/Class-Optimus.php#L222 replace ifnull with coalesce, got the advantage that you can give unlimited amount of col.

the last issue is the use of double quote here: https://github.com/dragomano/Optimus/blob/e5f931dedeef0937078fdbaac3813515499c6ea6/Sources/Class-OptimusSitemap.php#L148

since you want only the year the best approache would be to use the unix timestamp and convert this in your while loop below: https://github.com/dragomano/Optimus/blob/e5f931dedeef0937078fdbaac3813515499c6ea6/Sources/Class-OptimusSitemap.php#L161-L162

$row['poster_time'] = date('Y', $row['poster_time']);

Advantage you also take the timezone information into the account, which could otherwise provide issue when you a unix timestamp is around 31.12. and 1.1.

dragomano commented 6 years ago

Thanks. Did you mean these changes?

albertlast commented 6 years ago

yes this should work (i didn't installed you mod, i only look throw)

dragomano commented 6 years ago

Ok. I have just tested, no issues.