Refactor ProjectManager and Runtime handling
This commit is contained in:
parent
170cb4bf6d
commit
7494ead7b3
2 changed files with 14 additions and 11 deletions
|
@ -205,10 +205,16 @@
|
|||
}
|
||||
|
||||
// Get the file contents and prepare it
|
||||
$evaluated_code = IO::fread($required_file(preg_replace('/^<\?php|<\?PHP/', '', $required_file, 1)));
|
||||
set_error_handler(function ($errno, $errstr, $errfile, $errline) use ($item, $package)
|
||||
$evaluated_code = IO::fread($required_file);
|
||||
|
||||
// Remove the PHP tags
|
||||
$evaluated_code = preg_replace('/^<\?php|<\?PHP/', '', $evaluated_code, 1);
|
||||
// Replace __DIR__ with the actual directory that the file is in
|
||||
$evaluated_code = str_replace('__DIR__', sprintf('"%s"', dirname($required_file)), $evaluated_code);
|
||||
|
||||
set_error_handler(function ($error_number, $message, $file, $line) use ($item, $package)
|
||||
{
|
||||
throw new ImportException(sprintf('Failed to import "%s" from %s: %s', $item, $package, $errstr));
|
||||
throw new ImportException(sprintf('Fatal Evaluation Error: Failed to import "%s" from %s on %s:%s: %s', $item, $package, $file, $line, $message));
|
||||
});
|
||||
|
||||
// Evaluate the code
|
||||
|
@ -220,6 +226,10 @@
|
|||
{
|
||||
throw new ImportException(sprintf('%s: Failed to import "%s" from %s: %s', $required_file, $item, $package, $e->getMessage()), $e);
|
||||
}
|
||||
catch(ImportException $e)
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
catch (Throwable $e)
|
||||
{
|
||||
throw new ImportException(sprintf('%s: Failed to import "%s" from %s: %s', $required_file, $item, $package, $e->getMessage()), $e);
|
||||
|
|
|
@ -676,14 +676,7 @@
|
|||
$path = substr($path, 0, -1);
|
||||
}
|
||||
|
||||
if($path === '')
|
||||
{
|
||||
$destination_path .= DIRECTORY_SEPARATOR . hash('crc32', $project_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
$destination_path .= DIRECTORY_SEPARATOR . hash('crc32', $path);
|
||||
}
|
||||
$destination_path .= DIRECTORY_SEPARATOR . hash('crc32', $project_path);
|
||||
|
||||
if(is_file($source_path))
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue