PHP Class Piwik\SettingsPiwik

显示文件 Open project: piwik/piwik Class Usage Examples

Public Methods

Method Description
checkPiwikServerWorking ( $piwikServerUrl, boolean $acceptInvalidSSLCertificates = false ) : boolean Returns true if the Piwik server appears to be working.
getCurrentGitBranch ( )
getKnownSegmentsToArchive ( ) : array Returns every stored segment to pre-process for each site during cron archiving.
getKnownSegmentsToArchiveForSite ( integer $idSite ) : string[] Returns the list of stored segments to pre-process for an individual site when executing cron archiving.
getPiwikUrl ( ) : string Returns the URL to this Piwik instance, eg. **http://demo.piwik.org/** or **http://example.org/piwik/**.
getSalt ( ) : string Get salt from [General] section
getWebsitesCountToDisplay ( ) : integer Number of websites to show in the Website selector
isAutoUpdateEnabled ( ) : boolean Detect whether user has enabled auto updates. Please note this config is a bit misleading. It is currently actually used for 2 things: To disable making any connections back to Piwik, and to actually disable the auto update of core and plugins.
isAutoUpdatePossible ( ) : boolean Detects whether an auto update can be made. An update is possible if the user is not on multiple servers and if automatic updates are actually enabled. If a user is running Piwik on multiple servers an update is not possible as it would be installed only on one server instead of all of them. Also if a user has disabled automatic updates we cannot perform any automatic updates.
isGitDeployment ( ) : boolean Returns true if Piwik is deployed using git FAQ: http://piwik.org/faq/how-to-install/faq_18271/
isHttpsForced ( ) : boolean
isMultiServerEnvironment ( ) : boolean Returns true if Piwik is running on more than one server. For example in a load balanced environment. In this case we should not make changes to the config and not install a plugin via the UI as it would be only executed on one server.
isPiwikInstalled ( ) : boolean Return true if Piwik is installed (installation is done).
isSameFingerprintAcrossWebsites ( ) : boolean Note: this config settig is also checked in the InterSites plugin
isSegmentationEnabled ( ) : boolean Returns true if segmentation is allowed for this user, false if otherwise.
isUniqueVisitorsEnabled ( string $periodLabel ) : boolean Returns true if unique visitors should be processed for the given period type.
isUserCredentialsSanityCheckEnabled ( ) : boolean Should Piwik check that the login & password have minimum length and valid characters?
overwritePiwikUrl ( $currentUrl )
rewriteMiscUserPathWithInstanceId ( $path ) : mixed If Piwik uses per-domain config file, make sure CustomLogo is unique

Protected Methods

Method Description
getPiwikInstanceId ( ) : string
rewritePathAppendPiwikInstanceId ( $pathToRewrite, $leadingPathToAppendHostnameTo ) : mixed

Method Details

checkPiwikServerWorking() public static method

If the Piwik server is in an error state (eg. some directories are not writable and Piwik displays error message), or if the Piwik server is "offline", this will return false..
public static checkPiwikServerWorking ( $piwikServerUrl, boolean $acceptInvalidSSLCertificates = false ) : boolean
$piwikServerUrl
$acceptInvalidSSLCertificates boolean
return boolean

getCurrentGitBranch() public static method

public static getCurrentGitBranch ( )

getKnownSegmentsToArchive() public static method

Returns every stored segment to pre-process for each site during cron archiving.
public static getKnownSegmentsToArchive ( ) : array
return array The list of stored segments that apply to all sites.

getKnownSegmentsToArchiveForSite() public static method

Returns the list of stored segments to pre-process for an individual site when executing cron archiving.
public static getKnownSegmentsToArchiveForSite ( integer $idSite ) : string[]
$idSite integer The ID of the site to get stored segments for.
return string[] The list of stored segments that apply to the requested site.

getPiwikInstanceId() protected static method

protected static getPiwikInstanceId ( ) : string
return string or False if not set

getPiwikUrl() public static method

Returns the URL to this Piwik instance, eg. **http://demo.piwik.org/** or **http://example.org/piwik/**.
public static getPiwikUrl ( ) : string
return string

getSalt() public static method

Get salt from [General] section
public static getSalt ( ) : string
return string

getWebsitesCountToDisplay() public static method

Number of websites to show in the Website selector
public static getWebsitesCountToDisplay ( ) : integer
return integer

isAutoUpdateEnabled() public static method

Detect whether user has enabled auto updates. Please note this config is a bit misleading. It is currently actually used for 2 things: To disable making any connections back to Piwik, and to actually disable the auto update of core and plugins.
public static isAutoUpdateEnabled ( ) : boolean
return boolean

isAutoUpdatePossible() public static method

Detects whether an auto update can be made. An update is possible if the user is not on multiple servers and if automatic updates are actually enabled. If a user is running Piwik on multiple servers an update is not possible as it would be installed only on one server instead of all of them. Also if a user has disabled automatic updates we cannot perform any automatic updates.
public static isAutoUpdatePossible ( ) : boolean
return boolean

isGitDeployment() public static method

Returns true if Piwik is deployed using git FAQ: http://piwik.org/faq/how-to-install/faq_18271/
public static isGitDeployment ( ) : boolean
return boolean

isHttpsForced() public static method

public static isHttpsForced ( ) : boolean
return boolean

isMultiServerEnvironment() public static method

Returns true if Piwik is running on more than one server. For example in a load balanced environment. In this case we should not make changes to the config and not install a plugin via the UI as it would be only executed on one server.
public static isMultiServerEnvironment ( ) : boolean
return boolean

isPiwikInstalled() public static method

Return true if Piwik is installed (installation is done).
public static isPiwikInstalled ( ) : boolean
return boolean

isSameFingerprintAcrossWebsites() public static method

Note: this config settig is also checked in the InterSites plugin
public static isSameFingerprintAcrossWebsites ( ) : boolean
return boolean

isSegmentationEnabled() public static method

Returns true if segmentation is allowed for this user, false if otherwise.
public static isSegmentationEnabled ( ) : boolean
return boolean

isUniqueVisitorsEnabled() public static method

Unique visitor processing is controlled by the [General] enable_processing_unique_visitors_... INI config options. By default, unique visitors are processed only for day/week/month periods.
public static isUniqueVisitorsEnabled ( string $periodLabel ) : boolean
$periodLabel string `"day"`, `"week"`, `"month"`, `"year"` or `"range"`
return boolean

isUserCredentialsSanityCheckEnabled() public static method

Should Piwik check that the login & password have minimum length and valid characters?
public static isUserCredentialsSanityCheckEnabled ( ) : boolean
return boolean True if checks enabled; false otherwise

overwritePiwikUrl() public static method

public static overwritePiwikUrl ( $currentUrl )
$currentUrl

rewriteMiscUserPathWithInstanceId() public static method

If Piwik uses per-domain config file, make sure CustomLogo is unique
public static rewriteMiscUserPathWithInstanceId ( $path ) : mixed
$path
return mixed

rewritePathAppendPiwikInstanceId() protected static method

protected static rewritePathAppendPiwikInstanceId ( $pathToRewrite, $leadingPathToAppendHostnameTo ) : mixed
$pathToRewrite
$leadingPathToAppendHostnameTo
return mixed