4.6.18
authork054 <k@fsf.org>
Fri, 10 Jun 2016 20:47:35 +0000 (15:47 -0500)
committerk054 <k@fsf.org>
Fri, 10 Jun 2016 20:47:35 +0000 (15:47 -0500)
21 files changed:
CRM/ACL/BAO/Cache.php
CRM/Contact/BAO/GroupContactCache.php
CRM/Contact/BAO/Query.php
CRM/Contact/Import/Parser/Contact.php
CRM/Contribute/BAO/Contribution.php
CRM/Contribute/Form/CancelSubscription.php
CRM/Core/BAO/CustomField.php
CRM/Core/IDS.php
CRM/Mailing/Event/BAO/TrackableURLOpen.php
CRM/Upgrade/Incremental/sql/4.6.18.mysql.tpl [new file with mode: 0644]
CRM/Utils/Date.php
CRM/Utils/Hook.php
CRM/Utils/SQL.php [new file with mode: 0644]
css/civicrmNavigation.css
sql/civicrm_generated.mysql
templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl
templates/CRM/common/navigation.js.tpl
tools/scripts/composer/dompdf-cleanup.sh
xml/schema/ACL/Cache.xml
xml/schema/Contact/Group.xml
xml/version.xml

index 0379ec29cdc7fc05478246c74daa262faa8b2d6b..2da204d9cffca4ad40419c23588140ea753cdff1 100644 (file)
@@ -153,20 +153,14 @@ WHERE contact_id = %1
     // reset any static caching
     self::$_cache = NULL;
 
-    // reset any db caching
-    $config = CRM_Core_Config::singleton();
-    $smartGroupCacheTimeout = CRM_Contact_BAO_GroupContactCache::smartGroupCacheTimeout();
-
-    //make sure to give original timezone settings again.
-    $now = CRM_Utils_Date::getUTCTime();
-
     $query = "
 DELETE
 FROM   civicrm_acl_cache
 WHERE  modified_date IS NULL
-   OR  (TIMESTAMPDIFF(MINUTE, modified_date, $now) >= $smartGroupCacheTimeout)
+   OR  (modified_date <= %1)
 ";
-    CRM_Core_DAO::singleValueQuery($query);
+    $params = array(1 => array(CRM_Contact_BAO_GroupContactCache::getCacheInvalidDateTime(), 'String'));
+    CRM_Core_DAO::singleValueQuery($query, $params);
 
     // CRM_Core_DAO::singleValueQuery("TRUNCATE TABLE civicrm_acl_contact_cache"); // No, force-commits transaction
     // CRM_Core_DAO::singleValueQuery("DELETE FROM civicrm_acl_contact_cache"); // Transaction-safe
