本文整理汇总了PHP中CRM_Core_Error::debug_log_message方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Error::debug_log_message方法的具体用法?PHP CRM_Core_Error::debug_log_message怎么用?PHP CRM_Core_Error::debug_log_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Error
的用法示例。
在下文中一共展示了CRM_Core_Error::debug_log_message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Perform an upgrade without using the web-frontend
*
* @param bool $enablePrint
*
* @throws Exception
* @return array, with keys:
* - message: string, HTML-ish blob
*/
public function run($enablePrint = TRUE)
{
// lets get around the time limit issue if possible for upgrades
if (!ini_get('safe_mode')) {
set_time_limit(0);
}
$upgrade = new CRM_Upgrade_Form();
list($currentVer, $latestVer) = $upgrade->getUpgradeVersions();
if ($error = $upgrade->checkUpgradeableVersion($currentVer, $latestVer)) {
throw new Exception($error);
}
// Disable our SQL triggers
CRM_Core_DAO::dropTriggers();
// CRM-11156
$preUpgradeMessage = NULL;
$upgrade->setPreUpgradeMessage($preUpgradeMessage, $currentVer, $latestVer);
$postUpgradeMessageFile = CRM_Utils_File::tempnam('civicrm-post-upgrade');
$queueRunner = new CRM_Queue_Runner(array('title' => ts('CiviCRM Upgrade Tasks'), 'queue' => CRM_Upgrade_Form::buildQueue($currentVer, $latestVer, $postUpgradeMessageFile)));
$queueResult = $queueRunner->runAll();
if ($queueResult !== TRUE) {
$errorMessage = CRM_Core_Error::formatTextException($queueResult['exception']);
CRM_Core_Error::debug_log_message($errorMessage);
if ($enablePrint) {
print $errorMessage;
}
throw $queueResult['exception'];
// FIXME test
}
CRM_Upgrade_Form::doFinish();
$message = file_get_contents($postUpgradeMessageFile);
return array('latestVer' => $latestVer, 'message' => $message, 'text' => CRM_Utils_String::htmlToText($message));
}
示例2: __construct
function __construct()
{
$this->initialize();
CRM_Utils_System::authenticateScript(TRUE);
//log the execution of script
CRM_Core_Error::debug_log_message('CiviReportMail.php');
}
示例3: run
function run()
{
session_start();
require_once '../civicrm.config.php';
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton();
require_once 'Console/Getopt.php';
$shortOptions = "n:p:k:pre";
$longOptions = array('name=', 'pass=', 'key=', 'prefix=');
$getopt = new Console_Getopt();
$args = $getopt->readPHPArgv();
array_shift($args);
list($valid, $dontCare) = $getopt->getopt2($args, $shortOptions, $longOptions);
$vars = array('name' => 'n', 'pass' => 'p', 'key' => 'k', 'prefix' => 'pre');
foreach ($vars as $var => $short) {
${$var} = NULL;
foreach ($valid as $v) {
if ($v[0] == $short || $v[0] == "--{$var}") {
${$var} = $v[1];
break;
}
}
if (!${$var}) {
${$var} = CRM_Utils_Array::value($var, $_REQUEST);
}
$_REQUEST[$var] = ${$var};
}
// this does not return on failure
// require_once 'CRM/Utils/System.php';
CRM_Utils_System::authenticateScript(TRUE, $name, $pass);
//log the execution of script
CRM_Core_Error::debug_log_message('NormalizePhone.php');
// process all phones
processPhones($config, $prefix);
}
示例4: run
function run()
{
if (CRM_Utils_System::authenticateKey()) {
$request_type = CRM_Utils_Request::retrieve('type', 'String');
$request_data = CRM_Utils_Request::retrieve('data', 'String');
$config = CRM_Core_Config::singleton();
if ($config->debug) {
$request_data_log = print_r($request_data, TRUE);
CRM_Core_Error::debug_log_message("Mailchimp Webhook Request [{$request_type}]: \n{$request_data_log}");
}
$function_name = 'self::mailchimpWebhook' . ucwords($request_type);
if (is_callable($function_name)) {
// Set a canary to prevent CiviMailchimp hooks from firing, which
// would trigger updates back to Mailchimp, resulting in an endless
// loop.
civimailchimp_static('mailchimp_do_not_run_hooks', TRUE);
try {
call_user_func($function_name, $request_data);
} catch (Exception $e) {
$error = array('code' => get_class($e), 'message' => $e->getMessage(), 'exception' => $e);
$message = "Mailchimp Webhook Request [{$request_type}]: {$error['code']}: {$error['message']}";
CRM_CiviMailchimp_BAO_SyncLog::saveMessage('error', 'mailchimp_to_civicrm', $message, $request_data);
CRM_Core_Error::debug_var('Fatal Error Details', $error);
CRM_Core_Error::backtrace('backTrace', TRUE);
throw $e;
}
}
}
parent::run();
}
示例5: postProcess
/**
* Save values.
*/
public function postProcess()
{
$values = $this->exportValues();
try {
$result = civicrm_api3('Setting', 'create', array('statelegemail_key' => $values['key']));
$success = TRUE;
} catch (CiviCRM_API3_Exception $e) {
$error = $e->getMessage();
CRM_Core_Error::debug_log_message(t('API Error: %1', array(1 => $error, 'domain' => 'com.aghstrategies.statelegemail')));
CRM_Core_Session::setStatus(ts('Error saving Sunlight Foundation API key', array('domain' => 'com.aghstrategies.statelegemail')), 'Error', 'error');
$success = FALSE;
}
try {
$result = civicrm_api3('Setting', 'create', array('statelegemail_states' => $values['states']));
} catch (CiviCRM_API3_Exception $e) {
$error = $e->getMessage();
CRM_Core_Error::debug_log_message(t('API Error: %1', array(1 => $error, 'domain' => 'com.aghstrategies.statelegemail')));
CRM_Core_Session::setStatus(ts('Error saving enabled states', array('domain' => 'com.aghstrategies.statelegemail')), 'Error', 'error');
$success = FALSE;
}
if ($success) {
CRM_Core_Session::setStatus(ts('You have successfully updated the state legislator petition settings.', array('domain' => 'com.aghstrategies.statelegemail')), 'Settings saved', 'success');
}
parent::postProcess();
}
示例6: createSnapshot
/**
* Build and run the query to select all contributions
* matching the criteria, and try to create a snapshot
*
* @return snapshot creation result/error
*/
public static function createSnapshot($values)
{
// prepare timestamps
$raw_from_ts = $values['donrec_contribution_horizon_from'];
$raw_to_ts = $values['donrec_contribution_horizon_to'];
$date_from = CRM_Utils_DonrecHelper::convertDate($raw_from_ts, -1);
$date_to = CRM_Utils_DonrecHelper::convertDate($raw_to_ts, 1);
$formatted_date_from = date('Y-m-d H:i:s', $date_from);
$formatted_date_to = date('Y-m-d H:i:s', $date_to);
$query_date_limit = "";
if ($date_from) {
$query_date_limit .= "AND `receive_date` >= '{$formatted_date_from}'";
}
if ($date_to) {
$query_date_limit .= " AND `receive_date` <= '{$formatted_date_to}'";
}
// get table- and column name
$table_query = "SELECT `cg`.`table_name`,\n `cf`.`column_name`\n FROM `civicrm_custom_group` AS cg,\n `civicrm_custom_field` AS cf\n WHERE `cg`.`name` = 'zwb_donation_receipt_item'\n AND `cf`.`custom_group_id` = `cg`.`id`\n AND `cf`.`name` = 'status'";
$results = CRM_Core_DAO::executeQuery($table_query);
$custom_group_table = NULL;
$status_column = NULL;
while ($results->fetch()) {
$custom_group_table = $results->table_name;
$status_column = $results->column_name;
}
if ($custom_group_table == NULL || $status_column == NULL) {
// something went wrong here
CRM_Core_Error::debug_log_message("de.systopia.donrec: error: custom_group_table or status_column is empty!");
return array();
}
// calculate main selector clause
if (!empty($values['contact_id'])) {
$contact_id = (int) $values['contact_id'];
$main_selector = "`contact_id` = {$contact_id}";
} elseif (!empty($values['contact_ids'])) {
$contact_ids = implode(',', $values['contact_ids']);
$main_selector = "`contact_id` IN ({$contact_ids})";
} elseif (!empty($values['contribution_ids'])) {
$contribution_ids = implode(',', $values['contribution_ids']);
$main_selector = "`civicrm_contribution`.`id` IN ({$contribution_ids})";
} else {
CRM_Core_Error::debug_log_message("de.systopia.donrec: error: no selector data found in params!");
$main_selector = "FALSE";
}
// get financial type selector clause
$profile = new CRM_Donrec_Logic_Profile($values['profile']);
$financialTypeClause = $profile->getContributionTypesClause();
// run the main query
$query = "SELECT `civicrm_contribution`.`id`\n FROM (`civicrm_contribution`)\n LEFT JOIN `{$custom_group_table}` AS existing_receipt\n ON `civicrm_contribution`.`id` = existing_receipt.`entity_id`\n AND existing_receipt.`{$status_column}` = 'ORIGINAL'\n WHERE\n ({$main_selector})\n {$query_date_limit}\n AND {$financialTypeClause}\n AND (`non_deductible_amount` = 0 OR `non_deductible_amount` IS NULL)\n AND `contribution_status_id` = 1\n AND `is_test` = 0\n AND `currency` = 'EUR'\n AND existing_receipt.`entity_id` IS NULL;";
// execute the query
$result = CRM_Core_DAO::executeQuery($query);
// build array
$contributionIds = array();
while ($result->fetch()) {
$contributionIds[] = $result->id;
}
// finally, build the snapshot with it
return CRM_Donrec_Logic_Snapshot::create($contributionIds, CRM_Donrec_Logic_Settings::getLoggedInContactID(), $formatted_date_from, $formatted_date_to, $values['profile']);
}
示例7: onEnd
/**
* Handle the final step of the queue
*/
static function onEnd(CRM_Queue_TaskContext $ctx)
{
//CRM_Utils_System::redirect('civicrm/demo-queue/done');
CRM_Core_Error::debug_log_message('finished task');
//$ctx->logy->info($message); // PEAR Log interface -- broken, PHP error
//CRM_Core_DAO::executeQuery('select from alsdkjfasdf'); // broken, PEAR error
//throw new Exception('whoz'); // broken, exception
}
示例8: setUpBeforeClass
/**
* Connect to API and create test fixtures in Mailchimp and CiviCRM.
*/
public static function setUpBeforeClass()
{
$api = CRM_Mailchimp_Utils::getMailchimpApi(TRUE);
//$api->setLogFacility(function($m){print $m;});
$api->setLogFacility(function ($m) {
CRM_Core_Error::debug_log_message($m, FALSE, 'mailchimp');
});
static::createMailchimpFixtures();
}
示例9: getRoles
/**
* Retrieve the participant roles.
*
* @return array
* The roles, by ID.
*/
public function getRoles()
{
try {
$result = civicrm_api3('Participant', 'getoptions', array('field' => "participant_role_id", 'context' => "search"));
} catch (CiviCRM_API3_Exception $e) {
$error = $e->getMessage();
CRM_Core_Error::debug_log_message(ts('API Error finding role options: %1', array('domain' => 'com.aghstrategies.eventpermissions', 1 => $error)));
}
return empty($result['values']) ? array() : $result['values'];
}
示例10: __construct
function __construct()
{
$config = CRM_Core_Config::singleton();
//this does not return on failure
require_once 'CRM/Utils/System.php';
require_once 'CRM/Utils/Hook.php';
CRM_Utils_System::authenticateScript(TRUE);
//log the execution time of script
CRM_Core_Error::debug_log_message('ParticipantProcessor.php');
}
示例11: __construct
function __construct()
{
$config = CRM_Core_Config::singleton();
// this does not return on failure
require_once 'CRM/Utils/System.php';
require_once 'CRM/Utils/Hook.php';
CRM_Utils_System::authenticateScript(TRUE);
$config->cleanURL = 1;
//log the execution time of script
CRM_Core_Error::debug_log_message('UpdatePledgeRecord.php');
}
示例12: sync
static function sync($contactId)
{
// get visa required value
$getInfo = array('entity_id' => $contactId, 'return.Extended_Demographics:Is_Visa_Required' => 1);
$isVisaRequired = civicrm_api3('custom_value', 'get', $getInfo);
$isVisaRequired = $isVisaRequired['count'] ? $isVisaRequired['values']["{$isVisaRequired['id']}"][0] : 0;
// this api call will get visa expiration date
// of immigration records for the contact
$getInfo = array('entity_id' => $contactId, 'return.Immigration:End_Date' => 1);
$immigrationDateInfo = civicrm_api3('custom_value', 'get', $getInfo);
$lastestVisaExpirationDate = NULL;
if ($immigrationDateInfo['count'] > 0) {
$lastestVisaExpirationDate = $immigrationDateInfo['values']["{$immigrationDateInfo['id']}"]['latest'];
}
// activity processing if immigration data found
if ($immigrationDateInfo['count']) {
// get 'Visa Expiration' activity for this contact
$activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Visa Expiration', 'name');
$activityStatuses = CRM_Core_OptionGroup::values('activity_status', FALSE, FALSE, FALSE, NULL, 'name');
// to check if visa expiration activity exists for the input target_contact_id
$activityGetParams = array('contact_id' => $contactId, 'activity_type_id' => $activityTypeId, 'sequential' => 1);
// note : using filter 'activity_type_id' in combination with 'contact_id' filter doesn't work
$activities = civicrm_api3('activity', 'get', $activityGetParams);
$activityId = NULL;
$count = 0;
foreach ($activities['values'] as $val) {
if ($val['activity_type_id'] != $activityTypeId || !array_key_exists('targets', $val)) {
continue;
}
$activityId = $val['id'];
$count++;
}
if ($count) {
$activityParams = array();
$activityParams['status_id'] = $isVisaRequired ? CRM_Utils_Array::key('Scheduled', $activityStatuses) : CRM_Utils_Array::key('Cancelled', $activityStatuses);
$activityParams['activity_date_time'] = $lastestVisaExpirationDate;
// check if count is one, if not log a error
if ($count > 1) {
// update the last activity and log a error
$logError = "Multiple 'Visa Expiration' activities exists for target contact with id : {$contactId}, so updating last activity with id : {$activityId}";
CRM_Core_Error::debug_log_message($logError);
}
$activityParams['id'] = $activityId;
$result = civicrm_api3('activity', 'create', $activityParams);
} else {
// if no activity create a new one only if 'visa is required'
if ($isVisaRequired) {
$activityParams = array('target_contact_id' => $contactId, 'activity_type_id' => $activityTypeId, 'subject' => 'Visa Expiration', 'activity_date_time' => $lastestVisaExpirationDate, 'status_id' => CRM_Utils_Array::key('Scheduled', $activityStatuses), 'details' => 'Visa Expiration');
$result = civicrm_api3('activity', 'create', $activityParams);
}
}
}
// end of if for immgration info check
}
示例13: __construct
function __construct()
{
$this->initialize();
$config = CRM_Core_Config::singleton();
require_once 'CRM/Utils/Request.php';
require_once 'CRM/Core/PseudoConstant.php';
require_once 'CRM/Contact/BAO/Contact.php';
// this does not return on failure
CRM_Utils_System::authenticateScript(TRUE);
//log the execution time of script
CRM_Core_Error::debug_log_message('UpdateGreeting.php');
}
示例14: log
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string $message
* @param array $context
*/
public function log($level, $message, array $context = array())
{
// FIXME: This flattens a $context a bit prematurely. When integrating
// with external/CMS logs, we should pass through $context.
if (!empty($context)) {
if (isset($context['exception'])) {
$context['exception'] = CRM_Core_Error::formatTextException($context['exception']);
}
$message .= "\n" . print_r($context, 1);
}
CRM_Core_Error::debug_log_message($message, FALSE, '', $this->map[$level]);
}
示例15: testMixLog
/**
* We have two coding conventions for writing to log. Make sure that they work together.
*
* This tests a theory about what caused CRM-10766.
*/
function testMixLog()
{
CRM_Core_Error::debug_log_message("static-1");
$logger = CRM_Core_Error::createDebugLogger();
CRM_Core_Error::debug_log_message("static-2");
$logger->info('obj-1');
CRM_Core_Error::debug_log_message("static-3");
$logger->info('obj-2');
CRM_Core_Error::debug_log_message("static-4");
$logger2 = CRM_Core_Error::createDebugLogger();
$logger2->info('obj-3');
CRM_Core_Error::debug_log_message("static-5");
$this->assertLogRegexp('/static-1.*static-2.*obj-1.*static-3.*obj-2.*static-4.*obj-3.*static-5/s');
}