diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-07-30 12:31:49 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-08-14 10:55:53 +0300 |
commit | 6f6a2a9bbe9c48232db4d097ffe6607d0d562d1d (patch) | |
tree | facaa8367fecf12b2d5859fac0851bc984c2c6ec /plugins/CoreUpdater/CoreUpdater.php | |
parent | 0841a4c8d200dac235f41ae8cc471b880c1c48e6 (diff) |
When Piwik DB needs to be upgraded, the API should return a valid response
Diffstat (limited to 'plugins/CoreUpdater/CoreUpdater.php')
-rw-r--r-- | plugins/CoreUpdater/CoreUpdater.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/CoreUpdater/CoreUpdater.php b/plugins/CoreUpdater/CoreUpdater.php index 584a465130..8fc3f0d92f 100644 --- a/plugins/CoreUpdater/CoreUpdater.php +++ b/plugins/CoreUpdater/CoreUpdater.php @@ -10,6 +10,7 @@ namespace Piwik\Plugins\CoreUpdater; use Exception; use Piwik\Access; +use Piwik\API\ResponseBuilder; use Piwik\Common; use Piwik\Filesystem; use Piwik\FrontController; @@ -73,6 +74,15 @@ class CoreUpdater extends \Piwik\Plugin if (FrontController::shouldRethrowException()) { throw new Exception("Piwik and/or some plugins have been upgraded to a new version. \n" . "--> Please run the update process first. See documentation: http://piwik.org/docs/update/ \n"); + } elseif ($module === 'API') { + + $outputFormat = strtolower(Common::getRequestVar('format', 'xml', 'string', $_GET + $_POST)); + $response = new ResponseBuilder($outputFormat); + $e = new Exception('Database Upgrade Required. Your Piwik database is out-of-date, and must be upgraded before you can continue.'); + echo $response->getResponseException($e); + Common::sendResponseCode(503); + exit; + } else { Piwik::redirectToModule('CoreUpdater'); } |