Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Upgrade Piwik 2.0 codebase to PHP 5.3! #3741

Closed
halfdan opened this Issue · 11 comments

5 participants

Fabian Becker Stefan Giehl Julien Moumné Matthieu Aubry Anonymous Piwik user
Fabian Becker
Collaborator

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!

Stefan Giehl
Collaborator

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).

Fabian Becker
Collaborator

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.

Julien Moumné
Collaborator

+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)

Matthieu Aubry
Owner

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

Matthieu Aubry
Owner

In 765be0d: Refs #3741 Resuming PHP Namespaces conversion of Piwik core, mostly finished core/ conversion

Matthieu Aubry
Owner

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

Stefan Giehl
Collaborator

In 9c12ab4: refs #3741 fixing some namespaces

Matthieu Aubry
Owner

In 32fe681: Piwik now requires PHP 5.3 Fixes #3741

Matthieu Aubry
Owner

In 215fdbe: Refs #3741 Removing pre 5.3 compatibility code

Matthieu Aubry
Owner

namespaces covered in #4059

Anonymous Piwik user

In 3f7a679: 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

Fabian Becker halfdan added this to the 2.0 - Piwik 2.0 milestone
Matthieu Aubry mattab was assigned by halfdan
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Matthieu Aubry mattab Refs #3741 Resuming PHP Namespaces conversion of Piwik core, mostly f…
…inished core/ conversion
765be0d
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Matthieu Aubry mattab Refs #3741 PHP Namespace conversion continued: Tracker classes,
renaming Unzip to Uncompress,
Renaming Tracker/Referer to Tracker/Referrer,
and few more
1175294
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Stefan Giehl sgiehl refs #3741 fixing some namespaces 9c12ab4
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Matthieu Aubry mattab Piwik now requires PHP 5.3 Fixes #3741 32fe681
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Matthieu Aubry mattab Refs #3741 Removing pre 5.3 compatibility code 215fdbe
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Fabian Becker halfdan Remove compat code for PHP < 5.3. inet_pton/inet_ntop are available i…
…n Windows in PHP >= 5.3 so we don't need the compat code anymore.

refs #3741, #4113
3f7a679
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.