1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-21 22:47:43 +00:00
Files
matomo/core/Updates/3.5.1-b1.php
Michal Kleiner 9a3ef94df6 [Coding Style] Enable rule PSR12.Files.FileHeader + unify file headers (#22132)
* [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>
2024-04-20 20:50:47 +02:00

47 خطوط
2.0 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\Updates;
use Piwik\Filesystem;
use Piwik\Notification;
use Piwik\Plugin\Manager;
use Piwik\Updater;
use Piwik\Updates as PiwikUpdates;
class Updates_3_5_1_b1 extends PiwikUpdates
{
public function doUpdate(Updater $updater)
{
// try to deactivate and remove the GeoIP2 plugin from marketplace,
// which causes problems with GeoIp2 plugin included in core
// Skip if new file `isoRegionNames.php` is detected within `GeoIP2` directory, as that means filesystem is case
// insensitive and GeoIP2 plugin has been partially overwritten by GeoIp2 plugin
try {
if (is_dir(PIWIK_INCLUDE_PATH . '/plugins/GeoIP2') && !file_exists(PIWIK_INCLUDE_PATH . '/plugins/GeoIP2/data/isoRegionNames.php')) {
// first remove the plugin files, as trying to deactivate would load the plugin files resulting in a fatal error
Filesystem::unlinkRecursive(PIWIK_INCLUDE_PATH . '/plugins/GeoIP2', true);
// if plugin was activated, trigger deactivation to remove the config entry and set a notification
if (Manager::getInstance()->isPluginActivated('GeoIP2')) {
@Manager::getInstance()->deactivatePlugin('GeoIP2');
$notification = new Notification('GeoIP2 plugin from Marketplace has been removed due to compatibility issues. Please check your geolocation settings.');
$notification->context = Notification::CONTEXT_WARNING;
$notification->type = Notification::TYPE_PERSISTENT;
Notification\Manager::notify('GeoIP2_update_warning', $notification);
}
// uninstall the plugin to remove it from config
@Manager::getInstance()->uninstallPlugin('GeoIP2');
}
} catch (\Exception $e) {
}
}
}