本文整理汇总了PHP中KLogger::logWarn方法的典型用法代码示例。如果您正苦于以下问题:PHP KLogger::logWarn方法的具体用法?PHP KLogger::logWarn怎么用?PHP KLogger::logWarn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KLogger
的用法示例。
在下文中一共展示了KLogger::logWarn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importDataFromSource
//.........这里部分代码省略.........
$va_ids = call_user_func_array($t_subject->tableName() . "::find", array(array('type_id' => $vs_type, 'preferred_labels' => $va_pref_label_values, 'deleted' => 0), array('returnAs' => 'ids')));
if (is_array($va_ids) && sizeof($va_ids) > 0) {
$t_subject->load($va_ids[0]);
$t_subject->setMode(ACCESS_WRITE);
$t_subject->delete(true, array('hard' => true));
if ($t_subject->numErrors()) {
ca_data_importers::logImportError(_t('[%1] Could not delete existing record matched on label by policy %2', $vs_idno, $vs_existing_record_policy));
// Don't stop?
} else {
$o_log->logInfo(_t('[%1] Overwrote existing record matched on label by policy %2', $vs_idno, $vs_existing_record_policy));
break;
}
$t_subject->clear();
}
break;
}
}
$o_progress->next(_t("Importing %1", $vs_idno), array('window' => $r_progress));
if ($po_request && isset($pa_options['progressCallback']) && ($ps_callback = $pa_options['progressCallback'])) {
$ps_callback($po_request, $pn_file_number, $pn_number_of_files, $ps_source, ca_data_importers::$s_num_records_processed, $vn_num_items, _t("[%3/%4] Processing %1 (%2)", caTruncateStringWithEllipsis($vs_display_label, 50), $vs_idno, ca_data_importers::$s_num_records_processed, $vn_num_items), time() - $vn_start_time, memory_get_usage(true), ca_data_importers::$s_num_records_processed, ca_data_importers::$s_num_import_errors);
}
$vb_output_subject_preferred_label = false;
$va_content_tree = array();
foreach ($va_items_by_group as $vn_group_id => $va_items) {
$va_group = $va_mapping_groups[$vn_group_id];
$vs_group_destination = $va_group['destination'];
$va_group_tmp = explode(".", $vs_group_destination);
if (sizeof($va_items) < 2 && sizeof($va_group_tmp) > 2) {
array_pop($va_group_tmp);
}
$vs_target_table = $va_group_tmp[0];
if (!($t_target = $o_dm->getInstanceByTableName($vs_target_table, true))) {
// Invalid target table
$o_log->logWarn(_t('[%1] Skipped group %2 because target %3 is invalid', $vs_idno, $vn_group_id, $vs_target_table));
continue;
}
if ($o_trans) {
$t_target->setTransaction($o_trans);
}
$va_group_buf = array();
foreach ($va_items as $vn_item_id => $va_item) {
if ($vb_use_as_single_value = caGetOption('useAsSingleValue', $va_item['settings'], false)) {
// Force repeating values to be imported as a single value
$va_vals = array(ca_data_importers::getValueFromSource($va_item, $o_reader, array('delimiter' => caGetOption('delimiter', $va_item['settings'], ''), 'returnAsArray' => false)));
} else {
$va_vals = ca_data_importers::getValueFromSource($va_item, $o_reader, array('returnAsArray' => true, 'environment' => $va_environment));
}
if (!sizeof($va_vals)) {
$va_vals = array(0 => null);
}
// consider missing values equivalent to blanks
// Do value conversions
foreach ($va_vals as $vn_i => $vm_val) {
if (isset($va_item['settings']['default']) && strlen($va_item['settings']['default']) && !strlen($vm_val)) {
$vm_val = $va_item['settings']['default'];
}
// Apply prefix/suffix *AFTER* setting default
if ($vm_val && isset($va_item['settings']['prefix']) && strlen($va_item['settings']['prefix'])) {
$vm_val = $va_item['settings']['prefix'] . $vm_val;
}
if ($vm_val && isset($va_item['settings']['suffix']) && strlen($va_item['settings']['suffix'])) {
$vm_val .= $va_item['settings']['suffix'];
}
if (!is_array($vm_val) && $vm_val[0] == '^' && preg_match("!^\\^[^ ]+\$!", $vm_val)) {
// Parse placeholder
if (!is_null($vm_parsed_val = BaseRefinery::parsePlaceholder($vm_val, $va_row, $va_item, $vn_i, array('reader' => $o_reader, 'returnAsString' => true)))) {
示例2: caLoadULAN
//.........这里部分代码省略.........
switch ($o_xml->nodeType) {
case XMLReader::ELEMENT:
$o_xml->read();
$va_subject['related_subjects'][] = $o_xml->value;
break;
}
break;
# ---------------------------
}
}
$o_xml->close();
}
$o_log->logInfo("Begin linking ULAN terms in hierarchy");
print "\n\nLINKING TERMS IN HIERARCHY...\n";
$vn_last_message_length = 0;
$t_list = new ca_lists();
$t_item = new ca_list_items();
$t_item->setMode(ACCESS_WRITE);
$vn_list_root_id = $t_list->getRootListItemID($vn_list_id);
foreach ($va_parent_child_links as $vs_child_id => $vs_parent_id) {
print str_repeat(chr(8), $vn_last_message_length);
$vs_message = "\tLINKING {$vs_child_id} to parent {$vs_parent_id}";
if (($vn_l = 100 - strlen($vs_message)) < 1) {
$vn_l = 1;
}
$vs_message .= str_repeat(' ', $vn_l);
$vn_last_message_length = strlen($vs_message);
print $vs_message;
if (in_array($vs_parent_id, array('500000000', '500000001'))) {
if (!$t_item->load($vn_child_item_id)) {
$o_log->logError("Could not load item for {$vs_child_id} (was translated to item_id={$vn_child_item_id})");
continue;
}
$t_item->set('parent_id', $vn_list_root_id);
$t_item->update(array('dontCheckCircularReferences' => true, 'dontSetHierarchicalIndexing' => true));
if ($t_item->numErrors()) {
$o_log->logError("Could not set parent_id for {$vs_child_id} to root): " . join('; ', $t_item->getErrors()));
continue;
}
$va_ulan_id_to_item_id[$vs_parent_id] = $vn_list_root_id;
}
if (!($vn_child_item_id = $va_ulan_id_to_item_id[$vs_child_id])) {
$o_log->logError("No list item id for child_id {$vs_child_id} (were there previous errors?)");
continue;
}
if (!($vn_parent_item_id = $va_ulan_id_to_item_id[$vs_parent_id])) {
$o_log->logError("No list item id for parent_id {$vs_parent_id} (were there previous errors?)");
continue;
}
if (!$t_item->load($vn_child_item_id)) {
$o_log->logError("Could not load item for {$vs_child_id} (was translated to item_id={$vn_child_item_id})");
continue;
}
$t_item->set('parent_id', $vn_parent_item_id);
$t_item->update(array('dontCheckCircularReferences' => true, 'dontSetHierarchicalIndexing' => true));
if ($t_item->numErrors()) {
$o_log->logError("Could not set parent_id for {$vs_child_id} (was translated to item_id={$vn_child_item_id}): " . join('; ', $t_item->getErrors()));
}
}
if ($vn_list_item_relation_type_id_related > 0) {
$o_log->logInfo("Begin adding ULAN related term links");
$vn_last_message_length = 0;
$t_item = new ca_list_items();
$t_link = new ca_list_items_x_list_items();
$t_link->setMode(ACCESS_WRITE);
foreach ($va_item_item_links as $vs_left_id => $vs_right_id) {
print str_repeat(chr(8), $vn_last_message_length);
$vs_message = "\tLINKING {$vs_left_id} to {$vs_right_id}";
if (($vn_l = 100 - strlen($vs_message)) < 1) {
$vn_l = 1;
}
$vs_message .= str_repeat(' ', $vn_l);
$vn_last_message_length = strlen($vs_message);
print $vs_message;
if (!($vn_left_item_id = $va_ulan_id_to_item_id[$vs_left_id])) {
$o_log->logError("No list item id for left_id {$vs_left_id} (were there previous errors?)");
continue;
}
if (!($vn_right_item_id = $va_ulan_id_to_item_id[$vs_right_id])) {
$o_log->logError("No list item id for right_id {$vs_right_id} (were there previous errors?)");
continue;
}
$t_link->set('term_left_id', $vn_left_item_id);
$t_link->set('term_right_id', $vn_right_item_id);
$t_link->set('type_id', $vn_list_item_relation_type_id_related);
$t_link->insert();
if ($t_link->numErrors()) {
$o_log->logError("Could not set link between {$vs_left_id} (was translated to item_id={$vn_left_item_id}) and {$vs_right_id} (was translated to item_id={$vn_right_item_id}): " . join('; ', $t_link->getErrors()));
}
}
} else {
$o_log->logWarn("Skipped import of term-term relationships because the ca_list_items_x_list_items 'related' relationship type is not defined for your installation");
}
$vn_duration = $t->getTime(1);
$vs_time = caFormatInterval($vn_duration);
$o_log->logInfo("Rebuilding hierarchical indices...");
$t_item->rebuildAllHierarchicalIndexes();
$o_log->logInfo("ULAN import complete. Took {$vs_time} ({$vn_duration})");
print "\n\nIMPORT COMPLETE. Took {$vs_time} ({$vn_duration})\n";
}