? Success

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
5 Feb 2015

I'm starting a little effort to clean up our codebase. I'm starting with the system plugins and the cache plugin is the first.

This PR does a little code cleanup by merging if-clauses and by using the auto-injected application object instead of calling JFactory. This will eventually allow us to maybe unittest these plugins, too.

How to test

  • Enable page caching plugin, see that it creates an entry for a page that you load from your site
  • Apply patch
  • See that it behaves exactly as before.
avatar Hackwar Hackwar - open - 5 Feb 2015
avatar jissues-bot jissues-bot - change - 5 Feb 2015
Labels Added: ?
avatar mbabker
mbabker - comment - 5 Feb 2015

Looks fine, there's no functionality change, just a bit of cleanup.

avatar Bakual
Bakual - comment - 5 Feb 2015

We have had an issue with the auto-injected application object in the past during upgrades from 2.5 to 3.x. That is the case especially for system plugins.
See #3467 for the issue we had back then with the remember me plugin.

avatar Hackwar
Hackwar - comment - 5 Feb 2015

Even more reason to make sure that people first upgrade to a version that has this already included and then to upgrade to the version that contains this. :wink:

avatar Bakual
Bakual - comment - 5 Feb 2015

There is no version where you could ensure that. It doesn't even work from 3.1 to 3.2 (when we introduced it imho).

avatar mbabker
mbabker - comment - 5 Feb 2015

The only way that becomes an issue is if the system plugins are getting initialized before the JPlugin class in libraries/joomla gets removed (which would be locked at 3.1.5 at the latest since it was moved to libraries/cms at 3.2). And based on our autoloader path priorities, libraries/cms gets preferred over libraries/joomla, which to me means that the user is having other upgrade issues than this.

avatar Hackwar
Hackwar - comment - 5 Feb 2015

see my comments regarding making the updater more intelligent. :wink:

avatar Hackwar Hackwar - close - 5 Feb 2015
avatar Hackwar Hackwar - reopen - 5 Feb 2015
avatar Hackwar Hackwar - reopen - 5 Feb 2015
avatar Hackwar Hackwar - change - 5 Feb 2015
Status Pending Closed
avatar mbabker
mbabker - comment - 5 Feb 2015

Improving the updater, yes. As you proposed on the mailing list, I don't agree with. I'd almost argue the update component should be the only supported update platform and a CLI script written to support updates in that manner, then enable the component to handle more of the updates and be less reliant on the platform to do it (that's exactly how I implemented my update platform in another project). But, this isn't the forum for that discussion.

avatar zero-24
zero-24 - comment - 5 Feb 2015

@Hackwar to fix it you can use this check at the __construct

        // Get the application if not done by JPlugin. This may happen during upgrades from Joomla 2.5.
        if (!$this->app)
        {
            $this->app = JFactory::getApplication();
        }
avatar zero-24 zero-24 - change - 5 Feb 2015
Category Plugins
avatar zero-24 zero-24 - change - 5 Feb 2015
Status Closed Pending
Closed_Date 0000-00-00 00:00:00
avatar jissues-bot
jissues-bot - comment - 5 Feb 2015

Set to "open" on behalf of @zero-24 by The JTracker Application at issues.joomla.org/joomla-cms/5980

avatar zero-24
zero-24 - comment - 5 Feb 2015

Moving back to Pending also on the Tracker


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5980.
avatar Hackwar
Hackwar - comment - 5 Feb 2015

Before we add such code, I'd rather close this PR again. The goal is to reduce the number of LoCs and not increase it. Either this feature works, then we don't need that check, or it does not work, then we should remove it again from the whole system.Simple as that.

avatar brianteeman brianteeman - change - 12 Nov 2015
Status Pending Information Required
avatar brianteeman
brianteeman - comment - 12 Nov 2015

@hackwar I am a bit confused on the state of this PR - are you saying you want it to be closed


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5980.

avatar Hackwar
Hackwar - comment - 12 Nov 2015

This PR is meant to simplify code by making usage of the autoload feature for the application object. Since that is not update-safe, it was proposed to introduce even more code to make sure that we can use the application object. Since the goal was to have less code, that would contradict itself. I would still vote to add this PR to the repo, but only without adding additional code.

avatar brianteeman
brianteeman - comment - 12 Nov 2015

But if that cant be added without adding the extra code it is not possible is it?

avatar Hackwar
Hackwar - comment - 12 Nov 2015

yes and no. The PLT would have to decide if we introduce a step inbetween upgrades from 2.5 to latest 3.x, where we make a stop for example at 3.4.0 or something, where the new code has already been introduced and this issue can't come up anymore. Then in the next step, you would upgrade to the latest version. In that case this code could be merged. At one point in time we will have to introduce something like this, even if it is just so that not every update needs to load and replace ALL files that have been changed since Joomla 1.5...

avatar brianteeman brianteeman - change - 12 Nov 2015
Status Information Required Needs Review
avatar brianteeman
brianteeman - comment - 12 Nov 2015

Setting to Needs Review so that decision can be taken


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5980.

avatar Hackwar Hackwar - change - 6 Jan 2016
Status Needs Review Closed
Closed_Date 0000-00-00 00:00:00 2016-01-06 11:31:18
Closed_By Hackwar
avatar Hackwar Hackwar - close - 6 Jan 2016

Add a Comment

Login with GitHub to post a comment