setSiteAliasUrls() public method

Completely overwrites the current list of URLs with the provided list. The 'main_url' of the website won't be affected by this method.
public setSiteAliasUrls ( $idSite, $urls = [] ) : integer
return integer the number of inserted URLs
Exemplo n.º 1
0
 public function testGetAllCachedSiteUrls_ShouldReturnCorrectResultEvenIfItIsCachedAsWeClearTheCacheOnAnyChange()
 {
     $this->addSite('http://www.example.com');
     // only one main URL
     $this->assertCachedSiteUrls(array(1 => array('http://www.example.com')));
     $this->addSite('http://www.example.com', 'http://www.piwik.org');
     // main URL and alias URL
     $this->assertCachedSiteUrls(array(1 => array('http://www.example.com'), 2 => array('http://www.example.com', 'http://www.piwik.org')));
     $this->api->addSiteAliasUrls(2, 'http://piwik.org');
     $this->assertCachedSiteUrls(array(1 => array('http://www.example.com'), 2 => array('http://www.example.com', 'http://piwik.org', 'http://www.piwik.org')));
     $this->api->setSiteAliasUrls(2, array());
     $this->assertCachedSiteUrls(array(1 => array('http://www.example.com'), 2 => array('http://www.example.com')));
     $this->api->updateSite(1, 'siteName3', array('http://updated.example.com', 'http://2.example.com'));
     $this->assertCachedSiteUrls(array(1 => array('http://updated.example.com', 'http://2.example.com'), 2 => array('http://www.example.com')));
 }