?
avatar digitalgarage
digitalgarage
4 Feb 2015

Hi Folks,

Does anyone know if there have been changes to JInstaller and whether they were intentional?

Previously in 3.3 in the postflight method of a custom install script I was able to do something like the below to install additional custom modules and plugins.

$installer = new JInstaller();
$dir_arr = explode(DIRECTORY_SEPARATOR,FILE);
$dir_arr = array_slice($dir_arr, 0,(count($dir_arr)-1));

//now install.
$installer->install(implode('/',$dir_arr).'/componentplugin');
$installer->install(implode('/',$dir_arr).'/componentmodule');
$installer->install(implode('/',$dir_arr).'/anothermodule');

Now I find that this produces a JLIB_INSTALLER_ABORT_INSTALL_CUSTOM_INSTALL_FAILURE

But, if I grab a fresh installer object each time ie: putting $installer = new JInstaller(); between each call to install it works correctly.

When I put in some logging statements to track what was going on it seemed that the $installer still had references to files from the previous manifests that it was trying to install.

Is this an intentional change or a bug?

Eric.

avatar digitalgarage digitalgarage - open - 4 Feb 2015
avatar digitalgarage
digitalgarage - comment - 4 Feb 2015

Whoops File got bolded on the second line.

It should be __FILE__


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5977.
avatar brianteeman
brianteeman - comment - 4 Feb 2015

There are several PR from @mbabker you should look at - Just set the filter in the search tools to closed and the created by to mbabker


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5977.
avatar digitalgarage
digitalgarage - comment - 4 Feb 2015

Thanks @brianteeman I will have a look at them and see if they are related.

avatar digitalgarage
digitalgarage - comment - 5 Feb 2015

Right @brianteeman and @mbabker - The problem is adaptor related and my ugly / hacky workaround was just to turn off the lazy load of adaptors and create the adaptor each time.

ie comment out lines 829 - 839 in /libraries/cms/installer/installer.php

        if (!isset($this->_adapters[$type]) || !is_object($this->_adapters[$type]))
        {
            $adapter = $this->loadAdapter($type, $params);

            if (!$adapter)
            {
                return false;
            }

            $this->_adapters[$type] = $adapter;
        }

and just replace with

$this->_adapters[$type] = $adapter;

BUT.... I'm sure the lazy loading of adaptors was done that way for a reason and I don't want to trample on someone else's feet. @mbabker do you think that is the best solution or is there a better one?

Eric.

avatar mbabker
mbabker - comment - 5 Feb 2015

I left the lazy loading in based on the 3.3 code. The one key change that I might need to rethink is the getManifest method in the new JInstallerAdapter class. It keeps the manifest cached and without explicitly resetting it, the getManifest method will always get the first manifest loaded into the object.

avatar digitalgarage
digitalgarage - comment - 5 Feb 2015

I'm thinking this and #5945 are possibly related??

avatar brianteeman brianteeman - change - 6 Feb 2015
Labels Added: ?
avatar mbabker
mbabker - comment - 9 Feb 2015

See #6024

avatar zero-24
zero-24 - comment - 9 Feb 2015

Closing as we have a RTC PR #6024 Thanks!


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5977.
avatar zero-24 zero-24 - change - 9 Feb 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-02-09 16:46:44
Closed_By zero-24
avatar joomla-cms-bot
joomla-cms-bot - comment - 9 Feb 2015

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

avatar joomla-cms-bot joomla-cms-bot - close - 9 Feb 2015

Add a Comment

Login with GitHub to post a comment