Hot answers tagged

14

To answer my own question, it is possible to update CiviCRM with drush but this isn't completely straightforward either. For the benefit of others I post the steps I took below. put the site into maintenance mode: drush vset maintenance_mode 1 clear all caches: drush cc all take a full backup of site and test that this works on a development server upgrade ...


9

You can get a list of Civi-related Drush commands simply by typing drush on the command line. Excerpt: All commands in civicrm: (civicrm) civicrm-api (cvapi) CLI access to CiviCRM APIs. It can return pretty-printor json formatted data. civicrm-enable-debug Enable CiviCRM ...


7

Drush can read parameters from standard input in JSON format if you supply the argument --in=json. This is what we need for API chaining, because chaining uses nested parameters, and in contrast to a flat list of command line arguments (the default way to pass parameters to drush cvapi, JSON can handle nesting. So to retrieve the email addresses for contact ...


6

Here is how to pass an array to drush echo '{"retrieval_parameters":{"jobId":97727336,"filePath":"Raw Recipient Data Export May 15 2017 22-07-43 PM 674.zip"}}' | drush cvapi Omnirecipients.get --in=json


6

For some reason the Drush cache is not up to date (for example, if you've recently upgraded CiviCRM). If you clear the Drush cache as follows, the command should work as expected: > drush cc drush


5

There's no single perfect solution to this, but there are several adequate solutions. To highlight some trade-offs among the approaches raised so far: For each security principal, use separate data-directories (like bgm's answer). Pro: Portable -- works in many different environments. Doesn't require any special tools or root permissions. Con: Only works ...


5

Reviewing the stack trace you provided, the line [debug_info] => SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._', 3 ) [nativecode=3057 ** Incorrect user-level lock name 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._'.] is the important one. I googled nativecode=3057 ** Incorrect user-...


4

Browser - From the browser, go to Administer > System Settings > Debugging and Error Handling and you can turn on Enable Debugging and Display Backtrace. That should provide you with more specific errors that you need to debug. Also, per the help item on "Enable Bugging" you can do the following to any Civi URL for a stack trace: Stack Trace - To display ...


4

Someone actually provided the answer to another person on the CiviCRM chat channel, so I'm posting it here: <juri_> "You have requested a non-existent service 'sql_triggers'." <juri_> anyone care to take a guess? this is civi on drupal 8. <mollux> juri_ clear the CiviCRM cache, had the same issue yesterday


3

The civicrm-disable-debug command isn't defined in civicrm_drush_command(). See line 155: $items['civicrm-enable-debug'] = array( 'description' => "Enable CiviCRM Debugging.", ); To solve this problem, you can add this below that: $items['civicrm-disable-debug'] = array( 'description' => "Disable CiviCRM Debugging.", ); This would be an easy ...


3

I ran into a similar problem when manually updating. Depending on how your database is configured the update will fail when trying to change the image_URL from VARCHAR(256) to VARCHAR(512). I wasn't able to figure out how to get it to let me make the change (it would even fail when I tried to directly manipulate the table). I ended up commenting out this ...


3

From the excellent interactive documentation here -- https://buildkit.civicrm.org/#/tutorials (which is almost impossible to find unless you know where to look): ## Download application (with civibuild) civibuild download "mytestbuild" \ --civi-ver "master" \ --type "drupal-clean" There are a number of interesting gotchas. For example, civibuild ...


3

Turns out that when running in saltstack drush can't resolve the right environment variables to find ~/.drush. I put civicrm.drush.inc in my drush/commands directory and it fixed the problem.


3

One answer to your question is that you can use the sql-dump drush command to dump your civicrm database by using this option: --database : The DB connection key if using multiple connections in settings.php. For that to work, you'd have to edit your drupal settings file to include something like: $database['civicrm'] = array('default' => array('...


3

Setting directories group-setuid might get you part of the way (with chmod g+ws templates_c), but maybe we should consider something like this in the CiviCRM drush module?: $config = CRM_Core_Config::singleton( ); $config->configAndLogDir = $config->configAndLogDir . 'drush/'; $config->templateCompileDir = $config->templateCompileDir . 'drush/'; ...


3

