Skip to main content
Share Your Experience: Take the 2024 Developer Survey
9 votes
Accepted

Are there 'cv' commands for these operations?

Trigger rebuild cv api4 System.flush triggers=1 Civi Menu rebuild and Cache clear cv api4 System.flush
Pradeep Nayak's user avatar
6 votes
Accepted

How to reset the headless test db?

ah-ha! In your test class edit the setUpHeadless() method which might look at first like this: public function setUpHeadless() { ...
artfulrobot's user avatar
  • 3,932
5 votes

cv error: "Call to undefined function Civi\Cv\Command\posix_getuid()"

cv has a PHP dependency that CiviCRM doesn't - the posix plugin. It's installed by default on many systems with PHP (e.g. Debian/Ubuntu) but with the Red Hat/CentOS "remi" repository, it isn't. You ...
Jon G - Megaphone Tech's user avatar
5 votes

Can't upgrade from 5.26.* to 5.28.*

Issue causing this: Extensions. In PHP logs I found out Symphony was mentioned along with Flexmailer. We had alpha outdated version of Flexmailer causing issues. Disabling it/ updating it seems to ...
Experiance Tranquility's user avatar
5 votes
Accepted

Is there a cv command to update extensions?

An "update all" option doesn't exist. For myself, I have a PHP script (below) that returns a JSON file with the extensions that need upgrading. This is part of a larger Ansible role which ...
Jon G - Megaphone Tech's user avatar
4 votes
Accepted

How to bootstrap CiviCRM with admin permissions in a Wordpress environment?

I recently pushed b3db22c002a5d16ae3715b97b58f3f64a1526a3a -- which adds the --user (-U) option and seems to work in WP/D7 (but hasn't been exhaustively tested). Try downloading the latest build of cv....
Tim Otten's user avatar
  • 5,684
4 votes

How to bootstrap CiviCRM with admin permissions in a Wordpress environment?

If wp-cli is an option, it takes a --user option, similarly to drush. If that's not an option, looking at the wp-cli source code (here) suggests that wp_set_current_user() will do the trick.
Jon G - Megaphone Tech's user avatar
4 votes
Accepted

How do I use cv to run database upgrades from the command line?

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 ...
Tim Otten's user avatar
  • 5,684
4 votes
Accepted

CV Scheduled jobs not firing from cron

Ok so this may seem like a silly issue to some but after some messing around I figured out cron didn't have access to the path where CV was installed so to fix it the crontab entry had to be changed ...
tanbog's user avatar
  • 317
3 votes

Why does Drupal 9 complain when my CiviCRM cron runs?

I have one Drupal 9 site with this problem, and several more that don't. I don't know the root cause of the issue, but I know that adding --level=cms-full to the cv command fixes the issue.
Jon G - Megaphone Tech's user avatar
3 votes
Accepted

Scheduled Reminders no longer sending

This appears when you have schedule reminder with is repeat ON and 'Also Include' Recipient set. Try applying below patch diff --git a/CRM/Event/ActionMapping.php b/CRM/Event/ActionMapping.php index ...
Pradeep Nayak's user avatar
2 votes

How do I use cv to run database upgrades from the command line?

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 ...
Kainuk - CiviCooP's user avatar
2 votes
Accepted

Can cv handle custom Wordpress installs?

Thanks to the helpful comments, I conclude: Yes it can, with a bit of help. TL;DR you need to define CIVICRM_CMSDIR in your code you need set CIVICRM_SETTINGS as an environment var Longer version ...
artfulrobot's user avatar
  • 3,932
2 votes

Is it possible to set the list of CiviCRM components from the command line using drush

For those that use cv is also possible to use: echo '{"enable_components" :["CiviContribute","CiviMember","CiviMail","CiviReport","CiviEvent"] }' | cv api Setting.create --in=json
Kainuk - CiviCooP's user avatar
2 votes
Accepted

Is it possible to set the list of CiviCRM components from the command line using drush

Thanks to passing JSON objects to drush cvapi I found a solution: echo '{"enable_components" :["CiviContribute","CiviMember","CiviMail","CiviReport","CiviEvent"] }' | drush cvapi Setting.create --in=...
Kainuk - CiviCooP's user avatar
2 votes

What is the `cv` command to set default language?

It should be cv api Setting.create lcMessages="fr_FR" Make sure you use the correct language code. Note: Sometimes you need to clear CiviCRM cache to apply changes.
Pradeep Nayak's user avatar
2 votes
Accepted

The "cmsBaseUrl" is not set according to the information in civicrm.settings.php

Did you run check-req with the --cms-base-url argument? It needs to be specified there too.
Demerit's user avatar
  • 23.1k
2 votes

Why does Drupal 9 complain when my CiviCRM cron runs?

So, if your civicrm system jobs are all running, then the question is about where the extra Drupal error email is coming from (regardless of whether it gets emailed to you or just displayed on the ...
Alan Dixon's user avatar
  • 6,851
2 votes
Accepted

Missing Relationship Cache Data fails to rebuild cache with DB error

The issue was that a row in the end_date column of the civicrm_relationship table had an incorrect date value of '0000-00-00' when it should have been NULL. I tracked this by watching the mysql log ...
macMark's user avatar
  • 31
1 vote
Accepted

CV Does Not Work From Cron

The problem here was $civicrm_root being set in civicrm.settings.php based on an environment variable, which wasn't set during cron.
Demerit's user avatar
  • 23.1k
1 vote

CV No Longer Works

What version of cv are you running? You may need to upgrade. The current version (from cv -V) is v0.3.48 You can download the latest from https://github.com/civicrm/cv
Aidan's user avatar
  • 13.5k
1 vote
Accepted

Error executing task "Update civicrm_mailing_event_queue to permit deleting records from civicrm_mailing_job"

It means you have some records in the event queue that don't have a corresponding job. Probably the job got deleted at some point so I wouldn't be worried about that field and would just clear them ...
Demerit's user avatar
  • 23.1k
1 vote

Why does Drupal 9 complain when my CiviCRM cron runs?

Two thoughts: Check the version of cv. I don't use the cwd option so maybe it does something different for boot ordering, and I notice sites/default/web is an odd path but you might just have typed ...
Demerit's user avatar
  • 23.1k
1 vote

No menu item "OAuth", can't paste provider values into client

For backdrop the url is : website.com/civicrm/admin/oauth I had the same issue, no Oauth menu, but we have a staging version of the site which is showing the Oauth menu item -- so I used that to get a ...
Manu's user avatar
  • 31
1 vote
Accepted

When running cv on a Joomla install, what directory should I use?

The answer to the question is that the directory should be anywhere within the website, so given a webroot of /var/www/html any of these should work /var/www/html/administrator/components/com_civicrm/...
thoni56's user avatar
  • 1,241
1 vote
Accepted

"Failed to locate boot function (bootJoomla)" error when installing with cv

Unfortunately it's not implemented yet: See https://github.com/civicrm/cv/blob/cf4f644da6d007a32f1c583d68e6b0ae4fe6c45b/src/CmsBootstrap.php#L306 // TODO public function bootJoomla($cmsRootPath, $...
Demerit's user avatar
  • 23.1k
1 vote
Accepted

'cv' script with arguments

I don't think you can directly pass arguments to cv scripts, but you can work around it: $ env CV_ARGS="arg1 arg2 arg3" cv scr my_script.php my_script.php: <?php $my_args = getenv("...
Aidan's user avatar
  • 13.5k
1 vote

Can I add custom cv subcommands in my extension?

I may be over-thinking this. I can simply add apiv4 functions to any extension and then they are all available via: cv api4 Foo.Bar. I guess you can extend cv after all thanks to the API.
Jamie's user avatar
  • 1,246
1 vote

Can I add custom cv subcommands in my extension?

Something like cv php:script --user=admin my_subcommand.php is kind of the same thing if I understand correctly? You'd just have to put your previous code into a separate php file and adjust.
Demerit's user avatar
  • 23.1k
1 vote

CV Scheduled jobs not firing from cron

Is the user "admin" defined in Drupal? If not some commands will not fire under cv. cv needs a user under "username" that is recognized by Drupal as having the rights to fire the command you're ...
Stephen Sloan's user avatar

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