Page 1 of 2

Add extra installations to customized WP installers script?

Posted: Sat Mar 07, 2009 5:43 pm
by donnacha
Hello again.

As you know, I have been using Installatron to automate the installation of WordPress and plugins, using a customized installers script to customize the standard Installatron installation of WP and creating an installer for each of the plugins.

I've been busy with other stuff for the last few weeks but, now, I'm free to have another shot at mastering Installatron :D

One thing I really like about the customized installers script is that it is possible to delete certain files and folders from every installation of WordPress.

Is it also possible to edit the customized installers script to automatically add several of the plugin installers to each installation of WordPress?

Re: Add extra installations to customized WP installers script?

Posted: Sat Mar 07, 2009 6:00 pm
by donnacha
Also,...

... would it be possible to somehow create different "packages", all based upon my customized WordPress installation but with different selections of other installers automatically added i.e. different selections of plugins and themes.

Does that make sense?

Re: Add extra installations to customized WP installers script?

Posted: Sat Mar 07, 2009 6:03 pm
by donnacha
The most important thing is that Installatron continue to see each plugin and theme as a separate installation, so they can be upgraded separately later.

Re: Add extra installations to customized WP installers script?

Posted: Sat Mar 07, 2009 11:15 pm
by Rowan
Hi,

You can't mix those two things; you can either install the plugins/themes with the standard installation, using Customizations, or you can have version control for each plugin/theme, using separate installers.

We might be able to enable something like that with the next version of the installer system, but that's still several months away. For now, at least, you can only have one or the other.

Rowan.

Re: Add extra installations to customized WP installers script?

Posted: Sun Mar 08, 2009 12:08 am
by donnacha
Interesting, I'm glad to hear that this sort of flexibility might be possible in a future version - it would be incredibly useful for WordPress and I'm probably biased but I suspect that a growing number of your users will be using Installatron primarily for WordPress installs or, at least, similar core+plugins+themes applications.

For now, taking the route of forgoing version control and installing the plugins and themes with the standard installation, using customizations, is there any way to produce multiple versions of the standard WordPress install, each of which would obey different customization instructions i.e. wordpressinstall1, wordpressinstall2, wordpressinstall3 etc, with each version of wordpressinstall being the exactly the same, only the name is different, and each having a different button?

The idea is that pressing, say, wordpressinstall4 would give me the standard version of WordPress you provide but my customization script would treat it differently, copying in a different set of themes and plugins.

Re: Add extra installations to customized WP installers script?

Posted: Sun Mar 08, 2009 12:29 am
by Rowan
Using multiple installers for that is probably not the best approach. Instead I would recommend using a single Customization that gives the user a choice when installing wordpress. I'll whip up an example.

Rowan

Re: Add extra installations to customized WP installers script?

Posted: Sun Mar 08, 2009 12:43 am
by donnacha
Wow, an example would be great, thank you!

I have been pondering whether saved sets might be a good idea for a future version of Installatron - where, from the New Install page, you could tick boxes to select all the plugins and themes you want to install and, when you click Submit, Installatron installs them one after the other, without any interruptions because those particular installs would require no user input.

Being able to save specific sets of selections would enable you to create groups of plugins and themes appropriate to different kinds of WordPress sites you want to create, enabling you to equip your WordPress at the press of a single button/link, without having to select them all by hand every time.

Re: Add extra installations to customized WP installers script?

Posted: Sun Mar 08, 2009 12:49 am
by Rowan
This is along the lines of what I was thinking:

Code: Select all

<?php
class i_installer_customcode
{
    function init()
    {
$this->registerArchive("plugina", "http://www.something.com.au/Plugin_A.zip", "zip");
$this->registerCustomCode("wordpress", "all", "install", 1, "init", "wordpressinstall");
$this->registerCustomCode("wordpress", "all", "install", "last", "process", "wordpressinstall");
$this->registerCustomCode("wordpress", "all", "upgrade", "last", "process", "wordpressupgrade");
    }
    function wordpressinstallinput($o)
    {
$o->setInputFields(array(
    array( "TYPE" => "header", "LABEL" => "Plugin Options" ),
    array(
        "ID" => "plugina",
        "LABEL" => "Plugin A",
        "TEXT" => "Plugin A",
        "TYPE" => "check",
    ),
));
    }
    function drupalinstall($o)
    {
if ( isset($o->input["field_plugina"]) && $o->input["field_plugina"] === "1" )
{
    $o->extract("plugina","wp-content/plugins");
}
    }
    function drupalupgrade($o)
    {
// something to do at each upgrade
    }
}
?>


It registers an extra archive then adds three inserts. The first insert adds an extra input field to step 1 (you could add more inputs), and the second insert uses that value to decide whether it should extract the plugin.

The last insert could be used to run something after each upgrade, to handle the plugin.

--

I don't know about that "plugin groups' idea, but I'll keep it in mind.

Rowan

Re: Add extra installations to customized WP installers script?

Posted: Sun Mar 08, 2009 1:03 am
by donnacha
Wow, that was fast, thanks Rowan.

I should merge that with the existing code in my Customize installers code box, right?

And I should change the drupalinstall and drupalupgrade to wordpressinstall and wordpressupgrade, right?

Re: Add extra installations to customized WP installers script?

Posted: Sun Mar 08, 2009 1:19 am
by donnacha
Would something like this be about right?

I stuck my existing customizations in after the new arrays and extractions.

Also, I copied the plugin-relevant lines to create copycat theme-relevant lines but I wasn't sure how to create a B choice for either plugins or themes.

Code: Select all

    <?php
    class i_installer_customcode
    {
        function init()
        {
    $this->registerArchive("plugina", "http://www.something.com.au/Plugin_A.zip", "zip");
    $this->registerArchive("themea", "http://www.something.com.au/Theme_A.zip", "zip");
    $this->registerCustomCode("wordpress", "all", "install", 1, "init", "wordpressinstall");
    $this->registerCustomCode("wordpress", "all", "install", "last", "process", "wordpressinstall");
    $this->registerCustomCode("wordpress", "all", "upgrade", "last", "process", "wordpressupgrade");
        }
        function wordpressinstallinput($o)
        {
    $o->setInputFields(array(
        array( "TYPE" => "header", "LABEL" => "Plugin Options" ),
        array(
            "ID" => "plugina",
            "LABEL" => "Plugin A",
            "TEXT" => "Plugin A",
            "TYPE" => "check",
        ),
    ));

   $o->setInputFields(array(
        array( "TYPE" => "header", "LABEL" => "Theme Options" ),
        array(
            "ID" => "themea",
            "LABEL" => "Theme A",
            "TEXT" => "Theme A",
            "TYPE" => "check",
        ),
    ));
        }
        function wordpressinstall($o)
        {
    if ( isset($o->input["field_plugina"]) && $o->input["field_plugina"] === "1" )
    {
        $o->extract("plugina","wp-content/plugins");
    }
    if ( isset($o->input["field_themea"]) && $o->input["field_themea"] === "1" )
    {
        $o->extract("themea","wp-content/themes");
    }

//THE 5 LINES BELOW ARE FROM MY EXISTING CUSTOMIZATION

$o->write(".htaccess", "");
$o->chmod(".htaccess", 0666);
$o->write(".dont_disable_plugins", "please");
$o->rm("wp-content/plugins/hello.php");
$o->rm("wp-content/plugins/akismet/");

        }
        function wordpressupgrade($o)
        {
    // something to do at each upgrade
        }
    }
    ?>