Eileen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/277910

Change subject: sync with 4.7
......................................................................

sync with 4.7

I'm just bringing back these functions from master as it seems easier with lots 
of changes to make to have the files similar from the
start rather than work around conflicts. They are not called

Change-Id: I9616eb0a24595c4eaf8e247da233ac981f05fe15
---
M CRM/Logging/Schema.php
1 file changed, 46 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/10/277910/1

diff --git a/CRM/Logging/Schema.php b/CRM/Logging/Schema.php
index 447dce6..4169dd8 100644
--- a/CRM/Logging/Schema.php
+++ b/CRM/Logging/Schema.php
@@ -52,6 +52,52 @@
     'civicrm_group' => array('cache_date', 'refresh_date'),
   );
 
+
+  /**
+   * Setting Callback - Validate.
+   *
+   * @param mixed $value
+   * @param array $fieldSpec
+   *
+   * @return bool
+   * @throws API_Exception
+   */
+  public static function checkLoggingSupport(&$value, $fieldSpec) {
+    $domain = new CRM_Core_DAO_Domain();
+    $domain->find(TRUE);
+    if (!(CRM_Core_DAO::checkTriggerViewPermission(FALSE)) && $value) {
+      throw new API_Exception("In order to use this functionality, the 
installation's database user must have privileges to create triggers (in MySQL 
5.0 – and in MySQL 5.1 if binary logging is enabled – this means the SUPER 
privilege). This install either does not seem to have the required privilege 
enabled.");
+    }
+    return TRUE;
+  }
+
+  /**
+   * Setting Callback - On Change.
+   *
+   * Respond to changes in the "logging" setting. Set up or destroy
+   * triggers, etal.
+   *
+   * @param array $oldValue
+   *   List of component names.
+   * @param array $newValue
+   *   List of component names.
+   * @param array $metadata
+   *   Specification of the setting (per *.settings.php).
+   */
+  public static function onToggle($oldValue, $newValue, $metadata) {
+    if ($oldValue == $newValue) {
+      return;
+    }
+
+    $logging = new CRM_Logging_Schema();
+    if ($newValue) {
+      $logging->enableLogging();
+    }
+    else {
+      $logging->disableLogging();
+    }
+  }
+
   /**
    * Populate $this->tables and $this->logs with current db state.
    */

-- 
To view, visit https://gerrit.wikimedia.org/r/277910
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9616eb0a24595c4eaf8e247da233ac981f05fe15
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen <emcnaugh...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to