Civicrm utilises sql triggers for a number of purposes - including but not limited to populating values into the log_civicrm_% tables - if you have logging turned on under Admin -> System Settings -> Misc You can't alter triggers. Easiest to dump the database then strip out triggers using the following perl perl -pi -e 's#\/\*\!5001[7|3].*?`[^\*]*\*\/##g' ...


3

In stead of using drush for this, I use the "mysqldump --skip-triggers"command exactly for that reason: mysqldump --skip-triggers -u db_user -pdb_password db > export.sql


3

Not sure why it's suddenly started producing output when it didn't previously, but you could use: #!/bin/sh a=`drush -r /home/crwheelmen/www/www --quiet civicrm-api job.execute` if echo $a | grep -qv '\[is_error\] => 0'; then echo $a; fi (capture the output of drush to variable a then check whether is_error is 0. If it is, do nothing otherwise show the ...


3

That sounds like your command line version of php is different to the one being used by your webserver. See eg https://drupal.stackexchange.com/questions/44967/the-php-version-is-not-correctly-detected


2

Our solution to mixed access to CiviCRM's cache files (and other situations where permissions issues arose) has been a daemon which monitors filesystem entries and "corrects" permissions immediately on file creation/modification. Enforced on Github There are still some issues with this approach (eg issue linked in comment on bgm's answer), but it seems to ...


2

Tim describes a solution based on linux ACL: https://github.com/totten/amp/blob/master/doc/perm.md But it requires amp, that I (might be wrongly) see a dev only tool. Does someone use something like that in production?


2

another helpful thing that I do when using drush for civi upgrades: since drush does not give you any information about where in the process the upgrade is (the GUI has the progress bar that says what version it is at) I open another ssh session to the server and use drush civicrm-sql-cli to get into the sql console with the right database. Then as the ...


2

I've seen this behaviour occasionally on CiviCRM sites where CiviCRM is already installed, and it frequently clears up by use of drush cc drush or drush rr (registry-rebuild). If you're installing CiviCRM on a "fresh" Drupal site, the Drush commands may not be available until the module is enabled as you say. In that case you might need to install CiviCRM's ...


2

Sorry for the late post here, but this tip might help someone going forward with this error. I too was receiving this error on a fresh install of CiviCRM with WordPress. It was noted there were ajax errors. We guessed that the script was calling for more memory than the server had allotted. Memory allocation was increased and the error went away. It was ...


2

This error can happen if you attempt to load a CiviCRM DB over the top of an existing DB. It's possible that's what you're running into here. Looks like there are two files in the CiviCRM distribution which might try to populate that table, so make sure you aren't getting both executed. civicrm/sql/civicrm_acl.mysql civicrm/sql/civicrm_generated.mysql But ...


2

Drush can support VCS deployments and you can tell drush make to keep the .git directory with "drush make --working-copy your-platform.make". However, unless it's changed recently, drush doesn't have post-install hooks, so it won't handle composer/bower/npm well. Composer has support for "post-install-cmd", but civicrm itself is not on packagist. I'm not ...


2

I would bet almost 100% that you're using drush 7 or higher. The function drush_sql_dump_execute doesn't exist in drush 7. Support for drush 7 was added as of CiviCRM 4.5.5 - see CRM-15567. That link suggests that drush 6 has the same problem. I would recommend using mysqldump until you're upgraded.


2

Mathieu a.k.a @bgm (who runs much of the CiviCRM project's infrastructure) wrote this: https://forum.civicrm.org/index.php?topic=30003.msg128559#msg128559 To summarize: [I checked the link to that example makefile - still works]! I deploy with "Drush make": * deploy from my git repos or from the civicrm standard ones (drush make example.make) * run ...


2

That would be nice, but I am afraid it is not there (yet). When you lookup the list of cv commands in de source on GitHub, you will not find this command. However, using the drush source code as inspiration you can create a small script <?php $codeVer = CRM_Utils_System::version(); $dbVer = CRM_Core_BAO_Domain::version(); if (version_compare($...


2

The cv upgrade:db command from https://github.com/civicrm/cv/pull/2 was recently merged for v0.2.3. This revision hasn't been broadly deployed or tested yet, but it provides a richer upgrade experience: By default, there's a progress indicator. With -vvv, you can get a detailed report/log of the upgrade steps as they execute. With -vvv --dry-run, you can ...


Only top voted, non community-wiki answers of a minimum length are eligible