Skip to content

Commit

Permalink
Add legacy autoloader for 2.x-dev for smoother upgrades (#16070)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteur authored Jun 16, 2020
1 parent 3864498 commit ce90503
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
31 changes: 31 additions & 0 deletions LegacyAutoloader.php
Original file line number Diff line number Diff line change
@@ -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();
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@
"HTML_": "libs/",
"PEAR_": "libs/",
"Archive_": "libs/"
}
},
"files": ["LegacyAutoloader.php"]
},
"autoload-dev": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion core/Plugin/ControllerAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private static function notifyIfEAcceleratorIsUsed()
*/
private static function getNextRequiredMinimumPHP()
{
return '5.5.9';
return '7.2.5';
}

private static function isUsingPhpVersionCompatibleWithNextPiwik()
Expand Down
2 changes: 1 addition & 1 deletion core/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class Version
* The current Piwik version.
* @var string
*/
const VERSION = '2.18.0';
const VERSION = '2.18.1-b1';

public function isStableVersion($version)
{
Expand Down

0 comments on commit ce90503

Please sign in to comment.