diff options
author | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2008-10-28 19:05:33 +0300 |
---|---|---|
committer | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2008-10-28 19:05:33 +0300 |
commit | 69415b9b8eb522cf50ebb4d74048290a78a54d79 (patch) | |
tree | 26a94dfc06671a0f92963d019185b631a9e6cddc /plugins/SitesManager/API.php | |
parent | af12a2cd13bb39394f224b9be668a89fc99446ed (diff) |
- you can now delete alias URLs using the UI
- improved installation help messages + auto focus on form fields
- simplified sitesmanager API (deleted replaceUrls method)
- ts_created fields in site table is now NOT CURRENT_TIMESTAMP ON UPDATE (I can't believe this is default!!! BAD mysql)
Diffstat (limited to 'plugins/SitesManager/API.php')
-rwxr-xr-x | plugins/SitesManager/API.php | 44 |
1 files changed, 4 insertions, 40 deletions
diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php index 18db6b1970..cfd4e8b0c7 100755 --- a/plugins/SitesManager/API.php +++ b/plugins/SitesManager/API.php @@ -309,41 +309,6 @@ class Piwik_SitesManager_API extends Piwik_Apiable } /** - * Replaces the list of URLs (main_url and alias URLs) for the given idSite. - * - * @param int the website ID - * @param array the array of URLs; The first URL is the main_url and is mandatory. - * - * @exception if the website ID doesn't exist or the user doesn't have access to it - * @exception if there is no URL - * @exception if any of the URLs has not a correct format - * - * @return int the number of inserted URLs - */ - static public function replaceSiteUrls( $idSite, $urls) - { - Piwik::checkUserHasAdminAccess($idSite); - - $urls = self::cleanParameterUrls($urls); - self::checkUrls($urls); - self::checkAtLeastOneUrl($urls); - - $site = self::getSiteFromId($idSite); - - $site['main_url'] = $urls[0]; - self::updateSite($site['idsite'], $site['name'], $site['main_url']); - - $urls = array_slice($urls,1); - self::deleteSiteAliasUrls($idSite); - - $insertedUrls = self::addSiteAliasUrls($idSite, $urls); - - // we have updated the main_url at least, and maybe some alias URLs - return 1 + $insertedUrls; - } - - - /** * Update an existing website. * If only one URL is specified then only the main url will be updated. * If several URLs are specified, both the main URL and the alias URLs will be updated. @@ -382,14 +347,13 @@ class Piwik_SitesManager_API extends Piwik_Apiable $bind, "idsite = $idSite" ); - // if there are more than 1 url for this website we need to set also the alias URLs - // we use the replaceSiteUrls function ; it is not great because it will update the - // same row we have just updated... but it is better than duplicating the logic + + // we now update the main + alias URLs + self::deleteSiteAliasUrls($idSite); if(count($urls) > 1) { - self::replaceSiteUrls($idSite, $urls); + $insertedUrls = self::addSiteAliasUrls($idSite, array_slice($urls,1)); } - } /** |