From: Tim Otten Date: Mon, 23 May 2016 22:36:21 +0000 (-0700) Subject: bin/regen.sh - Execute GenerateData.php with a dummy CMS X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e5d2838715ac4f9e714c5c1c2f022d76eac77dd8;p=civicrm-core.git bin/regen.sh - Execute GenerateData.php with a dummy CMS 1. This addresses the error [PHP Fatal error: Call to undefined function db_query() in /opt/buildkit/build/mytestbuild/sites/all/modules/civicrm/CRM/Utils/System/DrupalBase.php](http://civicrm.stackexchange.com/questions/11972/regen-sh-call-to-undefined-function-db-query/11986#11986). 2. Generally, the goal here is to produce `civicrm_generated.mysql`, which is used on any/all CMS's to initialize the Civi database. If the generation were really dependent on Drupal 7, then we wouldn't be able to use that output on other CMS's, right? Thus I'm hopeful that we can generate `civicrm_generated.mysql` with any `CIVICRM_UF`. And the `UnitTests` UF has fewer dependencies/interactions. 3. Since `GenerateData.php` is running in a dummy CMS, we can remove these weird mock-drupal-functions. 4. To test, I ran `regen.sh` and compared the output with the old one. All the changes looked like random-data (`civicrm_contact`, etal) and not structural data (`civicrm_option_value`, etal). --- diff --git a/bin/regen.sh b/bin/regen.sh index 8b2a781130..3090f14da9 100755 --- a/bin/regen.sh +++ b/bin/regen.sh @@ -41,7 +41,7 @@ $MYSQLCMD < civicrm_data.mysql $MYSQLCMD < civicrm_sample.mysql echo "DROP TABLE IF EXISTS zipcodes" | $MYSQLCMD $MYSQLCMD < zipcodes.mysql -php GenerateData.php +env CIVICRM_UF=UnitTests php GenerateData.php # run the cli script to build the menu and the triggers cd $CIVISOURCEDIR diff --git a/sql/GenerateData.php b/sql/GenerateData.php index a9bc42c57f..df0429b400 100644 --- a/sql/GenerateData.php +++ b/sql/GenerateData.php @@ -1978,22 +1978,6 @@ AND a.details = 'Participant Payment' } -/** - * @param null $str - * - * @return bool - */ -function user_access($str = NULL) { - return TRUE; -} - -/** - * @return array - */ -function module_list() { - return array(); -} - echo ("Starting data generation on " . date("F dS h:i:s A") . "\n"); $gcd = new CRM_GCD(); $gcd->initID();