https://github.com/matomo-org/matomo/commit/d25356a09f9913f575201b4bdf0abd6827cd1e47 - Mouve

Site d'origine

Permalink
Browse files
Add legacy autoloader to support Matomo namespaces in 3.X (#16069)
  • Loading branch information
tsteur committed Jun 17, 2020
1 parent 5dd7d4f commit d25356a09f9913f575201b4bdf0abd6827cd1e47
Showing with 33 additions and 1 deletion.
  1. +31 −0 LegacyAutoloader.php
  2. +2 −1 composer.json
@@ -0,0 +1,31 @@
<?php

class LegacyAutoloader
{
public function __construct()
{
spl_autoload_register(array($this, 'load_class'));
}

public static function register()
{
new LegacyAutoloader();
}

public function load_class($className)
{
if (strpos($className, 'Matomo\\') === 0) {
$newName = 'Piwik' . substr($className, 6);
if (class_exists($newName) && !class_exists($className, false)) {
@class_alias($newName, $className);
}
} elseif (strpos($className, 'Piwik\\') === 0) {
$newName = 'Matomo' . substr($className, 5);
if (class_exists($newName) && !class_exists($className, false)) {
@class_alias($newName, $className);
}
}
}
}

LegacyAutoloader::register();
@@ -144,7 +144,8 @@
"HTML_": "libs/",
"PEAR_": "libs/",
"Archive_": "libs/"
}
},
"files": ["LegacyAutoloader.php"]
},
"autoload-dev": {
"psr-4": {

0 comments on commit d25356a

Please sign in to comment.

level de log mis à 1

Récupération du document https://github.com/matomo-org/matomo/commit/d25356a09f9913f575201b4bdf0abd6827cd1e47.

Récupération de l'URL https://github.com/matomo-org/matomo/commit/d25356a09f9913f575201b4bdf0abd6827cd1e47...

Raccourcis

Commandes

Fermer