civicrm-core.git
5 years agodev/core#337 - Fix search range for select/radio custom fields
Coleman Watts [Tue, 18 Dec 2018 18:27:43 +0000 (13:27 -0500)]
dev/core#337 - Fix search range for select/radio custom fields

6 years agoMerge pull request #12362 from totten/master-cache-session
Eileen McNaughton [Tue, 3 Jul 2018 22:20:13 +0000 (10:20 +1200)]
Merge pull request #12362 from totten/master-cache-session

(dev/core#174) Forms/Sessions - Store state via Civi::cache('session')

6 years agoMerge pull request #12391 from eileenmcnaughton/matt
Eileen McNaughton [Tue, 3 Jul 2018 22:02:58 +0000 (10:02 +1200)]
Merge pull request #12391 from eileenmcnaughton/matt

Revert change to BillingBlock to support hidden fields.

6 years agoMerge pull request #12394 from yashodha/dev-223
Eileen McNaughton [Tue, 3 Jul 2018 04:11:53 +0000 (16:11 +1200)]
Merge pull request #12394 from yashodha/dev-223

(dev/core#223) Expose prefix and suffix in reports

6 years agoMerge pull request #12393 from scardinius/core-222
Eileen McNaughton [Mon, 2 Jul 2018 20:26:01 +0000 (08:26 +1200)]
Merge pull request #12393 from scardinius/core-222

dev/core#222 - Fix importing contacts with dedupe rule

6 years agoMerge pull request #12389 from totten/master-psr16-xtest
Tim Otten [Mon, 2 Jul 2018 18:58:36 +0000 (11:58 -0700)]
Merge pull request #12389 from totten/master-psr16-xtest

(dev/core#174) Add test to prevent hidden interactions among caches

6 years ago(dev/core#223) Expose prefix and suffix in reports
yashodha [Mon, 2 Jul 2018 10:47:38 +0000 (16:17 +0530)]
(dev/core#223) Expose prefix and suffix in reports

6 years agoMerge pull request #12340 from eileenmcnaughton/merge_cleanup
Eileen McNaughton [Mon, 2 Jul 2018 09:33:41 +0000 (21:33 +1200)]
Merge pull request #12340 from eileenmcnaughton/merge_cleanup

Move DAO function to DAO class, call it from Merge class

6 years agodev/core#222 - Fix importing contacts with dedupe rule
scardinius [Mon, 2 Jul 2018 08:55:41 +0000 (10:55 +0200)]
dev/core#222 - Fix importing contacts with dedupe rule

6 years agoMerge pull request #12390 from yashodha/dev-220
Eileen McNaughton [Mon, 2 Jul 2018 08:36:49 +0000 (20:36 +1200)]
Merge pull request #12390 from yashodha/dev-220

(dev/core#220) State province/country doesn't show properly in the…

6 years agoRevert change to BillingBlock to support hidden fields.
eileen [Mon, 2 Jul 2018 05:50:01 +0000 (17:50 +1200)]
Revert change to BillingBlock to support hidden fields.

Per discussion with Matt Wire this is actually unnecessary, if we define 'id' in the payment fields
metadata. This is a bit too much like spooky magic but it ... erm .. works

6 years agocore/issues#220 - State province/country doesn't show properly in the history report
yashodha [Mon, 2 Jul 2018 05:32:51 +0000 (11:02 +0530)]
core/issues#220 - State province/country doesn't show properly in the history report

6 years ago(dev/core#174) Forms/Sessions - Clear in roughly the same ways as before
Tim Otten [Thu, 28 Jun 2018 03:19:58 +0000 (20:19 -0700)]
(dev/core#174) Forms/Sessions - Clear in roughly the same ways as before

In the past, if one clears the `civicrm_cache` table (i.e.  by calling
`CRM_Core_Config::clearDBCache()` ==> `TRUNCATE TABLE civicrm_cache`), then it
has the effect of destroying any active sessions/forms.

Now, in allowing sessions to be stored elsewhere, we lose that side-effect.

If we want strictly equivalent behavior (from a business-logic perspective),
then we'd want the patch to go a bit further -- calling
Civi::cache('session')->clear() at the same time that it does
`clearDBCache()`.

This revision adds `clear()` calls to various spots discussed here:

* https://docs.google.com/spreadsheets/d/1FxuIvr2noelBvhu5eja9_ps3YUWnkmGhqijBO3gH8Po/edit?usp=sharing
* https://github.com/civicrm/civicrm-core/pull/12362#issuecomment-400897782

6 years ago(dev/core#174) Forms/Sessions - Store state via Civi::cache('session')
Tim Otten [Thu, 29 Mar 2018 01:52:57 +0000 (18:52 -0700)]
(dev/core#174) Forms/Sessions - Store state via Civi::cache('session')

Overview
----------------------------------------

When using forms based on CiviQuickForm (specifically `CRM_Core_Controller`), `CRM_Core_Session`
stores form-state via `CRM_Core_BAO_Cache::storeSessionToCache` and `::restoreSessionFromCache`,
which in turn calls `CRM_Core_BAO_Cache::setItem()` and `::getItem()`.

However, using `CRM_Core_BAO_Cache::setItem()` and `::getItem()` means that all session state
**must** be written to MySQL.  For dev/core#174, we seek the **option** to store via
Redis/Memcache.

Before
----------------------------------------

* (a) Form/session state is always stored via `CRM_Core_BAO_Cache::setItem()` and `civicrm_cache` table.
* (b) To ensure that old sessions are periodically purged, there is special purpose logic that accesses `civicrm_cache`
  (roughly `delete where group_name=Sessions and  created_date < now()-ttl`).
* (c) On Memcache/Redis-enabled systems, the cache server functions as an extra tier. The DB provides canonical storage for form/session state.

After
----------------------------------------

* (a) Form/session state is stored via `CRM_Utils_CacheInterface`.
    * On a typical server, this defaults to `CRM_Utils_Cache_SqlGroup` and `civicrm_cache` table.
* (b) To ensure that old sessions are periodically purged, the call to `CRM_Utils_CacheInterface::set()` specifies a TTL.
    * It is the responsibility of the cache driver to handle TTLs. With #12360, TTL's are supported in `ArrayCache`, `SqlGroup`, and `Redis`.
* (c) On Memcache/Redis-enabled systems, the cache server provides canonical storage for form/session state.

6 years ago(dev/core#174) Add test to prevent hidden interactions among caches
Tim Otten [Thu, 28 Jun 2018 17:35:55 +0000 (10:35 -0700)]
(dev/core#174) Add test to prevent hidden interactions among caches

6 years agoMerge pull request #12379 from totten/master-psr16-sqlgroup
Eileen McNaughton [Mon, 2 Jul 2018 03:13:27 +0000 (15:13 +1200)]
Merge pull request #12379 from totten/master-psr16-sqlgroup

(dev/core#174) Full PSR-16 compliance for SqlGroup

6 years agoMerge pull request #12386 from mattwire/IPN_NFC
Eileen McNaughton [Mon, 2 Jul 2018 00:11:58 +0000 (12:11 +1200)]
Merge pull request #12386 from mattwire/IPN_NFC

NFC code cleanup for AuthNet, Paypal, PaypalPro IPNs

6 years agoNFC code cleanup for AuthNet, Paypal, PaypalPro IPNs
Matthew Wire [Sun, 1 Jul 2018 18:53:27 +0000 (19:53 +0100)]
NFC code cleanup for AuthNet, Paypal, PaypalPro IPNs

6 years agoMerge pull request #12345 from MiyaNoctem/CRM-195-add-counts-to-contribution-sub...
Eileen McNaughton [Sun, 1 Jul 2018 07:39:31 +0000 (00:39 -0700)]
Merge pull request #12345 from MiyaNoctem/CRM-195-add-counts-to-contribution-sub-tabs

dev/core#195 Add Contribution Counts to Sub-tabs

6 years agoMerge pull request #12383 from civicrm/5.3
Eileen McNaughton [Sun, 1 Jul 2018 07:19:01 +0000 (00:19 -0700)]
Merge pull request #12383 from civicrm/5.3

5.3 to master

6 years agoMerge pull request #12382 from eileenmcnaughton/jaap
Eileen McNaughton [Sun, 1 Jul 2018 07:17:47 +0000 (00:17 -0700)]
Merge pull request #12382 from eileenmcnaughton/jaap

Fix mis-reporting of false booleans in reports

6 years agoFix mis-reporting of false booleans in reports
eileen [Sun, 1 Jul 2018 07:10:12 +0000 (19:10 +1200)]
Fix mis-reporting of false booleans in reports

6 years agodev/financial/issues/24, Add unit test for Link payment method to financial account...
Pradeep Nayak [Sun, 1 Jul 2018 06:48:30 +0000 (12:18 +0530)]
dev/financial/issues/24, Add unit test for Link payment method to financial account when created using api (#12365)

* Added api test to create new payment method

* updated api test

6 years agoMerge pull request #12356 from pradpnayak/issue-202
Eileen McNaughton [Sun, 1 Jul 2018 06:39:59 +0000 (23:39 -0700)]
Merge pull request #12356 from pradpnayak/issue-202

dev/core/issues/202, check if default currency is set

6 years agoMerge pull request #12381 from totten/master-psr16-apc
Eileen McNaughton [Sun, 1 Jul 2018 05:07:25 +0000 (22:07 -0700)]
Merge pull request #12381 from totten/master-psr16-apc

(dev/core#174) APCcache - Updates to comply with PSR-16

6 years agoMerge pull request #12380 from totten/master-psr16-memcache
Eileen McNaughton [Sun, 1 Jul 2018 04:50:33 +0000 (21:50 -0700)]
Merge pull request #12380 from totten/master-psr16-memcache

(dev/core#174) Memcache(d) - Updates to comply with PSR-16

6 years agoMerge pull request #12378 from eileenmcnaughton/totten
Seamus Lee [Sat, 30 Jun 2018 23:26:09 +0000 (09:26 +1000)]
Merge pull request #12378 from eileenmcnaughton/totten

(dev/core#174) Full PSR-16 compliance for ArrayCache, Redis

6 years ago(dev/core#174) APCcache - Updates to comply with PSR-16
Tim Otten [Wed, 27 Jun 2018 04:49:54 +0000 (21:49 -0700)]
(dev/core#174) APCcache - Updates to comply with PSR-16

One noteable quirk is that APC retains expired (per TTL) records until the
following page-request. To comply with the test suite, we have to double-check
the expiration time.

6 years ago(dev/core#174) Memcache(d) - Updates to comply with PSR-16
Tim Otten [Tue, 26 Jun 2018 23:10:27 +0000 (16:10 -0700)]
(dev/core#174) Memcache(d) - Updates to comply with PSR-16

There are two drivers, `CRM_Utils_Memcache` and `CRM_Utils_Memcached`.  It's
nice to update them in tandem (with similar design decisions).  If an admin
admin is experimenting/debugging, this consistency makes it easier to switch
between drivers.  (Cache data written by one driver can be read by the other
driver.)

In addition to the standard PSR-16-style changes, there are a couple changes
in how data is formatted when written to memcache:

* To allow support for targetted `flush()`ing (one prefix at a time), we update
  the naming convention per https://github.com/memcached/memcached/wiki/ProgrammingTricks#deleting-by-namespace
  This means that a typical key includes a bucket-revision code:
    * BEFORE: `<site-prefix>/<bucket-prefix>/<item-key>` (`dmaster/default/mykey`)
    * AFTER: `<site-prefix>/<bucket-prefix>/<bucket-revision>/<item-key>` (`dmaster/default/5b33011fea555/mykey`)
* Values are `serialize()`d. This resolves an ambiguity where `Memcache::get()`
  does not let us know if it returns `FALSE` because there's an error because
  that's the stored value. By serializing, those scenarios can be distinguished.
    * `get(...) === FALSE` means "item was not found"
    * `get(...) === serialize(FALSE)` means "item was found with value FALSE"

6 years ago(dev/core#174) CRM_Core_BAO_Cache - Periodically flush expired records
Tim Otten [Mon, 25 Jun 2018 23:20:16 +0000 (16:20 -0700)]
(dev/core#174) CRM_Core_BAO_Cache - Periodically flush expired records

6 years ago(dev/core#174) SqlGroup - Rewrite with PSR-16 and TTL support. Bypass BAO multitier...
Tim Otten [Thu, 21 Jun 2018 01:15:34 +0000 (18:15 -0700)]
(dev/core#174) SqlGroup - Rewrite with PSR-16 and TTL support. Bypass BAO multitier cache.

6 years ago(dev/core#174) Redis - Updates to comply with PSR-16
Tim Otten [Sat, 23 Jun 2018 02:22:34 +0000 (19:22 -0700)]
(dev/core#174) Redis - Updates to comply with PSR-16

6 years ago(dev/core#174) ArrayCache - Updates to comply with PSR-16
Tim Otten [Thu, 21 Jun 2018 00:35:14 +0000 (17:35 -0700)]
(dev/core#174) ArrayCache - Updates to comply with PSR-16

6 years agoMerge pull request #12236 from agileware/CIVICRM-874
colemanw [Sat, 30 Jun 2018 16:42:42 +0000 (12:42 -0400)]
Merge pull request #12236 from agileware/CIVICRM-874

CiviCase, added reference of activities from different timelines.

6 years agoMerge pull request #12376 from totten/master-psr16-util
Eileen McNaughton [Sat, 30 Jun 2018 02:52:21 +0000 (19:52 -0700)]
Merge pull request #12376 from totten/master-psr16-util

(dev/core#174) Add various utilities to support PSR-16

6 years ago(dev/core#174) NaiveMultipleTrait - Fix validation of oddball iterables
Tim Otten [Fri, 29 Jun 2018 23:31:11 +0000 (16:31 -0700)]
(dev/core#174) NaiveMultipleTrait - Fix validation of oddball iterables

6 years ago(dev/core#174) CRM_Utils_Date - Add helpers for handling PSR-16 TTL's
Tim Otten [Tue, 26 Jun 2018 23:08:50 +0000 (16:08 -0700)]
(dev/core#174) CRM_Utils_Date - Add helpers for handling PSR-16 TTL's

6 years ago(dev/core#174) Implement CRM_Utils_Cache::assertValidKey
Tim Otten [Thu, 21 Jun 2018 00:51:55 +0000 (17:51 -0700)]
(dev/core#174) Implement CRM_Utils_Cache::assertValidKey

6 years ago(dev/core#174) NaiveMultipleTrait - Throw errors for bad inputs
Tim Otten [Thu, 21 Jun 2018 00:33:27 +0000 (17:33 -0700)]
(dev/core#174) NaiveMultipleTrait - Throw errors for bad inputs

6 years ago(dev/core#174) Add E2E_Cache_CacheTestCase
Tim Otten [Thu, 21 Jun 2018 00:07:39 +0000 (17:07 -0700)]
(dev/core#174) Add E2E_Cache_CacheTestCase

6 years ago(dev/core#174) Add concrete classes for cache exceptions
Tim Otten [Thu, 21 Jun 2018 00:05:43 +0000 (17:05 -0700)]
(dev/core#174) Add concrete classes for cache exceptions

PSR-16 specifies cache exceptions using interfaces.  This requires that we
implement the interfaces.

6 years agoMerge pull request #12368 from totten/master-cache-schema
Eileen McNaughton [Fri, 29 Jun 2018 21:20:17 +0000 (14:20 -0700)]
Merge pull request #12368 from totten/master-cache-schema

(dev/core#174) civicrm_cache - Finish transition from DATETIME to TIMESTAMP

6 years agoMerge pull request #12374 from yashodha/report-fixes
Eileen McNaughton [Fri, 29 Jun 2018 18:51:23 +0000 (11:51 -0700)]
Merge pull request #12374 from yashodha/report-fixes

core/issues#96 - Expose source column in booking report

6 years agocore/issues#96 - Expose source column in booking report
yashodha [Fri, 29 Jun 2018 09:38:47 +0000 (15:08 +0530)]
core/issues#96 - Expose source column in booking report

6 years agoMerge pull request #12342 from totten/master-psr16-min
Eileen McNaughton [Thu, 28 Jun 2018 16:15:14 +0000 (09:15 -0700)]
Merge pull request #12342 from totten/master-psr16-min

Caching - Comply with PSR-16 interfaces

6 years agoMerge pull request #12355 from mattwire/CRM-21574_disable_contact_email_tellafriend_nfc
Monish Deb [Thu, 28 Jun 2018 07:31:50 +0000 (13:01 +0530)]
Merge pull request #12355 from mattwire/CRM-21574_disable_contact_email_tellafriend_nfc

CRM-21574 NFC code cleanup of CRM_Friend_BAO_Friend class

6 years ago(dev/core#174) Update top-level interfaces to show PSR-16 support
Tim Otten [Tue, 19 Jun 2018 23:54:25 +0000 (16:54 -0700)]
(dev/core#174) Update top-level interfaces to show PSR-16 support

6 years agocomposer.json - Import PSR-16 interfaces (psr/simple-cache ~1.0.1)
Tim Otten [Tue, 19 Jun 2018 23:52:47 +0000 (16:52 -0700)]
composer.json - Import PSR-16 interfaces (psr/simple-cache ~1.0.1)

6 years ago(dev/core#174) CRM_Utils_Cache_Interface - Add `has()` (PSR-16)
Tim Otten [Tue, 19 Jun 2018 23:43:21 +0000 (16:43 -0700)]
(dev/core#174) CRM_Utils_Cache_Interface - Add `has()` (PSR-16)

6 years ago(dev/core#174) CRM_Utils_Cache_Interface::clear() is an alias for flush()
Tim Otten [Tue, 19 Jun 2018 23:22:28 +0000 (16:22 -0700)]
(dev/core#174) CRM_Utils_Cache_Interface::clear() is an alias for flush()

flush() is specified by Civi's traditional interface, and clear() is
specified by PSR-16. The semantics should be the same (i.e. remove
any records managed by this cache-object).

This treats flush() and clear() as aliases.

6 years ago(dev/core#174) CRM_Utils_Cache_Interface::delete() - Return bool like PSR-16
Tim Otten [Tue, 19 Jun 2018 23:18:48 +0000 (16:18 -0700)]
(dev/core#174) CRM_Utils_Cache_Interface::delete() - Return bool like PSR-16

The function signature for `delete()` did not specify a return value, and
actual behaviors varied depending on the driver (`bool` for memcache,
`int` for redis, and `void` for others).

This standardizes on returning a bool -- which makes the signature align
with PSR-16's `delete()`.

6 years ago(dev/core#174) CRM_Utils_Cache_Interface::flush() - Return bool like PSR-16
Tim Otten [Tue, 19 Jun 2018 23:06:26 +0000 (16:06 -0700)]
(dev/core#174) CRM_Utils_Cache_Interface::flush() - Return bool like PSR-16

The function signature for `flush()` did not specify a return value, and
actual behaviors varied depending on the driver (`bool` for memcache,
`int` for redis, and `void` for others).

This standardizes on returning a bool -- which makes the signature align
with PSR-16's `clear()`.

6 years ago(dev/core#174) CRM_Utils_Cache_Interface - Add getMultiple/setMultiple (PSR-16)
Tim Otten [Tue, 19 Jun 2018 22:53:46 +0000 (15:53 -0700)]
(dev/core#174) CRM_Utils_Cache_Interface - Add getMultiple/setMultiple (PSR-16)

6 years ago(dev/core#174) CRM_Utils_Cache_Interface::set() should match PSR-16
Tim Otten [Tue, 19 Jun 2018 22:19:01 +0000 (15:19 -0700)]
(dev/core#174) CRM_Utils_Cache_Interface::set() should match PSR-16

Comparing `CRM_Utils_Cache_Interface::set()` and `Psr\SimpleCache\CacheInterface::set()`,
they agree on key details:

1. The first value is a string key.
2. The second value is a mixed field (string or number or array...).
3. The return value should be a boolean indicating success/failure.

There are two differences:

1. Our old interface didn't actually enforce the return-value in all cases. Should be better now.
2. PSR-16 accepts a third argument, `$ttl`, which defaults to `NULL`. In the NULL/default case,
   the semantics are the same (i.e. up to the discretion of the driver).
    1. Since no existing callers actually use this, we can (for moment) throw an
       error if someone tries to pass `$ttl` to a driver that doesn't support it.
3. The `$value` is pass-by-reference. However, this probably doesn't mean anything.
    1. In older Civi code, there was a tendenacy to pass-by-reference without any real
       need -- perhaps just speculation about performance.
    2. Most cache drivers serialize the value and send it elsewhere. References will
       not survive the process. If there's some code/caller/use-case that requires the
       references to work, then it's already broken for most drivers (except maybe `ArrayCache`).
    3. The old signature meant that callers had to say `$bar=123; $cache->set('foo', $bar)` rather than
       `$cache->set('foo', 123)`. This change relaxes the contract -- so that you can pass
       either `$bar` or `123.

See also: https://www.php-fig.org/psr/psr-16/

6 years ago(dev/core#174) CRM_Utils_Cache_Interface::get() should match PSR-16
Tim Otten [Tue, 19 Jun 2018 22:09:08 +0000 (15:09 -0700)]
(dev/core#174) CRM_Utils_Cache_Interface::get() should match PSR-16

Comparing `CRM_Utils_Cache_Interface::get()` and `Psr\SimpleCache\CacheInterface::get()`,
they agree on key details:

1. They return values are `mixed` (strings, arrays, numbers,, etc)
2. The default representation of a cache-miss is NULL.

They differ in that PSR-16 allows the caller to optionally specify a `$default`.

Since no existing callers actually use this, we can (for moment) throw an
error if someone tries to pass `$default` to a driver that doesn't support
it.

See also: https://www.php-fig.org/psr/psr-16/

6 years agoMerge pull request #12348 from totten/master-clean-keys
Seamus Lee [Wed, 27 Jun 2018 21:15:44 +0000 (07:15 +1000)]
Merge pull request #12348 from totten/master-clean-keys

(dev/core#174) Cache-keys for CRM_Utils_Cache_* should avoid reserved chars

6 years ago(dev/core#174) civicrm_cache - Mandate change from DATETIME to TIMESTAMP
Tim Otten [Wed, 27 Jun 2018 20:20:36 +0000 (13:20 -0700)]
(dev/core#174) civicrm_cache - Mandate change from DATETIME to TIMESTAMP

v4.7.20 updated the definition of `created_date` and `expired_date` so that
new installs would default to TIMESTAMP instead of DATETIME.  Status-checks
and DoctorWhen have been encouraging a transition, but it wasn't mandated,
and there was little urgency...  because `expired_date` was ignored, and
adhoc TTLs on `created_date` had generally long windows.  Now that we're
using `expired_date` in more important ways for 5.4 (dev/core#174), we want
to ensure that these values are handled precisely and consistently.

Before
------------------------------
* On new deployments, `created_date` and `expired_date` are TIMESTAMP.
* On upgraded deployments, `created_date` and `expired_date` may
  be using DATETIME or TIMESTAMP (depending on the particular history
  and administrative decisions).

After
------------------------------
* On all deployments, `created_date` and `expired_date` are TIMESTAMP.

6 years agoCivi\Angular\Manager - Use PSR-16 compliant cache key
Tim Otten [Tue, 26 Jun 2018 19:09:11 +0000 (12:09 -0700)]
Civi\Angular\Manager - Use PSR-16 compliant cache key

6 years agoCRM_Contact_BAO_ContactType - Use PSR-16 compliant cache key
Tim Otten [Mon, 25 Jun 2018 23:19:41 +0000 (16:19 -0700)]
CRM_Contact_BAO_ContactType - Use PSR-16 compliant cache key

6 years agoCRM_Core_BAO_CacheTest - Unit test for CRM_Core_BAO_Cache::cleanKey
Tim Otten [Thu, 21 Jun 2018 23:19:37 +0000 (16:19 -0700)]
CRM_Core_BAO_CacheTest - Unit test for CRM_Core_BAO_Cache::cleanKey

6 years agoCRM_ACL_BAO_ACL - Use PSR-16 compliant cache key
Tim Otten [Thu, 21 Jun 2018 08:22:57 +0000 (01:22 -0700)]
CRM_ACL_BAO_ACL - Use PSR-16 compliant cache key

6 years agoCRM_Core_PseudoConstant - Use PSR-16 compliant cache key
Tim Otten [Thu, 21 Jun 2018 08:23:20 +0000 (01:23 -0700)]
CRM_Core_PseudoConstant - Use PSR-16 compliant cache key

6 years agoCRM_Cxn_CiviCxnHttp - Use PSR-16 compliant cache key
Tim Otten [Thu, 21 Jun 2018 08:23:45 +0000 (01:23 -0700)]
CRM_Cxn_CiviCxnHttp - Use PSR-16 compliant cache key

6 years agoCRM_Extension_Mapper - Use PSR-16 compliant cache key
Tim Otten [Thu, 21 Jun 2018 05:39:08 +0000 (22:39 -0700)]
CRM_Extension_Mapper - Use PSR-16 compliant cache key

6 years agoCRM_Core_OptionGroup - Use PSR-16 compliant cache key
Tim Otten [Thu, 21 Jun 2018 05:39:31 +0000 (22:39 -0700)]
CRM_Core_OptionGroup - Use PSR-16 compliant cache key

6 years agoSettingsManager - Use PSR-16 compliant cache key
Tim Otten [Thu, 21 Jun 2018 05:40:06 +0000 (22:40 -0700)]
SettingsManager - Use PSR-16 compliant cache key

6 years agoCRM_Core_BAO_Cache - Use PSR-16 compliant cache key (for extra cache tier)
Tim Otten [Thu, 21 Jun 2018 05:40:36 +0000 (22:40 -0700)]
CRM_Core_BAO_Cache - Use PSR-16 compliant cache key (for extra cache tier)

6 years agoMerge pull request #12354 from totten/master-cache-b64
colemanw [Tue, 26 Jun 2018 23:44:26 +0000 (19:44 -0400)]
Merge pull request #12354 from totten/master-cache-b64

 (dev/core#174) civicrm_cache - Allow storage of binary data

6 years agoNFC code cleanup of CRM_Friend_BAO_Friend class
Matthew Wire [Fri, 22 Jun 2018 07:50:41 +0000 (08:50 +0100)]
NFC code cleanup of CRM_Friend_BAO_Friend class

6 years agoMerge pull request #12363 from JMAConsulting/dev-core-41
Eileen McNaughton [Tue, 26 Jun 2018 20:00:07 +0000 (13:00 -0700)]
Merge pull request #12363 from JMAConsulting/dev-core-41

dev/core#41: Added unit test

6 years agodev/core#41: Add unit test
deb.monish [Tue, 26 Jun 2018 09:56:39 +0000 (15:26 +0530)]
dev/core#41: Add unit test

6 years agoMerge pull request #12357 from pradpnayak/issues-203
Eileen McNaughton [Sat, 23 Jun 2018 02:29:18 +0000 (14:29 +1200)]
Merge pull request #12357 from pradpnayak/issues-203

dev/core/issues/203, removed cruft code

6 years agodev/core/issues/203, removed cruft code
Pradeep Nayak [Fri, 22 Jun 2018 14:35:09 +0000 (15:35 +0100)]
dev/core/issues/203, removed cruft code

6 years agodev/core/issues/202, check if default currency is set
Pradeep Nayak [Fri, 22 Jun 2018 14:20:39 +0000 (15:20 +0100)]
dev/core/issues/202, check if default currency is set

6 years agoCRM_Core_BAO_Cache - Load/store binary data in cache (via base64)
Tim Otten [Fri, 22 Jun 2018 03:05:04 +0000 (20:05 -0700)]
CRM_Core_BAO_Cache - Load/store binary data in cache (via base64)

6 years agoCRM_Core_BAO_CacheTest - Test more example values
Tim Otten [Thu, 21 Jun 2018 08:43:19 +0000 (01:43 -0700)]
CRM_Core_BAO_CacheTest - Test more example values

6 years agoMerge pull request #12332 from eileenmcnaughton/token
colemanw [Fri, 22 Jun 2018 02:22:04 +0000 (22:22 -0400)]
Merge pull request #12332 from eileenmcnaughton/token

Add support for hidden fields in general (and 'token' specifically) on the payment form.

6 years agoMerge pull request #11241 from mattwire/CRM-21392_find_groups_viewcomponents
Eileen McNaughton [Thu, 21 Jun 2018 21:57:19 +0000 (09:57 +1200)]
Merge pull request #11241 from mattwire/CRM-21392_find_groups_viewcomponents

CRM-21392 Allow viewing groups/smartgroups as as other entities (eg. memberships, events)

6 years agoMerge pull request #12351 from JMAConsulting/dev-core-41
Eileen McNaughton [Thu, 21 Jun 2018 21:34:05 +0000 (09:34 +1200)]
Merge pull request #12351 from JMAConsulting/dev-core-41

dev/core#41: Search Builder: Not empty with date or integer custom fields gives a sql warning

6 years agoMerge pull request #12317 from mattwire/grant_form_task
Eileen McNaughton [Thu, 21 Jun 2018 21:28:25 +0000 (09:28 +1200)]
Merge pull request #12317 from mattwire/grant_form_task

dev/core#187 Fix typo in CRM_Grant_Form_Task that prevents retrieving session key from URL

6 years agodev/core#41: Search Builder: Not empty with date or integer custom fields gives a...
deb.monish [Thu, 21 Jun 2018 11:14:28 +0000 (16:44 +0530)]
dev/core#41: Search Builder: Not empty with date or integer custom fields gives a sql warning

6 years agoMerge pull request #12349 from jitendrapurohit/profilefix
Seamus Lee [Thu, 21 Jun 2018 09:27:01 +0000 (19:27 +1000)]
Merge pull request #12349 from jitendrapurohit/profilefix

Fix profile load on update multiple action

6 years agoFix profile load on update multiple action
Jitendra Purohit [Thu, 21 Jun 2018 06:29:59 +0000 (11:59 +0530)]
Fix profile load on update multiple action

6 years agoMerge pull request #12347 from totten/master-hook-reset
Eileen McNaughton [Thu, 21 Jun 2018 04:12:10 +0000 (16:12 +1200)]
Merge pull request #12347 from totten/master-hook-reset

(NFC) CiviUnitTestCase - Fix edge-case for mis-reported error

6 years agoCiviUnitTestCase - Fix edge-case for mis-reported error
Tim Otten [Thu, 21 Jun 2018 01:16:32 +0000 (18:16 -0700)]
CiviUnitTestCase - Fix edge-case for mis-reported error

Suppose you run a test and it encounters an error very early in process --
e.g.  while processing `setUp()`, before constructing the instance of
`$this->hookClass`.  It then proceeds to `tearDown()`. Later, the test
runner will give you a report on the rrors.

Before
------------

The `tearDown` fails because the missing instance of `$this->hookClass`
raises another error, and test-report shows this misleading reference.

After
------------

The `tearDown` proceeds, and the test-report shows the real cause
of the failure.

6 years agoMerge pull request #12331 from totten/master-default-prefix
Eileen McNaughton [Thu, 21 Jun 2018 00:43:25 +0000 (12:43 +1200)]
Merge pull request #12331 from totten/master-default-prefix

(dev/core#174) CRM_Utils_Cache - Always use a prefix. Standardize delimiter

6 years agoMerge pull request #12228 from MiyaNoctem/CRM-151-fix-actions-on-membership-recurring...
Eileen McNaughton [Wed, 20 Jun 2018 20:23:52 +0000 (08:23 +1200)]
Merge pull request #12228 from MiyaNoctem/CRM-151-fix-actions-on-membership-recurring-contribution-list

dev/core#151: Allow to Edit Recurring Contributions From Membership

6 years agoMerge pull request #12178 from jitendrapurohit/membership-4
Eileen McNaughton [Wed, 20 Jun 2018 19:48:11 +0000 (07:48 +1200)]
Merge pull request #12178 from jitendrapurohit/membership-4

dev/membership#4 - Admin Membership type is displayed on Public contr…

6 years agoCRM-151: Allow to Edit Recurring Contributions From Membership
Camilo Rodriguez [Tue, 29 May 2018 18:12:32 +0000 (18:12 +0000)]
CRM-151: Allow to Edit Recurring Contributions From Membership

A check for payment processor id was causing all recurring contributions shown
on membership details view to never show the 'Edit' action, as this value was
not availble. Fixed by removing check, as it is no longer required.

6 years agoCRM-195: Add Counts to Contribution Sub-tabs
Camilo Rodriguez [Wed, 20 Jun 2018 11:01:38 +0000 (11:01 +0000)]
CRM-195: Add Counts to Contribution Sub-tabs

6 years agoMove DAO function to DAO class, call it from Merge class
eileen [Tue, 19 Jun 2018 23:45:48 +0000 (11:45 +1200)]
Move DAO function to DAO class, call it from Merge class

6 years agoMerge pull request #12341 from eileenmcnaughton/matt
Seamus Lee [Wed, 20 Jun 2018 03:35:10 +0000 (13:35 +1000)]
Merge pull request #12341 from eileenmcnaughton/matt

Remove unused instances of usedTable

6 years agoMerge pull request #12339 from colemanw/colors
Eileen McNaughton [Wed, 20 Jun 2018 02:12:19 +0000 (14:12 +1200)]
Merge pull request #12339 from colemanw/colors

Use html5 color input for contribution page widget

6 years agoRemove unused instances of useTable var
eileen [Wed, 20 Jun 2018 00:38:41 +0000 (12:38 +1200)]
Remove unused instances of useTable var

6 years agoMerge pull request #12316 from mattwire/core_task_code_cleanup
Eileen McNaughton [Wed, 20 Jun 2018 00:21:40 +0000 (12:21 +1200)]
Merge pull request #12316 from mattwire/core_task_code_cleanup

NFC Code cleanup to core task class

6 years agoMerge pull request #12336 from totten/master-status-check
Eileen McNaughton [Tue, 19 Jun 2018 22:27:13 +0000 (10:27 +1200)]
Merge pull request #12336 from totten/master-status-check

(dev/core#174) systemStatusCheckResult - Migrate from settings to cache

6 years agoCRM_Utils_Cache_SqlGroup - Don't encourage infinite recursion
Tim Otten [Fri, 30 Mar 2018 01:57:26 +0000 (18:57 -0700)]
CRM_Utils_Cache_SqlGroup - Don't encourage infinite recursion

The `deleteGroup(...$clearAll...)` option is heavy-handed and leads to
call-paths that hard to grok.

In the current design of CRM_Core_BAO_Cache (with multi-tier caching), one
does need to clear these things.  But let's not clear everything under the
sun...

6 years ago(dev/core#174) System::flushCache() - Continue existing behavior aftering fixing...
Tim Otten [Mon, 18 Jun 2018 21:58:10 +0000 (14:58 -0700)]
(dev/core#174) System::flushCache() - Continue existing behavior aftering fixing prefixes

The preceding update to `CRM_Utils_Cache` meant that `CRM_Utils_Cache::singleton()->flush()`
(aka `Civi::cache()->flush()`) would flush only the *default* cache. This revision
ensures that a general system-flush still hits the same caches.

However, we can now define *other* caches which *won't* be hit by system-flush.

6 years agoCRM_Cxn_CiviCxnHttp - Expose getCache() function
Tim Otten [Mon, 18 Jun 2018 21:57:56 +0000 (14:57 -0700)]
CRM_Cxn_CiviCxnHttp - Expose getCache() function

6 years ago(dev/core#174) CRM_Utils_Cache - Always use a prefix. Standardize delimiter.
Tim Otten [Fri, 30 Mar 2018 00:36:56 +0000 (17:36 -0700)]
(dev/core#174) CRM_Utils_Cache - Always use a prefix. Standardize delimiter.

"Prefixes" are a way to have one cache-server (e.g. one instance of redis or memcached)
which stores several different data-sets. `CRM_Utils_Cache` uses prefixes in a couple ways:

* (1) General site prefix (controlled via `civicrm.settings.php`)
    * (1a) If you have a single-site deployment, then the general prefix is blank.
    * (1b) If you have a multi-site deployment, then each site should use a different prefix (`mysite_1`, `mysite_2`, etc).
* (2) Within a given deployment, prefixes may indicate different logical data-sets.
    * (2a) `Civi::cache()` or `Civi::cache('default')` or `CRM_Utils_Cache::singleton()` are the `default` data-set.
    * (2b) `CRM_Utils_Cache::create()` can instantiate new, special-purpose
      data-sets. For example, this is used for `Civi::cache('js_strings')`.

This patch addresses two issues:

 * (Functional) Flushing the 'default' cache would likely flush all other caches
   because the 'default' cache didn't have a distinctive prefix. (This was observed Redis. Theoretically,
   the bug would apply to some-but-not-all cache backends.)
 * (Aesthetic) The full cache paths don't look consistent because they don't have a standard dlimiter.

To fully understand, it helps to see example cache keys produced in a few
configurations before and after the patch.

See also: https://lab.civicrm.org/dev/core/issues/174

Before
-----------------------------

| |Deployment Type|Logical Cache  |Combined Cache Prefix |Example Cache Item (`foobar`)|
|-|-|---------------|-------|-----------------|
|1a,2a|Single-site|`default`    |(empty-string)|`foobar`|
|1a,2b|Single-site| `js_strings` |`_js_strings`|`_js_stringsfoobar`|
|1b,2a|Multi-site |`default`    |`mysite_1_`|`mysite_1_foobar`|
|1b,2b|Multi-site |`js_strings` |`mysite_1_js_strings`|`mysite_1_js_stringsfoobar`|

* If you have a single-site deployment and try to flush `default`, you
  inadvertently flush `js_strings` because everything matches the empty-string prefix.
* If you have a multi-site deployment and try to flush `default`, you
  inadvertently flush `js_strings` because the prefix overlaps.
* The three parts of the key (deployment ID, logical cache, and cache item) are not necessarily separated.

After
-----------------------------

| |Deployment Type|Logical Cache  |Combined Cache Prefix |Example Cache Item (`foobar`)|
|-|-|---------------|-------|-----------------|
|1a,2a|Single-site|`default`    |`/default/`|`/default/foobar`|
|1a,2b|Single-site|`js_strings` |`/js_strings/`|`/js_strings/foobar`|
|1b,2a|Multi-site |`default`    |`mysite_1/default/`|`mysite_1/default/foobar`|
|1b,2b|Multi-site |`js_strings` |`mysite_1/js_strings/`|`mysite_1/js_strings/foobar`|

* If you have a single-site deployment and try to flush `default`, you
  only flush `default` because the prefixes are distinct.
* If you have a multi-site deployment and try to flush `default`, you
  only flush `default` because the prefixes are distinct.
* The three parts of the key (deployment ID, logical cache, and cache item) are always separated by `/`.

Comments
--------

When developing this patch, I found it helpful to:

* Enable Redis driver
* Open `redis-cli` and view the list of cache items with `keys *`.