Friday, May 19, 2006

Scripting: File Queue

I created a sister script to my file queue script that allows anyone editing a file on the development site to queue that file for upload to the live site. This is should ease the development process a little as it allows the communications staff to create/edit a page and queue it for upload without any involvement from me or the rest of the technology staff.

In order to make the script as easy as possible to use I made some modifications.
  1. The script checks the referrer page to determine what file to upload. No user input necessary.
  2. I created a loop to ensure that the destination directory(ies) exist so no copy errors are encountered.
  3. I added a RegEx that filters the body for image tags, grabs the src attribute, and uploads those images as well.
I copied the folder creation updates back to my original script so that I don't have to worry about creating those prior to uploading a file.

I may make a further modification to the original script that uses a RegEx to grab all externally referenced files. These would then be presented back in a selection list to the user. This will make it easier to queue a page because I won't have to queue each individual element of the page separately.