قرینه از
https://github.com/matomo-org/matomo.git
synced 2025-08-22 06:57:53 +00:00

* [Coding Style] Enable rule PSR12.Files.FileHeader * Apply CS * Replace Piwik with Matomo in file headers * Unify file headers (position, no. of lines, https links) * Rebuild dist files * Apply CS * Fix system test that relies on line numbers in a file that had the file header updated --------- Co-authored-by: Stefan Giehl <stefan@matomo.org>
61 خطوط
1.7 KiB
PHP
61 خطوط
1.7 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Matomo - free/libre analytics platform
|
|
*
|
|
* @link https://matomo.org
|
|
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
|
*/
|
|
|
|
namespace Piwik\Plugins\CoreUpdater\tests\Mock;
|
|
|
|
use Piwik\Plugins\CoreUpdater\ArchiveDownloadException;
|
|
use Piwik\Plugins\CoreUpdater\Updater;
|
|
use Piwik\Translation\Translator;
|
|
|
|
class UpdaterMock extends Updater
|
|
{
|
|
/**
|
|
* @var Translator
|
|
*/
|
|
private $translator;
|
|
|
|
public function __construct(Translator $translator)
|
|
{
|
|
$this->translator = $translator;
|
|
}
|
|
|
|
public function getLatestVersion()
|
|
{
|
|
return '40.0.0';
|
|
}
|
|
|
|
public function isNewVersionAvailable()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function getArchiveUrl($version, $https = true)
|
|
{
|
|
return 'http://builds.matomo.org/piwik.zip';
|
|
}
|
|
|
|
public function updatePiwik($https = true)
|
|
{
|
|
// Simulate that the update over HTTPS fails
|
|
if ($https) {
|
|
// The actual error message depends on the OS, the HTTP method etc.
|
|
// This is what I get on my machine, but it doesn't really matter
|
|
throw new ArchiveDownloadException(new \Exception('curl_exec: SSL certificate problem: Invalid certificate chain. Hostname requested was: piwik.org'), array());
|
|
}
|
|
|
|
// Simulate that the update over HTTP succeeds
|
|
return array(
|
|
$this->translator->translate('CoreUpdater_DownloadingUpdateFromX', ''),
|
|
$this->translator->translate('CoreUpdater_UnpackingTheUpdate'),
|
|
$this->translator->translate('CoreUpdater_VerifyingUnpackedFiles'),
|
|
$this->translator->translate('CoreUpdater_InstallingTheLatestVersion'),
|
|
);
|
|
}
|
|
}
|