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.
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
Thanks @brianteeman I will have a look at them and see if they are related.
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.
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.
Labels |
Added:
?
|
Closing as we have a RTC PR #6024 Thanks!
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-02-09 16:46:44 |
Closed_By | ⇒ | zero-24 |
Set to "closed" on behalf of @zero-24 by The JTracker Application at issues.joomla.org/joomla-cms/5977
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.