Opened 14 months ago

Closed 8 months ago

Last modified 6 months ago

#3741 closed Task (fixed)

Upgrade Piwik 2.0 codebase to PHP 5.3!

Reported by: halfdan Owned by: mattab
Priority: critical Milestone: 2.0 - Piwik 2.0
Component: Core Keywords:
Cc: Sensitive: no

Description (last modified by matt)

This ticket should serve as a placeholder ticket for discussion and future changes related to Piwik 2.0.

With Piwik 2.0 in sight we should raise the minimum PHP version to 5.3. PHP 5.1 has EOL'd more than 7 years ago, and PHP 5.2 more than 2 years ago. http://php.net/eol.php

PHP 5.3 introduced several interesting features that we can utilize.

Namespaces

For Piwik 2.0 I propose the following changes regarding namespaces.

We use \Piwik as central namespace. Everything else will go into subnamespaces. This will allow us to get rid of long class names like Piwik_Plugin_Config (which will become the class Config in the namespace \Piwik\Core\Plugin.

I propose the following namespaces:

core/\Piwik\Core
core/API\Piwik\Core\API
plugins/\Piwik\Plugin
plugins/Goals\Piwik\Plugin\Goals

and so on. We should discuss if the "Core" namespace is necessary however.

Other

PHP 5.3 also introduced anonymous functions, which we can use as callback methods in some places.

It also introduced better XML support with XMLReader/XMLWriter, which could act as a replacement for SimpleXML and solve #1522.


This will break backwards compatibility, but since 2.0 is a major release we should use this to bring Piwik to the latest standard in PHP development.

This will also allow us to upgrade or change some of our dependencies that have moved to PHP 5.3 as well.

Bringing Piwik to PHP 5.3 is no easy task and will very likely be a joint effort. We need to decide on a feature freeze date. At this date, no new features will be implemented in the master branch. We will then create a "Piwik 1.x" branch which we can maintain for security patches and backports of Piwik 2.0 features. The master branch will then be used to upgrade Piwik to PHP 5.3.

Feel free to add to this ticket!

Change History (13)

comment:1 Changed 14 months ago by SteveG (sgiehl)

Have you already looked at ZF2? It is not really a new version of zend framework (1). It's more like a complete new framework. I don't think its even possible to upgrade without rewriting everything.

If we realy want to switch to PHP 5.3 features and a new framework, maybe we should also have a look at symphony (http://symfony.com/) and start completly new. That way we would have a clean new code base and could directly implement some features that are very hard to implement with the current code base.

Note: PHPUnit 3.8 requires PHP 5.4.7 (or later).

comment:2 Changed 14 months ago by halfdan

No I haven't looked at ZF2 very close. I did not think that the changes were that big.

Symfony would be very interesting indeed as it would allow us to clean up the code base quite a bit. Templating also seems to be much easier in Symfony as compared to Smarty.

I think the first step is to bring Piwik to 5.3. After that we can consider changing the framework.

comment:3 Changed 14 months ago by halfdan

  • Description modified (diff)

comment:4 Changed 14 months ago by JulienM (JulienMoumne)

+1 for namespaces
+1 for anonymous functions (I would then be able to simplify https://github.com/piwik/piwik/blob/1.9.2/plugins/MobileMessaging/ReportRenderer/Sms.php#L74)

comment:5 Changed 13 months ago by matt (mattab)

  • Description modified (diff)
  • Milestone changed from 1.x - Piwik 1.x to 2.0 - Piwik 2.0

Regarding \Core namespace: IMHO it adds clutter so better leave it out.

comment:6 Changed 9 months ago by matt (mattab)

In 765be0dc8f92a6d4bb3e678a0c23f2d4b95e0e18:

Refs #3741 Resuming PHP Namespaces conversion of Piwik core, mostly finished core/ conversion

comment:7 Changed 9 months ago by matt (mattab)

In 11752942f0e6526a0d254af2bb2b101491238f29:

Refs #3741 PHP Namespace conversion continued: Tracker classes,
renaming Unzip to Uncompress,
Renaming Tracker/Referer to Tracker/Referrer,
and few more

comment:9 Changed 8 months ago by matt (mattab)

  • Owner set to mattab
  • Resolution set to fixed
  • Status changed from new to closed

In 32fe6810d7db72f292bc5f867d117c1bc0ae4a92:

Piwik now requires PHP 5.3 Fixes #3741

comment:10 Changed 8 months ago by matt (mattab)

In 215fdbead801feec2d9a8ea2c404c1ff234b1ac6:

Refs #3741 Removing pre 5.3 compatibility code

comment:11 Changed 8 months ago by matt (mattab)

namespaces covered in #4059

comment:12 Changed 8 months ago by Fabian Becker

In 3f7a6795f1c61076bbd70720c5950fabf9bcddde:

Remove compat code for PHP < 5.3. inet_pton/inet_ntop are available in Windows in PHP >= 5.3 so we don't need the compat code anymore.

refs #3741, #4113

comment:13 Changed 6 months ago by matt (mattab)

  • Priority changed from normal to critical
  • Summary changed from Switch to PHP 5.3 for Piwik 2.0 to Upgrade Piwik 2.0 codebase to PHP 5.3!
Note: See TracTickets for help on using tickets.