function node_import_debug_report in Node import 6
Save a file with a debug report.
1 string reference to 'node_import_debug_report'
- node_import_menu in ./
node_import.module - Implementation of hook_menu().
File
- ./
node_import.admin.inc, line 1284
Code
function node_import_debug_report($task) {
drupal_set_header('Content-Type: text/plain');
drupal_set_header('Content-Disposition: attachment; filename="node_import-' . strtr($task['type'], ':', '_') . '-' . $task['taskid'] . '.txt"');
print "------------------------------------------------------------\n";
print "Drupal and PHP version:\n";
print "------------------------------------------------------------\n";
print "Drupal version: " . VERSION . " (" . DRUPAL_CORE_COMPATIBILITY . ")\n";
print "PHP version: " . PHP_VERSION . "\n";
print "\n";
print "------------------------------------------------------------\n";
print "Enabled modules and versions:\n";
print "------------------------------------------------------------\n";
foreach (module_rebuild_cache() as $name => $module) {
if ($module->status && $module->type == 'module') {
print $name . " " . $module->info['version'] . " (" . $module->info['project'] . ")\n";
}
}
print "\n";
print "------------------------------------------------------------\n";
print "User permissions:\n";
print "------------------------------------------------------------\n";
if ($task['uid'] == 1) {
print "User #1 has all privileges.\n";
}
else {
$account = user_load(array(
'uid' => $task['uid'],
));
$result = db_query("SELECT p.perm FROM {role} AS r INNER JOIN {permission} AS p ON p.rid = r.rid WHERE r.rid IN (" . db_placeholders($account->roles) . ")", array_keys($account->roles));
$perms = array();
while ($row = db_fetch_object($result)) {
$perms += array_flip(explode(', ', $row->perm));
}
print implode("\n", array_keys($perms)) . "\n";
}
print "\n";
print "------------------------------------------------------------\n";
print "Task details:\n";
print "------------------------------------------------------------\n";
print '$task = ';
var_dump($task);
$fields = node_import_fields($task['type']);
print '$fields = ';
var_dump($fields);
print "\n";
print "------------------------------------------------------------\n";
print "Errors and data from last " . variable_get('node_import:debug:row_count', 5) . " rows with errors:\n";
print "------------------------------------------------------------\n";
$result = db_query("SELECT * FROM {node_import_status} WHERE taskid = %d AND status = %d LIMIT %d", $task['taskid'], NODE_IMPORT_STATUS_ERROR, variable_get('node_import:debug:row_count', 5));
$i = 0;
while ($row = db_fetch_object($result)) {
$i++;
print "\n";
print "----- Row {$i} -------------------------------------------------\n";
$row->errors = unserialize($row->errors);
print '$row_status = ';
var_dump($row);
list($file_offset, $data) = node_import_read_from_file($task['file']->filepath, $row->file_offset, $task['file_options']);
print '$data = ';
var_dump($data);
}
print "\n";
exit;
}