Tuesday, March 24, 2009

Joomla Drive Letters on a USB

Joomla and Hard-Coded Drive Letters

We have been using USB sticks running XAMPP which have worked well. Now that we installed joomla we note that the global configuration and joomlapack use absolute paths that include drive letters.

This poses a problem in that the drive letter on a pc can range from D: on machines with no optical to E or F: if the optical is listed as 2 drives to J: on my home machine. In fact, i plugged into the same machine after lunch and the assigned letter is now G: instead of the F: it was before lunch!

The ultimate solution would be relative paths based on xampp as the top level directory. We need to investigate this option!

So now we have the perfect test case - the xampp stick has been assigned G: instead of F: so let's see what happens.

We select Site, Global Configuration and note the settings:

F:\xampp\htdocs\joomla\logs
F:\xampp\htdocs\joomla\tmp

Our thesis is that installing an extension should fail. Let's test it out with a calendar events module.

Select Extensions, Install/Uninstall
Browse to mod_events_cal_1.4.2-1.zip and click Install
As expected we get this error:
  • JFolder::create: Infinite loop detected
  • Warning! Failed to move file.
Now let's change the global configuration to use the G: drive letter currently assigned by windows.

Off to Site, Global Configuration and note the settings:

F:\xampp\htdocs\joomla\logs
F:\xampp\htdocs\joomla\tmp

Click Save and now we try to install the same extension. Unfortunately we get:
Your Extension appears to be written for an older version of Joomla!. You must enable the System - Legacy Plugin in the Plugin Manager if you wish to complete this task.
Makes you wonder is some that list themselves as 1.5 versions are really not. So let's try another. We try com_avreloaded-1.2.4.zip and this time the script executes. It's a big sucker and i'm worried about it exceeding the 240 seconds max time. Success!
  • SubInstall: Successfully installed plugin " AllVideos Reloaded Plugin ".
  • SubInstall: Successfully installed plugin " AllVideos Reloaded Editor Button ".
  • SubInstall: Successfully installed plugin " AllVideos Reloaded System Plugin ".
  • SubInstall: Successfully installed module " AllVideos Reloaded Module ".
  • Install Component Success
This extension provides a nice quickstart intro text after it installs:

Before inserting local media, first use Joomla's media manager to create two folders named audio and videos in your images/stories folder. Then, use Joomla's media manager to upload your media there. If this does not work initially, you might have to change Joomla's global settings in order to allow upload of other files than just images.

While editing your content, use the new AVR Media button at the bottom of the editor window for inserting media. To embed remote videos from a video sharing site, in the dialog that opens, simply paste the URL of the page displaying the video into the first field, then hit RETURN to start the auto-recognition. If the URL is supported, the rest of the form will be completed automatically. The last field shows the media tag, which can be edited to add custom attributes. Finally, hit the Insert button and the content of this field will be inserted at the current cursor position in the editor.

To insert local media, use the same AVR Media button, but select the Local Media tab. There, you can select one of the previously uploaded media files. After selection of a media file, the rest of the fields should be filled automatically.

For more information - especially before using the advanced features of the component views -, please read the included documentation. Even though AllVideos Reloaded is trying hard to make it easy for you, embedding multi media is a complex matter. For getting the most out of your media, reading documentation is a must. You can invoke the documentation at any time in the plugin description of the Content - AllVideos Reloaded plugin or by clicking the Help button in one of the AllVideos Reloaded component views.
The Demo site provides a collection of useful examples too.

Ok - we have proved that the common 'infinite loop' extensions problem is a path issue and that the drive letter can be changed ok as you move from pc to pc with your gpysy web server.

Let's try another - the google maps module which is also big but it errors with:
Your Extension appears to be written for an older version of Joomla!. You must enable the System - Legacy Plugin in the Plugin Manager if you wish to complete this task.
Actually, this illustrates one of the problems of extensible designs common with open-source programs. While they spur innovation by lessing the barriers to new functionality, they inhibit upgrading to new versions as upgrades may break useful or essential 3rd party modules. You cannot guarantee all 3rd party modules will run in the new version without doing an install of the new version and testing and in fact, some modules will never run with newer versions as the authors may not update them. The joomla project team recognizes this paradox by providing a 'legacy mode' for older 3rd party modules - which i have not tested yet.

One last test - can we delete the drive letter and have just a directory path? Let's try it out.

Select Site, Global Configuration
Change the log file and temp file paths to:

\xampp\htdocs\joomla\logs
\xampp\htdocs\joomla\tmp

and click SAVE. Let's try ContentTemplater-v0.4.4.zip. The script runs but generates this error:
It was not possible to delete the selected file.: 'nl-NL.com_nonumber-installer.ini'
but then we also get:
Content Templater (component & editor button) has been installed successfully
and it shows up in the Components menu so it worked. So drive letters can be removed after install and Joomla still functions. Woo woo!

The other thing to change is the joomlapack configuration setting as that is also hard-coded.

Select Components, Joomlapack and this error is displayed:
Detected errors prohibit intended operation
The status tab shows Output directory unwritable which makes sense as drive F: no longer exists, we are now assigned G: as a letter. Stupid drive letters, so 1980's.

Click Configuration and change the Output Directory from F:\xampp\backup to \xampp\backup and click SAVE. Success! we see the message:
JoomlaPack is ready to backup your site
This means that for everything we install we need to delete the current drive letter in the install and SAVE. We check the configuration.php file and see:

var $log_path = '\\xampp\\htdocs\\joomla\\logs';
var $tmp_path = '\\xampp\\htdocs\\joomla\\tmp';

Big Idea for Classes

This gives me an idea - one could set up a pre-defined joomla site with certain extensions installed and configured such as the editor, explorer and backup etc and then backup the site and upload the backup to the course web site. Students could then download and restore the backup so everyone would be starting from the same point. It would be possible to have multiple different backups made for different purposes such as the web programming course or the web usability course or the digital libraries course even the young adults web site evaluation assignment. In fact, if it is possible to create a USB environment and then mass duplicate it so that each student in the class gets a pre-configured stick (with the FIMS logo on it).

ToDo:

Fix Allvideos problem
Fix the JCE editor problem and test the Paste From Word function
Copy the joomla/xampp content from LIS9710 to here to preserve the record of this project

No comments: