{"id":19737120,"url":"https://github.com/agkozak/smart-wp-db-error","last_synced_at":"2026-02-06T04:30:55.057Z","repository":{"id":109653094,"uuid":"138256319","full_name":"agkozak/smart-wp-db-error","owner":"agkozak","description":"A WordPress db-error.php drop-in that generates e-mails about database outages while displaying error messages to the general public","archived":false,"fork":false,"pushed_at":"2025-01-01T20:01:21.000Z","size":319,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-02T07:36:39.417Z","etag":null,"topics":["wordpress","wordpress-drop-in"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agkozak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-22T04:57:26.000Z","updated_at":"2025-01-01T20:01:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"ea958ff6-d620-4bd4-9674-e1907552fee7","html_url":"https://github.com/agkozak/smart-wp-db-error","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/agkozak/smart-wp-db-error","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agkozak%2Fsmart-wp-db-error","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agkozak%2Fsmart-wp-db-error/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agkozak%2Fsmart-wp-db-error/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agkozak%2Fsmart-wp-db-error/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agkozak","download_url":"https://codeload.github.com/agkozak/smart-wp-db-error/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agkozak%2Fsmart-wp-db-error/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29150594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T02:39:25.012Z","status":"ssl_error","status_checked_at":"2026-02-06T02:37:22.784Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wordpress","wordpress-drop-in"],"created_at":"2024-11-12T01:09:45.913Z","updated_at":"2026-02-06T04:30:55.038Z","avatar_url":"https://github.com/agkozak.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smart WP db-error.php\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"img/mascot.png\" alt=\"Smart WP db-error.php Mascot\"\u003e\n\u003c/p\u003e\n\n## Overview\n\nOne of the most common problems facing a WordPress webmaster is the occasional drop in database connectivity. Left to its own devices, WordPress simply displays to the end user the message\n\n![Error establishing a database connection](img/error.png)\n\nThe webmaster has no way of knowing that an error has occurred.\n\nWordPress allows us to address this problem in the following way: if it cannot connect to its database, it will run the drop-in plugin `/wp-content/db-error.php` ([documentation](https://developer.wordpress.org/reference/functions/dead_db/)) if it exists. Smart WP db-error.php uses that built-in functionality to serve a 503 page informing users of the outage, while e-mailing webmasters to alert them to the problem -- but only at specified intervals (default: 5 minutes), so as not to overwhelm their mail servers and inboxes.\n\n![Smart WP db-error.php Error Messager](img/example.png)\n\n## Installation\n\nTo install Smart WP db-error.php, execute the following:\n\n```sh\ncd /path/to/wp-content\ngit clone https://github.com/agkozak/smart-wp-db-error.git\ncd smart-wp-db-error\ncp db-error.php.dist ../db-error.php\ncd ..\n```\n\nAt this point it is vitally necessary that you edit the new `/wp-content/db-error.php` file so as to include installation-specific information. The defaults are\n\n```php\ndefine( 'MAIL_TO', 'Firstname Lastname \u003cexample@example.com\u003e' );\ndefine( 'MAIL_FROM', 'example@website.com' );\ndefine( 'ALERT_INTERVAL', 300 );        // In seconds.\ndefine( 'SUPPRESS_CREDITS', false );\n```\n\n`MAIL_TO` and `MAIL_FROM` should be addresses chosen to cause the least trouble for spam filters (e-mail sent by PHP from a webserver is likely to need whitelisting). `ALERT_INTERVAL` is the number of seconds between attempts at mailing the webmaster.\n\n## Notes\n\nIf `/wp-content/db-error.php` is accessed directly, the error page will be displayed, but only for the purposes of showing the webmaster what the error page looks like. No e-mail will be sent. A `noindex` meta tag reminds search engines never to index the error page (an unlikely event anyway, as the page is served with a 503 status).\n\nIf, on the other hand, `/wp-content/smart-wp-db-error/smart-wp-db-error.php` is accessed directly, the `MAIL_TO`, `MAIL_FROM`, and `ALERT_INTERVAL` constants will not have been defined, and the script will `die` quietly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagkozak%2Fsmart-wp-db-error","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagkozak%2Fsmart-wp-db-error","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagkozak%2Fsmart-wp-db-error/lists"}