Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cache database and User-Agent HTTP header #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

asivery
Copy link

@asivery asivery commented Apr 12, 2021

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.

@ActionRetro
Copy link
Owner

Thanks for this! What would I need to do server-side to get this code going?

@asivery
Copy link
Author

asivery commented Apr 12, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants