Answers.Body: <p>Following up on the comment from Kevin Cristiano above, the WP-CLI commands for <code>upgrade</code> and <code>restore</code> seem to be broken in versions of CiviCRM since the <code>civicrm.settings.php</code> file was moved out of the CiviCRM plugin directory. Let's track progress on <a href="https://lab.civicrm.org/dev/wordpress/-/issues/123" rel="nofollow noreferrer">the issue you opened</a> and leave this here as a signpost for others.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-04-19T17:58:04.767Z
Answers.LastActivityDate: 2022-04-19T17:58:04.767Z
Answers.UserDisplayName: Christian Wach
Body: <p>In order to upgrade CiviCRM for WordPress from the command line on a remote server, I just installed wp-cli following the instructions at <a href="https://wp-cli.org/" rel="nofollow noreferrer">https://wp-cli.org/</a>.</p>
  <p>When I execute:</p>
  <pre><code>wp civicrm upgrade --zipfile ../Downloads/civicrm-5.48.0-wordpress.zip 
  </code></pre>
  <p>I get a warning and an error:</p>
  <pre><code>Warning: file_get_contents(/home/myhome/www/wp-content/plugins/civicrm/wp-cli//civicrm.settings.php): failed to open stream: No such file or directory in /home/myhome/www/wp-content/plugins/civicrm/wp-cli/civicrm.php on line 946
  
  The upgrade process involves - 
  1. Backing up current CiviCRM code as =&gt; /home/myhome/www/../backup/plugins/20220412055134/civicrm
  2. Backing up database as =&gt; /home/myhome/www/../backup/plugins/20220412055134/civicrm.sql
  3. Unpacking tarfile to =&gt; /home/myhome/www/wp-content/plugins/
  4. Executing civicrm/upgrade?reset=1 just as a browser would.
  
  Do you really want to continue? [y/n] y
  
  Success: 1. Code backed up.
  mysqldump: Got error: 2002: &quot;Can't connect to MySQL server on 'myftpuser-001.privatesql' (115)&quot; when trying to connect
  
  </code></pre>
  <p>I wonder if someone could give me an idea of a workaround for this problem.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-04-12T13:22:23.157Z
Comments.Text: I concur, this has failed for me as well.   I use an external file to get wp-cli to use `civicrm` from a different location since as soon as we remove the plugin we lose the needed file.  But I see this fails on 5.48.0.  Can you report an issue at https://lab.civicrm.org/dev/wordpress/-/issues
Comments.UserDisplayName: Kevin Cristiano
Tags: <wordpress><cli>
Title: Error when upgrading civicrm for wordpress with wp-cli
ThreadText: # Error when upgrading civicrm for wordpress with wp-cli
  
  (Asked by: username_0 on 2022-04-12)
  
  In order to upgrade CiviCRM for WordPress from the command line on a remote server, I just installed wp-cli following the instructions at https://wp-cli.org/.
  When I execute:
  wp civicrm upgrade --zipfile ../Downloads/civicrm-5.48.0-wordpress.zip 
  
  I get a warning and an error:
  Warning: file_get_contents(/home/myhome/www/wp-content/plugins/civicrm/wp-cli//civicrm.settings.php): failed to open stream: No such file or directory in /home/myhome/www/wp-content/plugins/civicrm/wp-cli/civicrm.php on line 946
  
  The upgrade process involves - 
  1. Backing up current CiviCRM code as => /home/myhome/www/../backup/plugins/20220412055134/civicrm
  2. Backing up database as => /home/myhome/www/../backup/plugins/20220412055134/civicrm.sql
  3. Unpacking tarfile to => /home/myhome/www/wp-content/plugins/
  4. Executing civicrm/upgrade?reset=1 just as a browser would.
  
  Do you really want to continue? [y/n] y
  
  Success: 1. Code backed up.
  mysqldump: Got error: 2002: "Can't connect to MySQL server on 'myftpuser-001.privatesql' (115)" when trying to connect
  
  
  I wonder if someone could give me an idea of a workaround for this problem.
  
  **Tags:** wordpress, cli
  
  > **Comments:**
  > **username_1**: I concur, this has failed for me as well.   I use an external file to get wp-cli to use `civicrm` from a different location since as soon as we remove the plugin we lose the needed file.  But I see this fails on 5.48.0.  Can you report an issue at https://lab.civicrm.org/dev/wordpress/-/issues  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-04-19. Score: 1
  
  Following up on the comment from username_1 above, the WP-CLI commands for `upgrade` and `restore` seem to be broken in versions of CiviCRM since the `civicrm.settings.php` file was moved out of the CiviCRM plugin directory. Let's track progress on [the issue you opened](https://lab.civicrm.org/dev/wordpress/-/issues/123) and leave this here as a signpost for others.
  
  
  ---
  
  