original_string: public static function checkPiwikServerWorking($piwikServerUrl, $acceptInvalidSSLCertificates = false)
      {
          // Now testing if the webserver is running
          try {
              $fetched = Http::sendHttpRequestBy('curl',
                                                  $piwikServerUrl,
                                                  $timeout = 45,
                                                  $userAgent = null,
                                                  $destinationPath = null,
                                                  $file = null,
                                                  $followDepth = 0,
                                                  $acceptLanguage = false,
                                                  $acceptInvalidSSLCertificates
              );
          } catch (Exception $e) {
              $fetched = "ERROR fetching: " . $e->getMessage();
          }
          // this will match when Piwik not installed yet, or favicon not customised
          $expectedStringAlt = 'plugins/CoreHome/images/favicon.png';
  
          // this will match when Piwik is installed and favicon has been customised
          $expectedString = 'misc/user/';
  
          // see checkPiwikIsNotInstalled()
          $expectedStringAlreadyInstalled = 'piwik-is-already-installed';
  
          $expectedStringNotFound = strpos($fetched, $expectedString) === false
                                  && strpos($fetched, $expectedStringAlt) === false
                                  && strpos($fetched, $expectedStringAlreadyInstalled) === false;
  
          $hasError = false !== strpos($fetched, PAGE_TITLE_WHEN_ERROR);
  
          if ($hasError || $expectedStringNotFound) {
              throw new Exception("\nMatomo should be running at: "
                  . $piwikServerUrl
                  . " but this URL returned an unexpected response: '"
                  . $fetched . "'\n\n");
          }
      }
code: public static function checkPiwikServerWorking($piwikServerUrl, $acceptInvalidSSLCertificates = false)
      {
          // Now testing if the webserver is running
          try {
              $fetched = Http::sendHttpRequestBy('curl',
                                                  $piwikServerUrl,
                                                  $timeout = 45,
                                                  $userAgent = null,
                                                  $destinationPath = null,
                                                  $file = null,
                                                  $followDepth = 0,
                                                  $acceptLanguage = false,
                                                  $acceptInvalidSSLCertificates
              );
          } catch (Exception $e) {
              $fetched = "ERROR fetching: " . $e->getMessage();
          }
          // this will match when Piwik not installed yet, or favicon not customised
          $expectedStringAlt = 'plugins/CoreHome/images/favicon.png';
  
          // this will match when Piwik is installed and favicon has been customised
          $expectedString = 'misc/user/';
  
          // see checkPiwikIsNotInstalled()
          $expectedStringAlreadyInstalled = 'piwik-is-already-installed';
  
          $expectedStringNotFound = strpos($fetched, $expectedString) === false
                                  && strpos($fetched, $expectedStringAlt) === false
                                  && strpos($fetched, $expectedStringAlreadyInstalled) === false;
  
          $hasError = false !== strpos($fetched, PAGE_TITLE_WHEN_ERROR);
  
          if ($hasError || $expectedStringNotFound) {
              throw new Exception("\nMatomo should be running at: "
                  . $piwikServerUrl
                  . " but this URL returned an unexpected response: '"
                  . $fetched . "'\n\n");
          }
      }
code_tokens: public static function checkPiwikServerWorking ( $ piwikServerUrl , $ acceptInvalidSSLCertificates = false ) { // Now testing if the webserver is running try { $ fetched = Http :: sendHttpRequestBy ( 'curl' , $ piwikServerUrl , $ timeout = 45 , $ userAgent = null , $ destinationPath = null , $ file = null , $ followDepth = 0 , $ acceptLanguage = false , $ acceptInvalidSSLCertificates ) ; } catch ( Exception $ e ) { $ fetched = "ERROR fetching: " . $ e -> getMessage ( ) ; } // this will match when Piwik not installed yet, or favicon not customised $ expectedStringAlt = 'plugins/CoreHome/images/favicon.png' ; // this will match when Piwik is installed and favicon has been customised $ expectedString = 'misc/user/' ; // see checkPiwikIsNotInstalled() $ expectedStringAlreadyInstalled = 'piwik-is-already-installed' ; $ expectedStringNotFound = strpos ( $ fetched , $ expectedString ) === false && strpos ( $ fetched , $ expectedStringAlt ) === false && strpos ( $ fetched , $ expectedStringAlreadyInstalled ) === false ; $ hasError = false !== strpos ( $ fetched , PAGE_TITLE_WHEN_ERROR ) ; if ( $ hasError || $ expectedStringNotFound ) { throw new Exception ( "\nMatomo should be running at: " . $ piwikServerUrl . " but this URL returned an unexpected response: '" . $ fetched . "'\n\n" ) ; } }
docstring: Returns true if the Piwik server appears to be working.
  
  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..
  
  @param $piwikServerUrl
  @param bool $acceptInvalidSSLCertificates
  @throws Exception
  @return bool
docstring_tokens: Returns true if the Piwik server appears to be working .