The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri May 25, 2012 8:23 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Oct 17, 2011 9:24 am
Posts: 18
Hi all,

Joomla 2.5 support for install multiple extensions in one go, it is great. Link doc here http://docs.joomla.org/Package
But It will more useful if we add a feature which allows automatic enable module or plugin when install package. Because in our some extensions, we need auto enable some plugins system to work with component. So that clients do not waste time to do it.

A suggestion:
Code:
<?xml version="1.0" encoding="UTF-8" ?>
 <extension type="package" version="1.6">
 <name>Hello World Package</name>
 <packagename>helloworld</packagename>
 <version>1.0.0</version>
 <url>http://www.yoururl.com/</url>
 <packager>Hello World Package Team</packager>
 <packagerurl>http://www.yoururl.com/</packagerurl>
 <description>Example package to combine multiple extensions</description>
 <update>http://www.updateurl.com/update</update>
 <files folder="packages">
 <file type="component" id="com_helloworld" >com_helloworld.zip</file>
 <file type="module" id="mod_helloworld" client="site">mod_helloworld.zip</file>
<file type="plugin" id="helloworld" group="system" enable="true">plg_helloworld.zip</file>
 </files>
 </extension>


Tell me what do you think? Sorry for poor English :) :-[
Enjoy! :pop

_________________
TemPlaza Group
Website: http://www.templaza.com/
Email: info@templaza.com


Top
 Profile  
 
PostPosted: Fri May 25, 2012 6:46 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Oct 30, 2008 7:27 pm
Posts: 149
It can be done now, but not as easily as what you're suggesting. This forum is more for coding than feature requests so if you really think your method should be part of the platform, then you should make a topic on the platform's git site: https://github.com/joomla/joomla-platfo ... state=open

As for the current solution to your problem, you can use <scriptfile></scriptfile> element in package manifest file. That allows you to use the postflight trigger to enable the plugin:

package manifest xml file:
Code:
<scriptfile>package_install_script.php</scriptfile>


package_install_script.php:
Code:
class com_mycomponentInstallerScript
{
   function postflight($type, $parent)
   {
      // If this is not a new install, return. (we don't want to enable if we're only updating!)


      // Get database object


      // If you make sure the plugin name is always the same as the package name
      // then you don't have to hardcode the plugin name into this function, meaning
      // you can reuse it with other extensions without having to make changes.
      $extensionName = $parent->get('manifest')->packagename;


      // SQL call to the database to enable any plugin with the $extensionName name


      // If the SQL call effected any rows
         echo "<p>the plugin has been enabled</p>";
      // else
         echo "<p>the plugin failed to enabled</p>";

   }
}


Or something like that, I've never needed to do it myself so don't have working code to show you.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 



Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group