Clean URLs system check fails via API or cv
As of CiviCRM 5.55, there is a check if Clean URLs are enabled.
Unfortunately, it does so by checking whether the get_option()
function exists. This is fine via the web UI where WP boots first, but with cv
or the API, WP boots after CiviCRM. Since CIVICRM_CLEANURLs
is a constant, once it's set to 0
, it's fixed at 0
.
E.g. in cv
, Civi\Cv\Util\BootTrait::_boot_full()
contains the following code!
PharOut::prepare();
$output->writeln('<info>[BootTrait]</info> Call standard cv bootstrap', OutputInterface::VERBOSITY_DEBUG);
\Civi\Cv\Bootstrap::singleton()->boot($this->createBootParams($input, $output));
$output->writeln('<info>[BootTrait]</info> Call core bootstrap', OutputInterface::VERBOSITY_DEBUG);
\CRM_Core_Config::singleton();
$output->writeln('<info>[BootTrait]</info> Call CMS bootstrap', OutputInterface::VERBOSITY_DEBUG);
\CRM_Utils_System::loadBootStrap(array(), FALSE);
\Civi\Cv\Bootstrap::singleton()->boot()
runs and civicrm.settings.php
is evaluated before WP is booted at \CRM_Utils_System::loadBootStrap(array(), FALSE)
.
Next Steps
Maybe CIVICRM_CLEANURLS
should be part of the $civicrm_setting
global variable instead of a constant?