--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/_G8Yd4m_yaUJ.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.
On Thu, Mar 29, 2012 at 6:25 PM, Gabi <gabi....@gmail.com> wrote:
> Hi,
>
> Two questions:
> 1 .I have a Joomla 2.5 component with a script.php file that is run on
> installation.
> Is there a way to test/develop this script other than installing the
> component over and over again?
I have a CLI script that I've been working on:
https://github.com/pasamio/joomla-cli-apps/tree/master/installer
You need to put it in the CLI directory of your target Joomla! install
and you can run it from there and point it at either a prebuilt
package or a directory structure matching a prebuilt package
(typically I use the package layout for my directories). It will
output the installer message and the extension message if you have any
set. I just realised it will not output something that was added to
the message queue at this stage though that could be added.
>
> 2. What is the proper way to include a file in this script? I have a class
> that is stored in a different file that I would like to use. I suppose that
> when postflight() is run the component is installed and I could include this
> file, right?
You can grab the files from the source directory at any point. The
filesystem cleanup is done after post flight dependent upon
installation method, directory installs obviously don't get touched
but web and uploaded have where it was extracted temporarily for the
full life of the installer hooks. Additionally both install and post
flight are run after your extension has been copied to it's target
destination.
Postflight is effectively for stuff you don't particular care about
failing, setting redirects and what not. Install is where you can
abort if you detect an issue processing the install for what ever
reason. Update is a bit tricky because we don't have pre-update
automated extension backups so when do an update you shouldn't
typically abort the update. Maybe in a future release we'll do
automatic extension backups (it's something I'd like to see).
Preflight is more intended for any ahead of time checks before
anything has been copied or SQL applied (an uploaded package has been
extracted obviously) and you can abort the install.
Cheers,
Sam Moffatt
http://pasamio.id.au
Cheers,
Sam Moffatt
http://pasamio.id.au