civicrm / civicrm/cv

cv ext:list -L returns incorrect results on WordPress

Open
#46 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
45
Forks
36
Avg merge
17h 54m
Merged PRs (30d)
3

Description

This seems to be a problem with the core caching class, but I was unable to trigger this problem except through `cv` so I'm filing it here.

Using `cv ext:list -L` on WordPress only returns the extensions that ship with core (iats and api4). The problem seems to be in [this line](https://github.com/civicrm/cv/blob/master/src/Command/ExtensionListCommand.php#L147), because `\CRM_Extension_System::singleton()->getFullContainer()` returns a bad cache. Below is the output from placing `print_r($containers['default']->cache);` at [this line](https://github.com/civicrm/civicrm-core/blob/master/CRM/Extension/System.php#L157). Note how `valueCache['default']` is empty under WordPress:

### WordPress (incorrect)
```
CRM_Utils_Cache_SqlGroup Object [80/20072]
(
[group:protected] => b53cf5f32d1aff8d90a464dd69f7066f
[componentID:protected] =>
[valueCache:protected] => Array
(
[civiroot] => Array
(
[org.civicrm.api4] => /ext/api4
[com.iatspayments.civicrm] => /ext/iatspayments
)

[default] => Array
(
)

[full] => Array
(
[org.civicrm.api4] => civiroot
[com.iatspayments.civicrm] => civiroot
)

[mapper_moduleFiles] => Array
(
[0] => Array
(
[prefix] => customrenewalstartdate
[filePath] =>
)

[1] => Array
(
[prefix] => originaljoindate
[filePath] =>
)

[2] => Array
(
[prefix] => hidepaypalexpresscheckout
[filePath] =>
)

[3] => Array
(
[prefix] => membershipcards
[filePath] =>
)

[4] => Array
(
[prefix] => noverwrite
[filePath] =>
)

[5] => Array
(
[prefix] => wpcontactupdate
[filePath] =>
)

[6] => Array
(
[prefix] => publicmailings
[filePath] =>
)
[7] => Array
( [prefix] => giftmemberships
[filePath] => )

[8] => Array (
[prefix] => presspassextension
[filePath] =>
)

[9] => Array
(
[prefix] => recordfailedpaypalrecur
[filePath] =>
)

[10] => Array
(
[prefix] => csshelper
[filePath] =>
)

[11] => Array
(
[prefix] => notificationlog
[filePath] =>
)

[12] => Array
(
[prefix] => failedpaymentsearch
[filePath] =>
)

[13] => Array
(
[prefix] => reporterror
[filePath] =>
)

[14] => Array
(
[prefix] => extendedreport
[filePath] =>
)

[15] => Array
(
[prefix] => membershippayment
[filePath] =>
)

[16] => Array
(
[prefix] => multiplerecurring
[filePath] =>
)

[17] => Array
(
[prefix] => innodbtriggers
[filePath] =>
)

[18] => Array
(
[prefix] => defaultcountrysearch
[filePath] =>
)

[19] => Array
(
[prefix] => monitoring
[filePath] =>
)

[20] => Array
(
[prefix] => csvimport
[filePath] =>
)

)

)

[expiresCache:protected] => Array
(
[civiroot] => 1544740853
[default] => 1544740853
[full] => 1544740853
[mapper_moduleFiles] => 1544740855
)

[table:protected] => civicrm_cache
)
```

### Drupal (correct)
```
CRM_Utils_Cache_SqlGroup Object [61/984]
(
[group:protected] => d137abb97b85e36aa1f2c08fe1b044a1
[componentID:protected] =>
[valueCache:protected] => Array
(
[civiroot] => Array
(
[org.civicrm.api4] => /ext/api4
[com.iatspayments.civicrm] => /ext/iatspayments
)

[default] => Array
(
[nz.co.fuzion.extendedreport] => /nz.co.fuzion.extendedreport
[eu.tttp.noverwrite] => /eu.tttp.noverwrite
[org.civicrm.shoreditch] => /org.civicrm.shoreditch
[com.drastikbydesign.stripe] => /com.drastikbydesign.stripe
[org.woolman.genderselfidentify] => /org.woolman.genderselfidentify
[org.takethestreets.campaignincontributiontab] => /org.takethestreets.campaignincontributiontab
[uk.co.vedaconsulting.mosaico] => /uk.co.vedaconsulting.mosaico
[org.civicrm.module.cividiscount] => /org.civicrm.module.cividiscount
[net.ourpowerbase.sumfields] => /net.ourpowerbase.sumfields
[com.aghstrategies.zombiefinder] => /com.aghstrategies.zombiefinder
[org.lavalove.emergencycontact] => /org.lavalove.emergencycontact
[org.civicrm.flexmailer] => /org.civicrm.flexmailer
[com.megaphonetech.monitoring] => /com.megaphonetech.monitoring
)

[full] => Array
(
[org.civicrm.api4] => civiroot
[com.iatspayments.civicrm] => civiroot
[nz.co.fuzion.extendedreport] => default
[eu.tttp.noverwrite] => default
[org.civicrm.shoreditch] => default
[com.drastikbydesign.stripe] => default
[org.woolman.genderselfidentify] => default
[org.takethestreets.campaignincontributiontab] => default
[uk.co.vedaconsulting.mosaico] => default
[org.civicrm.module.cividiscount] => default
[net.ourpowerbase.sumfields] => default
[com.aghstrategies.zombiefinder] => default
[org.lavalove.emergencycontact] => default
[org.civicrm.flexmailer] => default
[com.megaphonetech.monitoring] => default
)

[mapper_moduleFiles] => Array
(
[0] => Array
(
[prefix] => campaignincontributiontab
[filePath] => /home/jon/local/lava/htdocs/sites/all/civicrm/extensions/org.takethestreets.campaignincontributiontab/campaignincontributiontab.php
)

[1] => Array
(
[prefix] => emergencycontact
[filePath] => /home/jon/local/lava/htdocs/sites/all/civicrm/extensions/org.lavalove.emergencycontact/emergencycontact.php
)

[2] => Array
(
[prefix] => extendedreport
[filePath] => /home/jon/local/lava/htdocs/sites/all/civicrm/extensions/nz.co.fuzion.extendedreport/extendedreport.php
)

[3] => Array
(
[prefix] => zombiefinder
[filePath] => /home/jon/local/lava/htdocs/sites/all/civicrm/extensions/com.aghstrategies.zombiefinder/zombiefinder.php
)

[4] => Array
(
[prefix] => stripe
[filePath] => /home/jon/local/lava/htdocs/sites/all/civicrm/extensions/com.drastikbydesign.stripe/stripe.php
)

[5] => Array
(
[prefix] => cividiscount
[filePath] => /home/jon/local/lava/htdocs/sites/all/civicrm/extensions/org.civicrm.module.cividiscount/cividiscount.php
)

[6] => Array
(
[prefix] => shoreditch
[filePath] => /home/jon/local/lava/htdocs/sites/all/civicrm/extensions/org.civicrm.shoreditch/shoreditch.php
)

[7] => Array
(
[prefix] => flexmailer
[filePath] => /home/jon/local/lava/htdocs/sites/all/civicrm/extensions/org.civicrm.flexmailer/flexmailer.php
)

[8] => Array
(
[prefix] => mosaico
[filePath] => /home/jon/local/lava/htdocs/sites/all/civicrm/extensions/uk.co.vedaconsulting.mosaico/mosaico.php
)

[9] => Array
(
[prefix] => noverwrite
[filePath] => /home/jon/local/lava/htdocs/sites/all/civicrm/extensions/eu.tttp.noverwrite/noverwrite.php
)

[10] => Array
(
[prefix] => sumfields
[filePath] => /home/jon/local/lava/htdocs/sites/all/civicrm/extensions/net.ourpowerbase.sumfields/sumfields.php
)

[11] => Array
(
[prefix] => genderselfidentify
[filePath] => /home/jon/local/lava/htdocs/sites/all/civicrm/extensions/org.woolman.genderselfidentify/genderselfidentify.php
)

[12] => Array
(
[prefix] => monitoring
[filePath] => /home/jon/local/lava/htdocs/sites/all/civicrm/extensions/com.megaphonetech.monitoring/monitoring.php
)

)

)

[expiresCache:protected] => Array
(
[civiroot] => 1544739837
[default] => 1544739837
[full] => 1544739837
[mapper_moduleFiles] => 1544739837
)

[table:protected] => civicrm_cache
)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/Command/ExtensionListCommand.php at line 147 and compare the cache behavior with CRM/Extension/System.php at line 157. Reproduce `cv ext:list -L` on WordPress and inspect the `default` cache alongside the Drupal output. Done means WordPress lists installed extensions beyond the core entries without breaking Drupal behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.