mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
parent
99a9cc9669
commit
fb9360767e
7 changed files with 27 additions and 8 deletions
|
@ -149,7 +149,10 @@ class Mysql extends DboSource {
|
|||
);
|
||||
$this->connected = true;
|
||||
} catch (PDOException $e) {
|
||||
throw new MissingConnectionException(array('class' => $e->getMessage()));
|
||||
throw new MissingConnectionException(array(
|
||||
'class' => get_class($this),
|
||||
'message' => $e->getMessage()
|
||||
));
|
||||
}
|
||||
|
||||
$this->_useAlias = (bool)version_compare($this->getVersion(), "4.1", ">=");
|
||||
|
|
|
@ -121,7 +121,10 @@ class Postgres extends DboSource {
|
|||
$this->_execute('SET search_path TO ' . $config['schema']);
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
throw new MissingConnectionException(array('class' => $e->getMessage()));
|
||||
throw new MissingConnectionException(array(
|
||||
'class' => get_class($this),
|
||||
'message' => $e->getMessage()
|
||||
));
|
||||
}
|
||||
|
||||
return $this->connected;
|
||||
|
|
|
@ -113,7 +113,10 @@ class Sqlite extends DboSource {
|
|||
$this->_connection = new PDO('sqlite:' . $config['database'], null, null, $flags);
|
||||
$this->connected = true;
|
||||
} catch(PDOException $e) {
|
||||
throw new MissingConnectionException(array('class' => $e->getMessage()));
|
||||
throw new MissingConnectionException(array(
|
||||
'class' => get_class($this),
|
||||
'message' => $e->getMessage()
|
||||
));
|
||||
}
|
||||
return $this->connected;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,10 @@ class Sqlserver extends DboSource {
|
|||
);
|
||||
$this->connected = true;
|
||||
} catch (PDOException $e) {
|
||||
throw new MissingConnectionException(array('class' => $e->getMessage()));
|
||||
throw new MissingConnectionException(array(
|
||||
'class' => get_class($this),
|
||||
'message' => $e->getMessage()
|
||||
));
|
||||
}
|
||||
|
||||
return $this->connected;
|
||||
|
|
|
@ -253,6 +253,7 @@ class DboSource extends DataSource {
|
|||
if (!$this->enabled()) {
|
||||
throw new MissingConnectionException(array(
|
||||
'class' => get_class($this),
|
||||
'message' => __d('cake_dev', 'Selected driver is not enabled'),
|
||||
'enabled' => false
|
||||
));
|
||||
}
|
||||
|
|
|
@ -552,10 +552,10 @@ class ExceptionRendererTest extends CakeTestCase {
|
|||
500
|
||||
),
|
||||
array(
|
||||
new MissingConnectionException(array('class' => 'Article')),
|
||||
new MissingConnectionException(array('class' => 'Mysql')),
|
||||
array(
|
||||
'/<h2>Missing Database Connection<\/h2>/',
|
||||
'/Article requires a database connection/'
|
||||
'/A Database connection using "Mysql" was missing or unable to connect./',
|
||||
),
|
||||
500
|
||||
),
|
||||
|
@ -563,7 +563,7 @@ class ExceptionRendererTest extends CakeTestCase {
|
|||
new MissingConnectionException(array('class' => 'Mysql', 'enabled' => false)),
|
||||
array(
|
||||
'/<h2>Missing Database Connection<\/h2>/',
|
||||
'/Mysql requires a database connection/',
|
||||
'/A Database connection using "Mysql" was missing or unable to connect./',
|
||||
'/Mysql driver is NOT enabled/'
|
||||
),
|
||||
500
|
||||
|
|
|
@ -19,7 +19,13 @@
|
|||
<h2><?php echo __d('cake_dev', 'Missing Database Connection'); ?></h2>
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', '%s requires a database connection', $class); ?>
|
||||
<?php echo __d('cake_dev', 'A Database connection using "%s" was missing or unable to connect. ', $class); ?>
|
||||
<br />
|
||||
<?php
|
||||
if (isset($message)):
|
||||
echo __d('cake_dev', 'The database server returned this error: %s', $message);
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
<?php if (!$enabled) : ?>
|
||||
<p class="error">
|
||||
|
|
Loading…
Add table
Reference in a new issue