mirror of
https://github.com/Mibew/mibew.git
synced 2025-01-31 05:20:30 +03:00
Mark Database::throwExeptions method as deprecated
This is done because the method has a typo in the name.
This commit is contained in:
parent
59de37a12b
commit
b56881bf01
@ -101,7 +101,7 @@ class Database
|
||||
* Controls if exception must be processed into class or thrown
|
||||
* @var boolean
|
||||
*/
|
||||
protected $throwExceptions = false;
|
||||
protected $useExceptions = false;
|
||||
|
||||
/**
|
||||
* Get instance of Database class.
|
||||
@ -209,14 +209,37 @@ class Database
|
||||
* If called without arguments just return previous value without changing
|
||||
* anything.
|
||||
*
|
||||
* @param boolean $value Value that should be set. This argument is optional
|
||||
* There is a typo in the method name. One should use
|
||||
* {@link Database::throwExceptions()} method instead.
|
||||
*
|
||||
* @deprecated since version 2.0.0
|
||||
* @param boolean|null $value Value that should be set. This argument is
|
||||
* optional and can be skipped (or set to null) to keep the internal value
|
||||
* unchanged.
|
||||
* @return bool Previous value
|
||||
*/
|
||||
public function throwExeptions()
|
||||
public function throwExeptions($value = null)
|
||||
{
|
||||
$last_value = $this->throwExceptions;
|
||||
if (func_num_args() > 0) {
|
||||
$this->throwExceptions = func_get_arg(0);
|
||||
return $this->throwExceptions($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if exceptions must be process into the class or thrown and return
|
||||
* previous value.
|
||||
*
|
||||
* If called without arguments just return previous value without changing
|
||||
* anything.
|
||||
*
|
||||
* @param boolean|null $value Value that should be set. This argument is
|
||||
* optional and can be skipped (or set to null) to keep the internal value
|
||||
* unchanged.
|
||||
* @return bool Previous value
|
||||
*/
|
||||
public function throwExceptions($value = null)
|
||||
{
|
||||
$last_value = $this->useExceptions;
|
||||
if (!is_null($value)) {
|
||||
$this->useExceptions = $value;
|
||||
}
|
||||
|
||||
return $last_value;
|
||||
@ -400,7 +423,7 @@ class Database
|
||||
*/
|
||||
protected function handleError(\Exception $e)
|
||||
{
|
||||
if ($this->throwExceptions) {
|
||||
if ($this->useExceptions) {
|
||||
throw $e;
|
||||
}
|
||||
die($e->getMessage());
|
||||
|
@ -787,7 +787,7 @@ class Installer
|
||||
}
|
||||
|
||||
$db = Database::getInstance();
|
||||
$db->throwExeptions(true);
|
||||
$db->throwExceptions(true);
|
||||
|
||||
return $db;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ class Updater
|
||||
{
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
$db->throwExeptions(true);
|
||||
$db->throwExceptions(true);
|
||||
|
||||
return $db;
|
||||
} catch (\Exception $e) {
|
||||
|
@ -164,7 +164,7 @@ function calculate_thread_statistics()
|
||||
{
|
||||
// Prepare database
|
||||
$db = Database::getInstance();
|
||||
$db_throw_exceptions = $db->throwExeptions(true);
|
||||
$db_throw_exceptions = $db->throwExceptions(true);
|
||||
|
||||
try {
|
||||
// Start transaction
|
||||
@ -379,7 +379,7 @@ function calculate_thread_statistics()
|
||||
$db->query('ROLLBACK');
|
||||
|
||||
// Set throw exceptions back
|
||||
$db->throwExeptions($db_throw_exceptions);
|
||||
$db->throwExceptions($db_throw_exceptions);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -388,7 +388,7 @@ function calculate_thread_statistics()
|
||||
$db->query('COMMIT');
|
||||
|
||||
// Set throw exceptions back
|
||||
$db->throwExeptions($db_throw_exceptions);
|
||||
$db->throwExceptions($db_throw_exceptions);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -398,7 +398,7 @@ function calculate_operator_statistics()
|
||||
{
|
||||
// Prepare database
|
||||
$db = Database::getInstance();
|
||||
$db_throw_exceptions = $db->throwExeptions(true);
|
||||
$db_throw_exceptions = $db->throwExceptions(true);
|
||||
|
||||
try {
|
||||
// Start transaction
|
||||
@ -536,7 +536,7 @@ function calculate_operator_statistics()
|
||||
$db->query('ROLLBACK');
|
||||
|
||||
// Set throw exceptions back
|
||||
$db->throwExeptions($db_throw_exceptions);
|
||||
$db->throwExceptions($db_throw_exceptions);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -545,7 +545,7 @@ function calculate_operator_statistics()
|
||||
$db->query('COMMIT');
|
||||
|
||||
// Set throw exceptions back
|
||||
$db->throwExeptions($db_throw_exceptions);
|
||||
$db->throwExceptions($db_throw_exceptions);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -555,7 +555,7 @@ function calculate_page_statistics()
|
||||
{
|
||||
// Prepare database
|
||||
$db = Database::getInstance();
|
||||
$db_throw_exceptions = $db->throwExeptions(true);
|
||||
$db_throw_exceptions = $db->throwExceptions(true);
|
||||
|
||||
try {
|
||||
// Start transaction
|
||||
@ -791,7 +791,7 @@ function calculate_page_statistics()
|
||||
$db->query('ROLLBACK');
|
||||
|
||||
// Set throw exceptions back
|
||||
$db->throwExeptions($db_throw_exceptions);
|
||||
$db->throwExceptions($db_throw_exceptions);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -800,7 +800,7 @@ function calculate_page_statistics()
|
||||
$db->query('COMMIT');
|
||||
|
||||
// Set throw exceptions back
|
||||
$db->throwExeptions($db_throw_exceptions);
|
||||
$db->throwExceptions($db_throw_exceptions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user