Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/Updater.php10
-rw-r--r--core/Updates/0.5.4.php2
-rw-r--r--core/Updates/0.6.3.php2
-rw-r--r--core/Updates/2.0-a13.php12
-rw-r--r--core/Updates/2.0-a17.php45
-rw-r--r--core/Version.php2
-rw-r--r--plugins/CoreUpdater/Controller.php24
7 files changed, 71 insertions, 26 deletions
diff --git a/core/Updater.php b/core/Updater.php
index 1ccdb78e18..a058eb03c1 100644
--- a/core/Updater.php
+++ b/core/Updater.php
@@ -152,7 +152,7 @@ class Updater
* Update the named component
*
* @param string $componentName 'core', or plugin name
- * @throws \Exception|Updater_UpdateErrorException
+ * @throws \Exception|UpdaterErrorException
* @return array of warning strings if applicable
*/
public function update($componentName)
@@ -169,7 +169,7 @@ class Updater
}
self::recordComponentSuccessfullyUpdated($componentName, $fileVersion);
- } catch (Updater_UpdateErrorException $e) {
+ } catch (UpdaterErrorException $e) {
throw $e;
} catch (\Exception $e) {
$warningMessages[] = $e->getMessage();
@@ -286,7 +286,7 @@ class Updater
*
* @param string $file Update script filename
* @param array $sqlarray An array of SQL queries to be executed
- * @throws Updater_UpdateErrorException
+ * @throws UpdaterErrorException
*/
static function updateDatabase($file, $sqlarray)
{
@@ -298,7 +298,7 @@ class Updater
|| !Db::get()->isErrNo($e, $ignoreError)
) {
$message = $file . ":\nError trying to execute the query '" . $update . "'.\nThe error was: " . $e->getMessage();
- throw new Updater_UpdateErrorException($message);
+ throw new UpdaterErrorException($message);
}
}
}
@@ -311,6 +311,6 @@ class Updater
* @package Piwik
* @subpackage Updater
*/
-class Updater_UpdateErrorException extends \Exception
+class UpdaterErrorException extends \Exception
{
}
diff --git a/core/Updates/0.5.4.php b/core/Updates/0.5.4.php
index 9e79fba2a1..3982a69394 100644
--- a/core/Updates/0.5.4.php
+++ b/core/Updates/0.5.4.php
@@ -44,7 +44,7 @@ class Updates_0_5_4 extends Updates
throw new \Exception('mandatory update failed');
}
} catch (\Exception $e) {
- throw new \Piwik\Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[superuser]</code> the following line: <br /><code>salt = $salt</code>");
+ throw new \Piwik\UpdaterErrorException("Please edit your config/config.ini.php file and add below <code>[superuser]</code> the following line: <br /><code>salt = $salt</code>");
}
}
diff --git a/core/Updates/0.6.3.php b/core/Updates/0.6.3.php
index 169acd4061..230fa55529 100644
--- a/core/Updates/0.6.3.php
+++ b/core/Updates/0.6.3.php
@@ -45,7 +45,7 @@ class Updates_0_6_3 extends Updates
throw new \Exception('mandatory update failed');
}
} catch (\Exception $e) {
- throw new \Piwik\Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[database]</code> the following line: <br /><code>schema = Myisam</code>");
+ throw new \Piwik\UpdaterErrorException("Please edit your config/config.ini.php file and add below <code>[database]</code> the following line: <br /><code>schema = Myisam</code>");
}
}
diff --git a/core/Updates/2.0-a13.php b/core/Updates/2.0-a13.php
index 878eb15bdd..bf06d3e4db 100644
--- a/core/Updates/2.0-a13.php
+++ b/core/Updates/2.0-a13.php
@@ -55,17 +55,7 @@ class Updates_2_0_a13 extends Updates
Updater::updateDatabase(__FILE__, self::getSql());
- // Deleting old plugins
- $obsoleteDirectories = array(
- PIWIK_INCLUDE_PATH . '/plugins/Referers',
- PIWIK_INCLUDE_PATH . '/plugins/PDFReports',
- );
- foreach ($obsoleteDirectories as $dir) {
- if (file_exists($dir)) {
- Filesystem::unlinkRecursive($dir, true);
- }
- }
-
+ // old plugins deleted in 2.0-a17 update file
try {
\Piwik\Plugin\Manager::getInstance()->activatePlugin('Referrers');
diff --git a/core/Updates/2.0-a17.php b/core/Updates/2.0-a17.php
new file mode 100644
index 0000000000..a2691d4323
--- /dev/null
+++ b/core/Updates/2.0-a17.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Piwik - Open source web analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ * @category Piwik
+ * @package Piwik
+ */
+namespace Piwik\Updates;
+
+use Piwik\Db;
+use Piwik\Filesystem;
+use Piwik\Updates;
+
+/**
+ * @package Updates
+ */
+class Updates_2_0_a17 extends Updates
+{
+ public static function update()
+ {
+ $errors = array();
+
+ // Deleting old plugins
+ $obsoleteDirectories = array(
+ PIWIK_INCLUDE_PATH . '/plugins/Referers',
+ PIWIK_INCLUDE_PATH . '/plugins/PDFReports',
+ );
+ foreach ($obsoleteDirectories as $dir) {
+ if (file_exists($dir)) {
+ Filesystem::unlinkRecursive($dir, true);
+ }
+
+ if (file_exists($dir)) {
+ $errors[] = "Please delete this directory manually (eg. using your FTP software): $dir \n";
+ }
+
+ }
+ if(!empty($errors)) {
+ throw new \Exception("Warnings during the update: <br>" . implode("<br>", $errors));
+ }
+ }
+} \ No newline at end of file
diff --git a/core/Version.php b/core/Version.php
index 6d10fce475..531fdb7096 100644
--- a/core/Version.php
+++ b/core/Version.php
@@ -24,5 +24,5 @@ final class Version
* Current Piwik version
* @var string
*/
- const VERSION = '2.0-a14';
+ const VERSION = '2.0-a17';
}
diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php
index d6ac72dbaf..02b4d8b000 100644
--- a/plugins/CoreUpdater/Controller.php
+++ b/plugins/CoreUpdater/Controller.php
@@ -27,7 +27,7 @@ use Piwik\SettingsServer;
use Piwik\Unzip;
use Piwik\UpdateCheck;
use Piwik\Updater;
-use Piwik\Updater_UpdateErrorException;
+use Piwik\UpdaterErrorException;
use Piwik\Version;
use Piwik\View;
use Piwik\View\OneClickDone;
@@ -119,6 +119,18 @@ class Controller extends \Piwik\Plugin\Controller
echo $view->render();
}
+ protected function redirectToDashboardWhenNoError($updater)
+ {
+ if (count($updater->getSqlQueriesToExecute()) == 1
+ && !$this->coreError
+ && empty($this->warningMessages)
+ && empty($this->errorMessages)
+ && empty($this->deactivatedPlugins)
+ ) {
+ Piwik::redirectToModule('CoreHome');
+ }
+ }
+
private function checkNewVersionIsAvailableOrDie()
{
$newVersion = UpdateCheck::isNewestVersionAvailable();
@@ -269,7 +281,6 @@ class Controller extends \Piwik\Plugin\Controller
$viewWelcome = new View($welcomeTemplate);
$viewDone = new View($doneTemplate);
- $sqlQueries = $updater->getSqlQueriesToExecute();
if (Common::isPhpCliMode()) {
$this->doWelcomeUpdates($viewWelcome, $componentsWithUpdateFile);
echo $viewWelcome->render();
@@ -283,12 +294,11 @@ class Controller extends \Piwik\Plugin\Controller
$this->warningMessages = array();
$this->doExecuteUpdates($viewDone, $updater, $componentsWithUpdateFile);
- if (count($sqlQueries) == 1 && !$this->coreError) {
- Piwik::redirectToModule('CoreHome');
- }
+ $this->redirectToDashboardWhenNoError($updater);
+
echo $viewDone->render();
} else {
- $viewWelcome->queries = $sqlQueries;
+ $viewWelcome->queries = $updater->getSqlQueriesToExecute();
$viewWelcome->isMajor = $updater->hasMajorDbUpdate();
$this->doWelcomeUpdates($viewWelcome, $componentsWithUpdateFile);
echo $viewWelcome->render();
@@ -365,7 +375,7 @@ class Controller extends \Piwik\Plugin\Controller
foreach ($componentsWithUpdateFile as $name => $filenames) {
try {
$this->warningMessages = array_merge($this->warningMessages, $updater->update($name));
- } catch (Updater_UpdateErrorException $e) {
+ } catch (UpdaterErrorException $e) {
$this->errorMessages[] = $e->getMessage();
if ($name == 'core') {
$this->coreError = true;