function coder_upgrade_path_print in Coder 7
Same name and namespace in other branches
- 7.2 coder_upgrade/includes/main.inc \coder_upgrade_path_print()
Prints information to a file.
Parameters
string $path: File path.
mixed $text: A string, array, or object to print.
4 calls to coder_upgrade_path_print()
- coder_upgrade_debug_print in coder_upgrade/
includes/ main.inc - Prints debug information if debug flag is on.
- coder_upgrade_log_print in coder_upgrade/
includes/ main.inc - Prints log information if log flag is on.
- coder_upgrade_memory_print in coder_upgrade/
includes/ main.inc - Prints memory usage to log.
- print_memory_usage in coder_upgrade/
scripts/ coder_upgrade.run.php
File
- coder_upgrade/
includes/ main.inc, line 761 - Manages application of conversion routines, logging, and patch file creation.
Code
function coder_upgrade_path_print($path, $text) {
if ($text instanceof PGPList) {
$result = file_put_contents($path, $text
->print_r(), FILE_APPEND);
}
elseif ($text instanceof PGPBase) {
$result = file_put_contents($path, $text
->print_r(), FILE_APPEND);
}
elseif ($text instanceof stdClass) {
$result = file_put_contents($path, print_r($text, 1), FILE_APPEND);
}
elseif (is_object($text)) {
$result = file_put_contents($path, "Unknown object class\n", FILE_APPEND);
}
elseif (is_array($text)) {
$result = file_put_contents($path, print_r($text, 1), FILE_APPEND);
}
else {
$result = file_put_contents($path, $text . "\n", FILE_APPEND);
}
if ($result === FALSE) {
echo "Unable to write to file: {$path}\n";
}
}