mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-24 19:08:53 +00:00
Compare commits
5 commits
86e8eb332d
...
806fa68b92
Author | SHA1 | Date | |
---|---|---|---|
|
806fa68b92 | ||
|
b8c49f9711 | ||
|
2f43c1facd | ||
|
0e0214a71d | ||
|
8d1f8af7c6 |
7 changed files with 86 additions and 39 deletions
|
@ -276,6 +276,12 @@ class acp_extensions
|
|||
{
|
||||
$this->template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($this->user));
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$stack_trace = phpbb_filter_root_path(str_replace("\n", '<br>', $e->getTraceAsString()));
|
||||
$message = $e->getMessage();
|
||||
$this->template->assign_var('MIGRATOR_ERROR', '<b>' . $message . '</b><br><br>' . $stack_trace);
|
||||
}
|
||||
|
||||
$this->tpl_name = 'acp_ext_enable';
|
||||
|
||||
|
|
|
@ -2716,7 +2716,7 @@ function get_backtrace()
|
|||
// Only show function arguments for include etc.
|
||||
// Other parameters may contain sensible information
|
||||
$argument = '';
|
||||
if (!empty($trace['args'][0]) && in_array($trace['function'], array('include', 'require', 'include_once', 'require_once')))
|
||||
if (!empty($trace['args'][0]) && in_array($trace['function'], array('include', 'require', 'include_once', 'require_once', 'try_apply')))
|
||||
{
|
||||
$argument = htmlspecialchars(phpbb_filter_root_path($trace['args'][0]), ENT_COMPAT);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ function installer_msg_handler($errno, $msg_text, $errfile, $errline): bool
|
|||
{
|
||||
/** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */
|
||||
$iohandler = $phpbb_installer_container->get('installer.helper.iohandler');
|
||||
$iohandler->add_error_message($msg);
|
||||
$iohandler->add_error_message($msg, get_backtrace());
|
||||
$iohandler->send_response(true);
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v400;
|
||||
|
||||
use phpbb\db\migration\migration;
|
||||
|
||||
class rename_auth_role_id_index extends migration
|
||||
{
|
||||
public static function depends_on()
|
||||
{
|
||||
return [
|
||||
'\phpbb\db\migration\data\v400\dev',
|
||||
];
|
||||
}
|
||||
|
||||
public function update_schema()
|
||||
{
|
||||
return [
|
||||
'drop_keys' => [
|
||||
$this->table_prefix . 'acl_users' => [
|
||||
'auth_role_id',
|
||||
],
|
||||
],
|
||||
'add_index' => [
|
||||
$this->table_prefix . 'acl_users' => [
|
||||
'usr_auth_role_id' => ['auth_role_id'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function revert_schema()
|
||||
{
|
||||
return [
|
||||
'drop_keys' => [
|
||||
$this->table_prefix . 'acl_users' => [
|
||||
'usr_auth_role_id',
|
||||
],
|
||||
],
|
||||
'add_index' => [
|
||||
$this->table_prefix . 'acl_users' => [
|
||||
'auth_role_id' => ['auth_role_id'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
|
@ -458,34 +458,26 @@ class doctrine implements tools_interface
|
|||
*/
|
||||
protected function alter_schema(callable $callback)
|
||||
{
|
||||
try
|
||||
$current_schema = $this->get_schema();
|
||||
$new_schema = clone $current_schema;
|
||||
call_user_func($callback, $new_schema);
|
||||
|
||||
$comparator = new comparator();
|
||||
$schemaDiff = $comparator->compareSchemas($current_schema, $new_schema);
|
||||
$queries = $schemaDiff->toSql($this->get_schema_manager()->getDatabasePlatform());
|
||||
|
||||
if ($this->return_statements)
|
||||
{
|
||||
$current_schema = $this->get_schema();
|
||||
$new_schema = clone $current_schema;
|
||||
call_user_func($callback, $new_schema);
|
||||
|
||||
$comparator = new comparator();
|
||||
$schemaDiff = $comparator->compareSchemas($current_schema, $new_schema);
|
||||
$queries = $schemaDiff->toSql($this->get_schema_manager()->getDatabasePlatform());
|
||||
|
||||
if ($this->return_statements)
|
||||
{
|
||||
return $queries;
|
||||
}
|
||||
|
||||
foreach ($queries as $query)
|
||||
{
|
||||
// executeQuery() must be used here because $query might return a result set, for instance REPAIR does
|
||||
$this->connection->executeQuery($query);
|
||||
}
|
||||
|
||||
return true;
|
||||
return $queries;
|
||||
}
|
||||
catch (Exception $e)
|
||||
|
||||
foreach ($queries as $query)
|
||||
{
|
||||
// @todo: check if it makes sense to properly handle the exception
|
||||
return [$e->getMessage()];
|
||||
// executeQuery() must be used here because $query might return a result set, for instance REPAIR does
|
||||
$this->connection->executeQuery($query);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -280,7 +280,9 @@ class installer
|
|||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$this->iohandler->add_error_message($e->getMessage());
|
||||
$stack_trace = phpbb_filter_root_path(str_replace("\n", '<br>', $e->getTraceAsString()));
|
||||
$message = $e->getMessage();
|
||||
$this->iohandler->add_error_message($message, $stack_trace);
|
||||
$this->iohandler->send_response(true);
|
||||
$fail_cleanup = true;
|
||||
}
|
||||
|
|
|
@ -135,17 +135,6 @@ class language_file_helper
|
|||
*/
|
||||
private static function sort_by_local_name(mixed $a, mixed $b): int
|
||||
{
|
||||
if ($a['local_name'] > $b['local_name'])
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if ($a['local_name'] < $b['local_name'])
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return $a['local_name'] <=> $b['local_name'];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue