/**
* @throws \Exception
* @return string or False if not set
*/
protected static function getPiwikInstanceId()
{
// until Piwik is installed, we use hostname as instance_id
if (!self::isPiwikInstalled() && Common::isPhpCliMode()) {
// enterprise:install use case
return Config::getHostname();
}
// config.ini.php not ready yet, instance_id will not be set
if (!Config::getInstance()->existsLocalConfig()) {
return false;
}
$instanceId = @Config::getInstance()->General['instance_id'];
if (!empty($instanceId)) {
return $instanceId;
}
// do not rewrite the path as Piwik uses the standard config.ini.php file
return false;
}