Мне нужно запустить проект PHP, созданный в 2020 году, с более чем 5000 файлами и ошибками [закрыто]Php

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Мне нужно запустить проект PHP, созданный в 2020 году, с более чем 5000 файлами и ошибками [закрыто]

Сообщение Anonymous »

Я работаю стажером, и мне поручили запустить проект на основе PHP с интеграцией Moodle. Я получаю ошибки типа «error/generalExceptionmessage» на локальном хосте во время запуска проекта, хотя я определил местоположение этого кода, я все еще не могу его устранить.

Код: Выделить всё

function get_exception_info($ex) {
global $CFG, $DB, $SESSION;

if ($ex instanceof moodle_exception) {
$errorcode = $ex->errorcode;
$module = $ex->module;
$a = $ex->a;
$link = $ex->link;
$debuginfo = $ex->debuginfo;
} else {
$errorcode = 'generalexceptionmessage';
$module = 'error';
$a = $ex->getMessage();
$link = '';
$debuginfo = '';
}

// Append the error code to the debug info to make grepping and googling easier
$debuginfo .= PHP_EOL."Error code: $errorcode";

$backtrace = $ex->getTrace();
$place = array('file'=>$ex->getFile(), 'line'=>$ex->getLine(), 'exception'=>get_class($ex));
array_unshift($backtrace, $place);

// Be careful, no guarantee moodlelib.php is loaded.
if (empty($module) || $module == 'moodle' || $module == 'core') {
$module = 'error';
}
// Search for the $errorcode's associated string
// If not found, append the contents of $a to $debuginfo so helpful information isn't lost
if (function_exists('get_string_manager')) {
if (get_string_manager()->string_exists($errorcode, $module)) {
$message = get_string($errorcode, $module, $a);
} elseif ($module == 'error' && get_string_manager()->string_exists($errorcode, 'moodle')) {
// Search in moodle file if error specified - needed for backwards compatibility
$message = get_string($errorcode, 'moodle', $a);
} else {
$message = $module . '/' . $errorcode;
$debuginfo .= PHP_EOL.'$a contents: '.print_r($a, true);
}
} else {
$message = $module . '/' . $errorcode;
$debuginfo .= PHP_EOL.'$a contents: '.print_r($a, true);
}

// Remove some absolute paths from message and debugging info.
$searches = array();
$replaces = array();
$cfgnames = array('tempdir', 'cachedir', 'localcachedir', 'themedir', 'dataroot', 'dirroot');
foreach ($cfgnames as $cfgname) {
if (property_exists($CFG, $cfgname)) {
$searches[] = $CFG->$cfgname;
$replaces[] = "[$cfgname]";
}
}
if (!empty($searches)) {
$message   = str_replace($searches, $replaces, $message);
$debuginfo = str_replace($searches, $replaces, $debuginfo);
}

// Be careful, no guarantee weblib.php is loaded.
if (function_exists('clean_text')) {
$message = clean_text($message);
} else {
$message = htmlspecialchars($message);
}

if (!empty($CFG->errordocroot)) {
$errordoclink = $CFG->errordocroot . '/en/';
} else {
// Only if the function is available. May be not for early errors.
if (function_exists('current_language')) {
$errordoclink = get_docs_url();
} else {
$errordoclink = 'https://docs.moodle.org/en/';
}
}

if ($module === 'error') {
$modulelink = 'moodle';
} else {
$modulelink = $module;
}
$moreinfourl = $errordoclink . 'error/' . $modulelink . '/' . $errorcode;

if (empty($link)) {
if (!empty($SESSION->fromurl)) {
$link = $SESSION->fromurl;
unset($SESSION->fromurl);
} else {
$link = $CFG->wwwroot .'/';
}
}

// When printing an error the continue button should never link offsite.
// We cannot use clean_param() here as it is not guaranteed that it has been loaded yet.
if (stripos($link, $CFG->wwwroot) === 0) {
// Internal HTTP, all good.
} else {
// External link spotted!
$link = $CFG->wwwroot .  '/';
}

$info = new stdClass();
$info->message     = $message;
$info->errorcode   = $errorcode;
$info->backtrace   = $backtrace;
$info->link        = $link;
$info->moreinfourl = $moreinfourl;
$info->a           = $a;
$info->debuginfo   = $debuginfo;

return $info;
}
Это блок кода, выдающий исключение, но я не могу понять, что с этим делать.
Я удалил блок, вызывающий эту функцию , но возникли другие ошибки.

Подробнее здесь: https://stackoverflow.com/questions/790 ... ing-errors
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»