diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php index e36a9809a46..3e17f85f62f 100644 --- a/plugins/SitesManager/API.php +++ b/plugins/SitesManager/API.php @@ -712,6 +712,28 @@ public function addSiteAliasUrls($idSite, $urls) return count($toInsert); } + /** + * Set the list of alias Urls for the given idSite + * + * Completely overwrites the current list of URLs with the provided list. + * The 'main_url' of the website won't be affected by this method. + * + * @return int the number of inserted URLs + */ + public function setSiteAliasUrls($idSite, $urls) + { + Piwik::checkUserHasAdminAccess($idSite); + + $urls = $this->cleanParameterUrls($urls); + $this->checkUrls($urls); + + $this->deleteSiteAliasUrls($idSite); + $this->insertSiteUrls($idSite, $urls); + $this->postUpdateWebsite($idSite); + + return count($urls); + } + /** * Get the start and end IP addresses for an IP address range *