aspirepress / AspireUpdate

A plugin that allows for rewriting the URLs used to fetch updates from WordPress.org to some other endpoint
15 stars 4 forks source link

WP_SITEURL not defined error #5

Closed asirota closed 1 week ago

asirota commented 1 week ago

With this configuration on the updater-plugin in wp-config.php I get this critical error when loading up the site:

// AspirePress configuration keys
//define('AP_UPDATER_API_KEY', '1234567890');
define('AP_UPDATER_HOST_REWRITES', 'api.wordpress.org');
define('AP_UPDATER_REWRITE_WPORG_API', true);
define('AP_UPDATER_REWRITE_WPORG_DL', true);
define('AP_UPDATER_API_URL', 'a605-108-48-150-114.ngrok-free.app');
define('AP_UPDATER_DL_URL', 'cdn.aspirepress.local');
//define(WP_SITEURL', 'https://dev.newpathconsulting.com');

// AspirePress DEBUGGING

define('AP_UPDATER_DEBUG', true);
//define('AP_UPDATER_DEBUG_LOG_PATH', '/var/www/html');
//define('AP_UPDATER_DEBUG_SSL', true);
//define('AP_UPDATER_DEBUG_TYPES_EXCLUDE', ['string']);
define('AP_UPDATER_EXAMINE_RESPONSES', true);
define('AP_UPDATER_DEBUG_LEVEL', 4);

The error I get is

[08-Oct-2024 14:39:50 UTC] PHP Fatal error:  Uncaught Error: Undefined constant "WP_SITEURL" in /homepages/0/d91623022/htdocs/clickandbuilds/NewPathWAWPDevelopment/wp-content/plugins/updater-plugin/aspirepress-updater.php:73
Stack trace:
#0 /homepages/0/d91623022/htdocs/clickandbuilds/NewPathWAWPDevelopment/wp-settings.php(522): include_once()
#1 /homepages/0/d91623022/htdocs/clickandbuilds/NewPathWAWPDevelopment/wp-config.php(105): require_once('/homepages/0/d9...')
#2 /homepages/0/d91623022/htdocs/clickandbuilds/NewPathWAWPDevelopment/wp-load.php(50): require_once('/homepages/0/d9...')
#3 /homepages/0/d91623022/htdocs/clickandbuilds/NewPathWAWPDevelopment/wp-blog-header.php(13): require_once('/homepages/0/d9...')
#4 /homepages/0/d91623022/htdocs/clickandbuilds/NewPathWAWPDevelopment/index.php(17): require('/homepages/0/d9...')
#5 {main}
  thrown in /homepages/0/d91623022/htdocs/clickandbuilds/NewPathWAWPDevelopment/wp-content/plugins/updater-plugin/aspirepress-updater.php on line 73

defining WP_SITEURL in wp-config forces the site to do a HTTP error 500 on reload.

Also the README.md on the plugin needs clarity on this definition code:

define('AP_UPDATER_HOST_REWRITES', 'api.wordpress.org'); Currently it has an array as the second argument -- is that correct?

asirota commented 1 week ago

fixed in https://github.com/aspirepress/updater-plugin/pull/6