68k-news
68k-news copied to clipboard
Added cache database and User-Agent HTTP header
This should improve the page loading speed and prevent rate limiting on the news servers. I also encountered 403 Forbidden
errors caused by the missing User-Agent HTTP header - this should fix them. The database functionality can be turned off using the USE_CACHE
define in article.php
. If the database ever becomes corrupted, it will be deleted and recreated. If that fails, the script will just ignore it and load the page without caching it. The cached articles will automatically get deleted after a period of 24 hours.
Thanks for this! What would I need to do server-side to get this code going?
You only need to install the sqlite3 extension for php. For me (Ubuntu 20.04) I had to install php7.4-sqlite3
. Other than that, the database should create itself automatically (The program should have write permissions to the database file defined in cache_database.php
). You might need to also prevent users from accessing cache_database.php
and the database itself.