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:
authormatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2008-02-18 20:06:05 +0300
committermatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2008-02-18 20:06:05 +0300
commit28523ca2c06f02d0be838dd2feca6cef3bde5a1d (patch)
tree107da636d82835a79e0da366bbaae437134a03d0 /plugins/SitesManager/API.php
parent91ae3b53fd6ed274ef94e3aaa104fa6984c45a03 (diff)
- fixing css details
- cannot delete the only existing website
Diffstat (limited to 'plugins/SitesManager/API.php')
-rwxr-xr-xplugins/SitesManager/API.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php
index b87818f646..9cb73c1430 100755
--- a/plugins/SitesManager/API.php
+++ b/plugins/SitesManager/API.php
@@ -243,6 +243,14 @@ class Piwik_SitesManager_API extends Piwik_Apiable
{
Piwik::checkUserIsSuperUser();
+ $nbSites = count(Piwik_SitesManager_API::getAllSitesId());
+
+ if($nbSites == 1)
+ {
+ throw new Exception("It is not possible to delete this website as it is the only registered website.
+ Add a new website first, then delete this one.");
+ }
+
$db = Zend_Registry::get('db');
$db->query("DELETE FROM ".Piwik::prefixTable("site")."
@@ -250,6 +258,9 @@ class Piwik_SitesManager_API extends Piwik_Apiable
$db->query("DELETE FROM ".Piwik::prefixTable("site_url")."
WHERE idsite = ?", $idSite);
+
+ // TODO we should also delete all the data relative to this website...
+ // post an event here that will be catched by the core and plugins to clean the data
}