X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FLogging.php;h=3287b8794f675febda5dc29548e21dbcc7077f8f;hb=c8ec6bbfaaae6e6c01821b70cabab829f35e051d;hp=c1a9010a777c08386c2da2c993cbea127b118863;hpb=12ec5bb5bfe8d3ae7a2ec327f65e521ccf233647;p=civicrm-core.git diff --git a/api/v3/Logging.php b/api/v3/Logging.php index c1a9010a77..3287b8794f 100644 --- a/api/v3/Logging.php +++ b/api/v3/Logging.php @@ -44,7 +44,8 @@ function civicrm_api3_logging_revert($params) { $schema = new CRM_Logging_Schema(); $reverter = new CRM_Logging_Reverter($params['log_conn_id'], CRM_Utils_Array::value('log_date', $params)); - $reverter->calculateDiffsFromLogConnAndDate($schema->getLogTablesForContact()); + $tables = !empty($params['tables']) ? (array) $params['tables'] : $schema->getLogTablesForContact(); + $reverter->calculateDiffsFromLogConnAndDate($tables); $reverter->revert(); return civicrm_api3_create_success(1); } @@ -73,6 +74,12 @@ function _civicrm_api3_logging_revert_spec(&$params) { 'api.default' => '10 SECOND', 'description' => ts('Used when log_date is passed in'), ); + + $params['tables'] = array( + 'title' => ts('Tables to revert'), + 'type' => CRM_Utils_Type::T_STRING, + 'description' => ts('Tables to revert, if not set all contact-referring entities will be reverted'), + ); } /** @@ -89,7 +96,8 @@ function civicrm_api3_logging_get($params) { $schema = new CRM_Logging_Schema(); $interval = (empty($params['log_date'])) ? NULL : $params['interval']; $differ = new CRM_Logging_Differ($params['log_conn_id'], CRM_Utils_Array::value('log_date', $params), $interval); - return civicrm_api3_create_success($differ->getAllChangesForConnection($schema->getLogTablesForContact())); + $tables = !empty($params['tables']) ? (array) $params['tables'] : $schema->getLogTablesForContact(); + return civicrm_api3_create_success($differ->getAllChangesForConnection($tables)); } /** @@ -116,4 +124,9 @@ function _civicrm_api3_logging_get_spec(&$params) { 'api.default' => '10 SECOND', 'description' => ts('Used when log_date is passed in'), ); + $params['tables'] = array( + 'title' => ts('Tables to query'), + 'type' => CRM_Utils_Type::T_STRING, + 'description' => ts('Tables to query, if not set all contact-referring entities will be queried'), + ); }