Google Groups

Re: Installing media files when installing extension (1.6 feature)


Louis Landry Feb 21, 2009 8:30 AM
Posted in group: Joomla! CMS Development
Yes.

This is a stepwise move towards a multi-site system where we have more centralized media folders for all media and can place code files underneath document root.  For example, you cannot place the components/ folder underneath document root right now because in a lot of cases it serves images or javascript files or css files.  If all of those media files were contained in the media folder then you could quite easily move the code folders out of the exposed web space thus creating a potentially safer environment.

Also, using a centralized media folder will allow us to more easily transition to a multi-site per code-base instance in the future.

That is the idea.  We aren't completely there yet, but that doesn't mean we shouldn't be making stepwise moves in that direction.

- Louis

On Sat, Feb 21, 2009 at 10:25 AM, elin <elin....@gmail.com> wrote:

Is the idea that extensions would normally put their media in the
media folder?

Elin

On Feb 19, 12:31 pm, Rob Schley <rob.sch...@community.joomla.org>
wrote:
> I believe part of the idea behind the media tag not allowing you to install
> things outside of the media folder was that we want to consolidate all media
> (images, JS, css, etc.) into the media folder (though probably broken out
> into subfolders from there). Obviously, we couldn't do this in 1.5 for a
> number of backwards compatibility reasons but things should be much more
> consolidated in 1.6 now that we've had the opportunity to remove the legacy
> media.
> Rob
>
> On Sat, Feb 14, 2009 at 12:38 PM, infograf768 <infograf...@gmail.com> wrote:
>
> > In 1.5 we have no choice if using the tag <media> when installing an
> > extension.
> > It will install any media file in the media folder.
>
> > The example on docs is
> > <media destination="com_test">
> >                <filename>image.png</filename>
> >                <filename>flash.swf</filename>
> > </media>
> > This would install the 2 files in media/com_test/
> > If no destination defined, then the files will go directly in the
> > media folder.
>
> > This due to the code in installer.php to install such files:
> > in function parsemedia(), line 780-781
> > we have
> > $folder = ($element->attributes('destination')) ? DS.$element-
> > >attributes('destination') : null;
> >                $destination = JPath::clean(JPATH_ROOT.DS.'media'.$folder);
>
> > and to uninstall in function removeFiles() line 1002 +
> > case 'media':
> >                                if ($element->attributes('destination')) {
> >                                        $folder =
> > $element->attributes('destination');
> >                                } else {
> >                                        $folder = '';
> >                                }
> >                                $source =
> > $client->path.DS.'media'.DS.$folder;
> >                                break;
>
> > This has 2 drawbacks:
> > 1. 3pd has no choice if they want use that <media> tag to install in
> > the "images" folder for example instead of  "media"
> > 2. Even when not using that tag, i.e. when the 3 pd wants to install
> > its media in the extension folder, these files are quite lost in the
> > long list of
> > <files>
> >                <filename>index.html</filename>
> >                <filename>images/image.png</filename>
> >                etc.
> >        </files>
> > Using the <media> tag would be cleaner.
>
> > One solution could be to force a "destination" in any install by
> > changing the paths above to
> > $destination = JPath::clean(JPATH_ROOT.DS.$folder);
> > and
> > $source = $client->path.DS.$folder;
>
> > If done then we may have to forbid the installation if the tag
> > "destination="whatever" is empty or absent.
>
> > The xmls would look like this
> > <media destination="images/stories/com_test"> // where "images" can be
> > "media" if desired.
> >                <filename>image.png</filename>
> >                <filename>flash.swf</filename>
> > </media>
> > or in the extension
> > <media destination="administrator/components/com_test/images">
> >                <filename>image.png</filename>
> >                <filename>flash.swf</filename>
> > </media>
> > or in Root
> > <media destination="comtestmedia">
> >                <filename>image.png</filename>
> >                <filename>flash.swf</filename>
> > </media>




--
Development Coordinator
Joomla! ... because open source matters.
http://www.joomla.org