Skip to content
Snippets Groups Projects
Commit 27458805 authored by totten's avatar totten
Browse files

bin/regen.sh - Run DatabaseInitializer (first boot) before GenerateData

The DatabaseInitializer is called during first boot
(`CRM_Core_Config::singleton()`) and runs `system.flush session=1
triggers=1` which (among other things) enumerates modules (including CMS
modules).  In standalone boot protocol, that means it runs before
`CRM_Utils_System::loadBootstrap()` (which means that CMS modules
cannot be enumerated yet).

A simple work-around is to always boot the CMS first (before
`CRM_Core_Config::singleton()` or `DatabaseInitializer` runs).
parent e5d28387
Branches
Tags
No related merge requests found
......@@ -41,12 +41,13 @@ $MYSQLCMD < civicrm_data.mysql
$MYSQLCMD < civicrm_sample.mysql
echo "DROP TABLE IF EXISTS zipcodes" | $MYSQLCMD
$MYSQLCMD < zipcodes.mysql
env CIVICRM_UF=UnitTests php GenerateData.php
# run the cli script to build the menu and the triggers
cd $CIVISOURCEDIR
"$PHP5PATH"php bin/cli.php -e System -a flush --triggers 1 --session 1
## For first boot on fresh DB, boot CMS before CRM.
cms_eval 'civicrm_initialize();'
php GenerateData.php
## Prune local data
$MYSQLCMD -e "DROP TABLE zipcodes; DROP TABLE IF EXISTS civicrm_install_canary; UPDATE civicrm_domain SET config_backend = NULL; DELETE FROM civicrm_extension; DELETE FROM civicrm_cache; DELETE FROM civicrm_setting;"
TABLENAMES=$( echo "show tables like 'civicrm_%'" | $MYSQLCMD | grep ^civicrm_ | xargs )
......
......@@ -55,3 +55,20 @@ function has_commands() {
done
return 0
}
## Execute some PHP within CMS context
## usage: cms_eval '<php-code>'
function cms_eval() {
case "$GENCODE_CMS" in
Drupal*)
drush ev "$1"
;;
WordPress*)
wp eval "$1"
;;
*)
echo "Cannot boot (GENCODE_CMS=$GENCODE_CMS)" > /dev/stderr
exit 1
;;
esac
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment