diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2014-07-12 04:26:02 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2014-07-12 04:26:02 +0400 |
commit | 3dcf8c383f95211a14344899221800aa55b742f6 (patch) | |
tree | 9846ebb264f57c05ecf434d00c9ab31a37b9d7b8 /core/Updater.php | |
parent | 730766125728453808281d61bb0740fcba591dec (diff) | |
parent | 305f16508662713f2e1247d5a1ee7708fa656d97 (diff) |
Merge remote-tracking branch 'origin/master' into report_and_dimension_refactoring
Conflicts:
core/Updates/0.4.2.php
core/Updates/0.6.3.php
core/Updates/1.2-rc1.php
core/Updates/1.9-b9.php
core/Version.php
tests/PHPUnit/Fixture.php
tests/PHPUnit/Fixtures/UITestFixture.php
tests/PHPUnit/Integration/Core/JsProxyTest.php
Diffstat (limited to 'core/Updater.php')
-rw-r--r-- | core/Updater.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/core/Updater.php b/core/Updater.php index 2e2d4cc6ab..e10c6bf33c 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -360,12 +360,29 @@ class Updater public static function handleQueryError($e, $updateSql, $errorToIgnore, $file) { if (($errorToIgnore === false) - || !Db::get()->isErrNo($e, $errorToIgnore) + || !self::isDbErrorOneOf($e, $errorToIgnore) ) { $message = $file . ":\nError trying to execute the query '" . $updateSql . "'.\nThe error was: " . $e->getMessage(); throw new UpdaterErrorException($message); } } + + /** + * Returns whether an exception is a DB error with a code in the $errorCodesToIgnore list. + * + * @param int $error + * @param int|int[] $errorCodesToIgnore + */ + public static function isDbErrorOneOf($error, $errorCodesToIgnore) + { + $errorCodesToIgnore = is_array($errorCodesToIgnore) ? $errorCodesToIgnore : array($errorCodesToIgnore); + foreach ($errorCodesToIgnore as $code) { + if (Db::get()->isErrNo($error, $code)) { + return true; + } + } + return false; + } } /** |