Answers.Body: <p>The command <code>cv</code> (<a href="https://github.com/civicrm/cv" rel="nofollow">https://github.com/civicrm/cv</a>) provides helpers for running PHP code via CLI. For example, to run a single line of PHP code, you might say:</p>
  
  <pre><code>cd web-root
  cv ev 'CRM_Core_I18n_Schema::rebuildMultilingualSchema(array(...), NULL);'
  </code></pre>
  
  <p>The snippet you posted involves a variable <code>$locales</code> which isn't defined here. If you know the intended content (e.g. maybe <code>array('en_US')</code>) then you could plug that in directly.</p>
  
  <p>Alternatively, maybe you could call that particular upgrade function <code>addHelpPreAndHelpPostFieldsPriceFieldValue()</code> 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:</p>
  
  <pre><code>cd web-root
  cv ev '$u = new CRM_Upgrade_Incremental_php_FourSeven(); $u-&gt;addHelpPreAndHelpPostFieldsPriceFieldValue(NULL);'
  </code></pre>
  
  <p>More generally, you could copy the desired code out of <code>CRM/Upgrade/Incremental/php/FourSeven.php</code> and put it in a new file (<code>my-upgrade-fix.php</code>). Hack the code as desired and then run:</p>
  
  <pre><code>cd web-root
  cv scr my-upgrade-fix.php
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-25T19:16:01.853Z
Answers.Text: There's also an interactive shell based on http://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.)
Answers.UserDisplayName: Tim Otten
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-25T19:18:37.653Z
Answers.Text: 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.
Answers.UserDisplayName: G H
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-25T19:13:08.553Z
Answers.LastActivityDate: 2016-08-25T19:13:08.553Z
Answers.UserDisplayName: Tim Otten
Body: <p>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.</p>
  
  <p>Coming from:  CRM/Upgrade/Incremental/php/FourSeven.php line 654
  Wordpress, CiviCRM 4.7.10</p>
  
Tags: <wordpress><database><i18n><cli>
Title: Running a script from cli
ThreadText: # Running a script from cli
  
  (Asked by: username_0 on 2016-08-25)
  
  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
  
  **Tags:** wordpress, database, i18n, cli
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-08-25. Score: 3 | Accepted answer
  
  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
  
  ```
  
  > **Comments:**
  > **username_1**: There's also an interactive shell based on http://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.)  
  > **username_0**: 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.  
  
  ---
  
  