index 9446fcb36a09efd38bf2b335f3179da697e8cbac..ff98be94def13afa7219b21c84bba57dc714e7aa 100644 (file)
@@ -68,19 +68,18 @@ class CRM_Contact_BAO_GroupContactCache extends CRM_Contact_DAO_GroupContactCach
    *   the sql query which lists the groups that need to be refreshed
    */
   public static function groupRefreshedClause($groupIDClause = NULL, $includeHiddenGroups = FALSE) {
-    $smartGroupCacheTimeout = self::smartGroupCacheTimeout();
-    $now = CRM_Utils_Date::getUTCTime();
+    $smartGroupCacheTimeoutDateTime = self::getCacheInvalidDateTime();
 
     $query = "
 SELECT  g.id
 FROM    civicrm_group g
 WHERE   ( g.saved_search_id IS NOT NULL OR g.children IS NOT NULL )
 AND     g.is_active = 1
-AND     ( g.cache_date IS NULL OR
-          ( TIMESTAMPDIFF(MINUTE, g.cache_date, $now) >= $smartGroupCacheTimeout ) OR
-          ( $now >= g.refresh_date )
-        )
-";
+AND (
+  g.cache_date IS NULL
+  OR cache_date <= $smartGroupCacheTimeoutDateTime
+  OR NOW() >= g.refresh_date
+)";
 
     if (!$includeHiddenGroups) {
       $query .= "AND (g.is_hidden = 0 OR g.is_hidden IS NULL)";
@@ -178,7 +177,7 @@ AND     ( g.cache_date IS NULL OR
 
     if (!empty($refreshGroupIDs)) {
       $refreshGroupIDString = CRM_Core_DAO::escapeString(implode(', ', $refreshGroupIDs));
-      $time = CRM_Utils_Date::getUTCTime(self::smartGroupCacheTimeout() * 60);
+      $time = self::getRefreshDateTime();
       $query = "
 UPDATE civicrm_group g
 SET    g.refresh_date = $time
@@ -266,8 +265,7 @@ AND    g.refresh_date IS NULL
     // only update cache entry if we had any values
     if ($processed) {
       // also update the group with cache date information
-      //make sure to give original timezone settings again.
-      $now = CRM_Utils_Date::getUTCTime();
+      $now = date('YmdHis');
       $refresh = 'null';
     }
     else {
@@ -304,7 +302,7 @@ WHERE  id IN ( $groupIDs )
     static $invoked = FALSE;
 
     // typically this needs to happy only once per instance
-    // this is especially TRUE in import, where we dont need
+    // this is especially TRUE in import, where we don't need
     // to do this all the time
     // this optimization is done only when no groupID is passed
     // i.e. cache is reset for all groups
@@ -329,14 +327,20 @@ WHERE  id IN ( $groupIDs )
     }
 
     $refresh = NULL;
-    $params = array();
     $smartGroupCacheTimeout = self::smartGroupCacheTimeout();
 
+
     $now = CRM_Utils_Date::getUTCTime();
     $refreshTime = CRM_Utils_Date::getUTCTime($smartGroupCacheTimeout * 60);
     // HACK: Hardcoded delete limit.
     $deleteLimit = 1000;
 
+    $params = array(
+      1 => array(self::getCacheInvalidDateTime(), 'String'),
+      2 => array(self::getRefreshDateTime(), 'String'),
+    );
+
+
     if (!isset($groupID)) {
       if ($smartGroupCacheTimeout == 0) {
         $query = "
@@ -371,12 +375,10 @@ WHERE  g.cache_date <= %1
 ";
         $refresh = "
 UPDATE civicrm_group g
-SET    refresh_date = $refreshTime
-WHERE  g.cache_date > %1
+SET    refresh_date = %2
+WHERE  g.cache_date < %1
 AND    refresh_date IS NULL
 ";
-        $cacheTime = date('Y-m-d H-i-s', strtotime("- $smartGroupCacheTimeout minutes"));
-        $params = array(1 => array($cacheTime, 'String'));
       }
     }
     elseif (is_array($groupID)) {
@@ -465,10 +467,10 @@ WHERE  id = %1
       return;
     }
 
-    // grab a lock so other processes dont compete and do the same query
+    // grab a lock so other processes don't compete and do the same query
     $lock = Civi\Core\Container::singleton()->get('lockManager')->acquire("data.core.group.{$groupID}");
     if (!$lock->isAcquired()) {
-      // this can cause inconsistent results since we dont know if the other process
+      // this can cause inconsistent results since we don't know if the other process
       // will fill up the cache before our calling routine needs it.
       // however this routine does not return the status either, so basically
       // its a "lets return and hope for the best"
@@ -719,4 +721,27 @@ ORDER BY   gc.contact_id, g.children
     }
   }
 
+  /**
+   * Get the datetime from which the cache should be considered invalid.
+   *
+   * Ie if the smartgroup cache timeout is 5 minutes ago then the cache is invalid if it was
+   * refreshed 6 minutes ago, but not if it was refreshed 4 minutes ago.
+   *
+   * @return string
+   */
+  public static function getCacheInvalidDateTime() {
+    return date('Ymdhis', strtotime("-" . self::smartGroupCacheTimeout() . " Minutes"));
+  }
+
+  /**
+   * Get the date when the cache should be refreshed from.
+   *
+   * Ie. now + the offset & we will delete anything prior to then.
+   *
+   * @return string
+   */
+  public static function getRefreshDateTime() {
+    return date('Ymdhis', strtotime("+ " . self::smartGroupCacheTimeout() . " Minutes"));
+  }
+
 }
index 4bf2395ece99c851ff094a274e01b7c3500ae89b..6b53342e9e71e46ca6e021dfb4f6d8b3e7993bbf 100644 (file)
@@ -5796,6 +5796,7 @@ AND   displayRelType.is_active = 1
    *   list(string $orderByClause, string $additionalFromClause).
    */
   protected function prepareOrderBy($sort, $sortByChar, $sortOrder, $additionalFromClause) {
+    $order = NULL;
     $config = CRM_Core_Config::singleton();
     if ($config->includeOrderByClause ||
       isset($this->_distinctComponentClause)
index 1fc0cde3a8406c33a31f5061034777e87d9edd7d..96464689bb72d6b1e856c187e5a0a1ba1a21aac8 100644 (file)
@@ -1139,7 +1139,23 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
     if (empty($params['contact_type'])) {
       $params['contact_type'] = 'Individual';
     }
-    $customFields = CRM_Core_BAO_CustomField::getFields($params['contact_type'], FALSE, FALSE, $csType);
+
+    // get array of subtypes - CRM-18708
+    if (in_array($csType, array('Individual', 'Organization', 'Household'))) {
+      $csType = self::getSubtypes($params['contact_type']);
+    }
+
+    if (is_array($csType)) {
+      // fetch custom fields for every subtype and add it to $customFields array
+      // CRM-18708
+      $customFields = array();
+      foreach ($csType as $cType) {
+        $customFields += CRM_Core_BAO_CustomField::getFields($params['contact_type'], FALSE, FALSE, $cType);
+      }
+    }
+    else {
+      $customFields = CRM_Core_BAO_CustomField::getFields($params['contact_type'], FALSE, FALSE, $csType);
+    }
 
     $addressCustomFields = CRM_Core_BAO_CustomField::getFields('Address');
     $customFields = $customFields + $addressCustomFields;
@@ -2142,4 +2158,22 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
     return $allowToCreate;
   }
 
+  /**
+   * get subtypes given the contact type
+   *
+   * @param string $contactType
+   * @return array $subTypes
+   */
+  public static function getSubtypes($contactType) {
+    $subTypes = array();
+    $types = CRM_Contact_BAO_ContactType::subTypeInfo($contactType);
+
+    if (count($types) > 0) {
+      foreach ($types as $type) {
+        $subTypes[] = $type['name'];
+      }
+    }
+    return $subTypes;
+  }
+
 }
index 9406e75b53716197a018094069d6e9c0064ac3a8..803ac6b92f22880b51c810251c6e0b6f1c8c4691 100644 (file)
@@ -3801,10 +3801,8 @@ WHERE con.id = {$contributionId}
     do {
       $creditNoteNum++;
       $creditNoteId = CRM_Utils_Array::value('credit_notes_prefix', $prefixValue) . "" . $creditNoteNum;
-      $result = civicrm_api3('Contribution', 'getcount', array(
-        'sequential' => 1,
-        'creditnote_id' => $creditNoteId,
-      ));
+      $params = array(1 => array($creditNoteId, 'String'));
+      $result = CRM_Core_DAO::singleValueQuery("SELECT count(id) FROM civicrm_contribution WHERE creditnote_id = %1", $params);
     } while ($result > 0);
 
     return $creditNoteId;
index 59a0c0f7541a80e5e8e7b160578411a1e6e1d744..5ded40fa3d904ba253b843a53b77f33e68441b5a 100644 (file)
@@ -76,12 +76,13 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form {
     }
 
     if ($this->_mid) {
-      if (CRM_Member_BAO_Membership::isSubscriptionCancelled($this->_mid)) {
-        CRM_Core_Error::fatal(ts('The auto renewal option for this membership looks to have been cancelled already.'));
-      }
       $this->_mode = 'auto_renew';
-      $this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_mid, 'membership', 'obj');
-      $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_mid, 'membership');
+      // CRM-18468: crid is more accurate than mid for getting
+      // subscriptionDetails, so don't get them again.
+      if (!$this->_crid) {
+        $this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_mid, 'membership', 'obj');
+        $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_mid, 'membership');
+      }
 
       $membershipTypes = CRM_Member_PseudoConstant::membershipType();
       $membershipTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_mid, 'membership_type_id');
