How would I call CRM_Core_I18n_Schema::rebuildMultilingualSchema($locales, NULL); from the command line? Minor upgrade seems to have had an insignificant DB error and this line did not get called.

Coming from: CRM/Upgrade/Incremental/php/FourSeven.php line 654 Wordpress, CiviCRM 4.7.10


The command cv (https://github.com/civicrm/cv) provides helpers for running PHP code via CLI. For example, to run a single line of PHP code, you might say:

cd web-root
cv ev 'CRM_Core_I18n_Schema::rebuildMultilingualSchema(array(...), NULL);'

The snippet you posted involves a variable $locales which isn't defined here. If you know the intended content (e.g. maybe array('en_US')) then you could plug that in directly.

Alternatively, maybe you could call that particular upgrade function addHelpPreAndHelpPostFieldsPriceFieldValue() directly. (This is not always going to work; it's a case-by-case judgment looking the substance of the function.) If it's appropriate, then:

cd web-root
cv ev '$u = new CRM_Upgrade_Incremental_php_FourSeven(); $u->addHelpPreAndHelpPostFieldsPriceFieldValue(NULL);'

More generally, you could copy the desired code out of CRM/Upgrade/Incremental/php/FourSeven.php and put it in a new file (my-upgrade-fix.php). Hack the code as desired and then run:

cd web-root
cv scr my-upgrade-fix.php
  • There's also an interactive shell based on psysh.org -- you can run it with cv cli. It should work nicely on most Linux systems. (Although the CLI experience may not be as nice elsewhere -- on MAMP, it's missing some PHP extensions to support tab-keys, arrow-keys, etc.)
    – Tim Otten
    Aug 25 '16 at 19:16
  • WOW! Seriously helpful! Thank you. I've been up/down/all around the forums and wiki for multiple different things and there's still tons of little nuggets like this.
    – G H
    Aug 25 '16 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.