index 785ff96a552d9fc2a544eaf32ebfecf32e3f9964..717459a10e0e6cc234927d312a2ed1a1f4d6c8ed 100644 (file)
@@ -834,6 +834,12 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
           $qf->add('text', $elementName . '_to', ts('To'), $field->attributes);
         }
         else {
+          if ($field->text_length) {
+            $field->attributes .= ' maxlength=' . $field->text_length;
+            if ($field->text_length < 20) {
+              $field->attributes .= ' size=' . $field->text_length;
+            }
+          }
           $element = &$qf->add('text', $elementName, $label,
             $field->attributes,
             $useRequired && !$search
index 889fa27e386742c3a949ec3f3ddb95cf972b1248..ea7538f9fecc7db4bfd138bbc97b5ad17691ae65 100644 (file)
@@ -58,7 +58,8 @@ class CRM_Core_IDS {
    */
   public function check(&$args) {
     // lets bypass a few civicrm urls from this check
-    static $skip = array('civicrm/admin/setting/updateConfigBackend', 'civicrm/admin/messageTemplates');
+    $skip = array('civicrm/admin/setting/updateConfigBackend', 'civicrm/admin/messageTemplates');
+    CRM_Utils_Hook::idsException($skip);
     $path = implode('/', $args);
     if (in_array($path, $skip)) {
       return NULL;
index 3c17ae7c9e6294c7955e73d24a738cb12473a5f7..2f349f6d0d87da8f66fc202f8b4430588fde57e8 100755 (executable)
@@ -81,9 +81,16 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track
     );
 
     if (!$search->fetch()) {
-      /* Whoops, error, don't track it.  Return the base url. */
+      // Can't find either the URL or the queue. If we can find the URL then
+      // return the URL without tracking.  Otherwise return the base URL.
 
-      return CRM_Utils_System::baseURL();
+      $search->query("SELECT $turl.url as url from $turl
+                    WHERE $turl.id = " . CRM_Utils_Type::escape($url_id, 'Integer')
+      );
+      if (!$search->fetch()) {
+        return CRM_Utils_System::baseURL();
+      }
+      return $search->url;
     }
 
     $open = new CRM_Mailing_Event_BAO_TrackableURLOpen();
diff --git a/CRM/Upgrade/Incremental/sql/4.6.18.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.6.18.mysql.tpl
new file mode 100644 (file)
index 0000000..09edb02
--- /dev/null
@@ -0,0 +1,4 @@
+{* file to handle db changes in 4.6.18 during upgrade *}
+-- CRM-18516 Convert the date fields relating to group caching and acl caching timestamp
+ALTER TABLE civicrm_group CHANGE cache_date cache_date timestamp NULL DEFAULT NULL , CHANGE refresh_date refresh_date timestamp NULL DEFAULT NULL;
+ALTER TABLE civicrm_acl_cache CHANGE modified_date modified_date timestamp NULL DEFAULT NULL;
index f58994f6b3b1dfcabb65da9873923282072718b3..1a313cfc1b63ed3dd1b0c1abe33c87d85b8c30f1 100644 (file)
@@ -1785,25 +1785,6 @@ class CRM_Utils_Date {
     return $format;
   }
 
-  /**
-   * Get the time in UTC for the current time. You can optionally send an offset from the current time if needed
-   *
-   * @param int $offset
-   *   the offset from the current time in seconds.
-   *
-   * @return string
-   *   the time in UTC
-   */
-  public static function getUTCTime($offset = 0) {
-    $originalTimezone = date_default_timezone_get();
-    date_default_timezone_set('UTC');
-    $time = time() + $offset;
-    $now = date('YmdHis', $time);
-    date_default_timezone_set($originalTimezone);
-    return $now;
-  }
-
-
   /**
    * @param $date
    * @param $dateType
index 6fd64ff70a11dec9de363ca84ad28e91ea6a7adf..9d1ac305172b3594ab0a8c82429ef7962fb2eb57 100644 (file)
@@ -1978,4 +1978,15 @@ abstract class CRM_Utils_Hook {
     );
   }
 
+  /**
+   * This hook is called for bypass a few civicrm urls from IDS check
+   * @param array $skip list of civicrm url;
+   */
+  public static function idsException(&$skip) {
+    return self::singleton()->invoke(1, $skip, self::$_nullObject,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_idsException'
+    );
+  }
+
 }
diff --git a/CRM/Utils/SQL.php b/CRM/Utils/SQL.php
new file mode 100644 (file)
index 0000000..b46e439
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2016                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ * Just another collection of static utils functions.
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2016
+ */
+class CRM_Utils_SQL {
+
+  /**
+   * Helper function for adding the permissioned subquery from one entity onto another
+   *
+   * @param string $entity
+   * @param string $joinColumn
+   * @return array
+   */
+  public static function mergeSubquery($entity, $joinColumn = 'id') {
+    require_once 'api/v3/utils.php';
+    $baoName = _civicrm_api3_get_BAO($entity);
+    $bao = new $baoName();
+    $clauses = $subclauses = array();
+    foreach ((array) $bao->addSelectWhereClause() as $field => $vals) {
+      if ($vals && $field == $joinColumn) {
+        $clauses = array_merge($clauses, (array) $vals);
+      }
+      elseif ($vals) {
+        $subclauses[] = "$field " . implode(" AND $field ", (array) $vals);
+      }
+    }
+    if ($subclauses) {
+      $clauses[] = "IN (SELECT `$joinColumn` FROM `" . $bao->tableName() . "` WHERE " . implode(' AND ', $subclauses) . ")";
+    }
+    return $clauses;
+  }
+
+}
index feb8325a3d0c21cb5409886044f06da2bdaba09f..b45a5389ca867418dcd4f24bbcba137d9ff8720b 100644 (file)
@@ -132,4 +132,13 @@ li.menu-separator{
   width: 16px;
   height: 16px;
   vertical-align:middle;
-}
\ No newline at end of file
+}
+
+/* No results */
+.crm-quickSearch-results.ui-menu-disabled {
+  opacity: .9;
+  background-color: #f8f8f8;
+}
+.crm-quickSearch-results.ui-menu-disabled li {
+  cursor: default;
+}
index 489fc1ec2c2d4b9a0b330550e3f29f535b1bb880..3d1c0aaf491a907a841a6b7c842aa6e53fdd29ae 100644 (file)
@@ -399,7 +399,7 @@ UNLOCK TABLES;
 
 LOCK TABLES `civicrm_domain` WRITE;
 /*!40000 ALTER TABLE `civicrm_domain` DISABLE KEYS */;
-INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'4.6.17',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
+INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'4.6.18',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
 /*!40000 ALTER TABLE `civicrm_domain` ENABLE KEYS */;
 UNLOCK TABLES;
 
index 8b5eee6d358f62a729481c9b062779311746ee47..09821c2d1d667737c66080456847aa9c037afd90 100644 (file)
@@ -264,7 +264,12 @@ function setLocationDetails(contactID , reset) {
         else {
           // do not set defaults to file type fields
           if (cj('#' + ele).attr('type') != 'file') {
-            cj('#' + ele ).val(data[ele].value).change();
+            if (ele.split("_").pop() == 'display') {
+              cj("[id^='"+ele+"']").val(data[ele].value).change();
+            }
+            else {
+              cj('#' + ele ).val(data[ele].value).change();
+            }
           }
         }
       }
index 9745d715028272fe58df8fd78a5730eda58e5a50..2dc8896ddc5b3211f36fef8b07a0d55f10d09823 100644 (file)
@@ -103,10 +103,14 @@ $('#civicrm-menu').ready(function() {
           };
         CRM.api3('contact', 'getquick', params).done(function(result) {
           var ret = [];
-          if (result.values) {
+          if (result.values.length > 0) {
+            $('#sort_name_navigation').autocomplete('widget').menu('option', 'disabled', false);
             $.each(result.values, function(k, v) {
               ret.push({value: v.id, label: v.data});
-            })
+            });
+          } else {
+            $('#sort_name_navigation').autocomplete('widget').menu('option', 'disabled', true);
+            ret.push({value: '0', label: {/literal}'{ts escape='js'}None found.{/ts}'{literal}});
           }
           response(ret);
         })
@@ -115,12 +119,16 @@ $('#civicrm-menu').ready(function() {
         return false;
       },
       select: function (event, ui) {
-        document.location = CRM.url('civicrm/contact/view', {reset: 1, cid: ui.item.value});
+        if (ui.item.value > 0) {
+          document.location = CRM.url('civicrm/contact/view', {reset: 1, cid: ui.item.value});
+        }
         return false;
       },
       create: function() {
         // Place menu in front
-        $(this).autocomplete('widget').css('z-index', $('#civicrm-menu').css('z-index'));
+        $(this).autocomplete('widget')
+          .addClass('crm-quickSearch-results')
+          .css('z-index', $('#civicrm-menu').css('z-index'));
       }
     })
     .keydown(function() {
@@ -167,8 +175,10 @@ $('#civicrm-menu').ready(function() {
     var $menu = $('#sort_name_navigation').autocomplete('widget');
     if ($('li.ui-menu-item', $menu).length === 1) {
       var cid = $('li.ui-menu-item', $menu).data('ui-autocomplete-item').value;
-      document.location = CRM.url('civicrm/contact/view', {reset: 1, cid: cid});
-      return false;
+      if (cid > 0) {
+        document.location = CRM.url('civicrm/contact/view', {reset: 1, cid: cid});
+        return false;
+      }
     }
   });
   // Close menu after selecting an item
index b56c5b4888b1f23b9599d13f909d8a32c85cd0b8..9ee2e377e22a8201b94c10bbd8485a72ce38d56d 100755 (executable)
@@ -109,15 +109,23 @@ Download the latest version and copy the font files from the lib/fonts directori
 EOREADME
 }
 
+## usage: simple_replace <filename> <old-string> <new-string>
+## This is a bit like 'sed -i', but dumber and more cross-platform.
+function simple_replace() {
+  php -r 'file_put_contents($argv[1], str_replace($argv[2], $argv[3], file_get_contents($argv[1])));' "$@"
+}
+
 ##############################################################################
 ## Remove example/CLI scripts. They're not needed and increase the attack-surface.
 safe_delete vendor/dompdf/dompdf/dompdf.php
 safe_delete vendor/dompdf/dompdf/load_font.php
 safe_delete vendor/dompdf/dompdf/www
-safe_delete vendor/dompdf/dompdf/lib/html5lib/TreeBuilder.php
 safe_delete vendor/phenx/php-font-lib/www
 
 # Remove DejaVu fonts. They add 12mb.
 safe_delete vendor/dompdf/dompdf/lib/fonts/DejaVu*
 make_font_cache > vendor/dompdf/dompdf/lib/fonts/dompdf_font_family_cache.dist.php
 make_font_readme > vendor/dompdf/dompdf/lib/fonts/README.DejaVuFonts.txt
+
+# Remove debug_print_backtrace(), which can leak system details. Put backtrace in log.
+simple_replace vendor/dompdf/dompdf/lib/html5lib/TreeBuilder.php 'debug_print_backtrace();' 'CRM_Core_Error::backtrace("backTrace", TRUE);'
index 52f34f9b466ed83903d6816f20424cce59b223d2..3c1c44a793e0e1c8b928b2f5e1c0083d1b3199ac 100644 (file)
@@ -51,7 +51,9 @@
   </index>
   <field>
     <name>modified_date</name>
-    <type>date</type>
+    <title>Cache Modified Date</title>
+    <type>timestamp</type>
+    <required>false</required>
     <comment>When was this cache entry last modified</comment>
     <add>1.6</add>
   </field>
index 6f68023e738a90d31f2fe2d8cc1df84205bb5596..5f09e4147e1184e0dbcc46fde089f630c1fbdb69 100644 (file)
   </field>
   <field>
     <name>cache_date</name>
-    <type>datetime</type>
+    <type>timestamp</type>
     <title>Group Cache Date</title>
+    <required>false</required>
     <comment>Date when we created the cache for a smart group</comment>
     <add>2.1</add>
   </field>
   <field>
     <name>refresh_date</name>
-    <type>datetime</type>
+    <type>timestamp</type>
     <title>Next Group Refresh Time</title>
+    <required>false</required>
     <comment>Date and time when we need to refresh the cache next.</comment>
     <add>4.3</add>
   </field>
index 76883249b26fc7f98fd67cbd6bb484d0f1d92d81..f10f3fc3a434519e644e5793245b956bd060b035 100644 (file)
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="iso-8859-1" ?>
 <version>
-  <version_no>4.6.17</version_no>
+  <version_no>4.6.18</version_no>
 </version>