UpdateAttachmentsPlugin

A batched alternative to AutoAttachments (adds and removes attachments)

Usage

This plugin provides a rest handler that can replace the inbuilt {AutoAttachPubFiles} functionality with a batched update - so you can upload (ftp, drag&drop etc) thousands of images into Foswiki's pub area, and then tell Foswiki to update the attachments to all your topics.

This will allow you to SEARCH for attachments, use DBCacheContrib & DBCachePlugin, and use any other functionality that relies on the topic files containing references to the attachments.

Doing this may provide a speed advantage as it will remove the need for Foswiki to scan the requested topics' attachment directory.

Also, it will (optionally) remove attachment references to files that no longer exist in the topic's attachment directory.

Warning: because Foswiki does not deal well with attachments with special characters (or even spaces) in them, these files will be ignored on update.

Warning: checking 28500 topics (many with attachments) takes around 2-3 minutes on my test system, with no plugins that have an beforeSave or afterSave handler registered.

Triggering an Attachment Update

As this is a RestHandler? based plugin, you can trigger it to run from a suitably authenticated URL (it will only update topics your user as permission to edit) - for example, to update the Sandbox web Or using a cronjob - make sure the cronjob is running as the same user as Foswiki's web access is
  • ./rest UpdateAttachmentsPlugin.update topic Sandbox.WebHome
  • ./rest /UpdateAttachmentsPlugin/update -topic Sandbox.WebHome -user AdminUser
(if you get a 500 or premature end of script error, chances are your current user does not have permission to change the web or topics)

Settings

These settings are in the configure web interface in the Update Attachments Plugin section of configure.
  • $Foswiki::cfg{Plugins}{UpdateAttachmentsPlugin}{AttachAsUser} - defaults to the unknown user. To reset the attributed user for attachments that already exist, touch the files in the attachment directory.
  • $Foswiki::cfg{Plugins}{UpdateAttachmentsPlugin}{RemoveMissing} - will remove attachment references in a topic that no longer exist
  • $Foswiki::cfg{Plugins}{UpdateAttachmentsPlugin}{Debug} - to see what topics are updated (edit LocalSite? .cfg by hand to add this setting).
It is recommended to disable $Foswiki::cfg{AutoAttachPubFiles}.

Installation Instructions

This plugin may not function correctly if $Foswiki::cfg{AutoAttachPubFiles} is on, predominantly on the WebHome and WebPreferences topics.

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.

Plugin Info

Plugin Author(s): Foswiki:Main.SvenDowideit - http://fosiki.com a wikiringlogo20x20.png WikiRing founding partner
Foswiki:Main.GeorgeClark - revised for Foswiki 1.1
Copyright: © 2008-2009 SvenDowideit@fosiki.com
© 2010 Foswiki Contributors
Attachment Icon based on eXperience Crystal, by David Christian Berg
License: GPL 3 (Gnu General Public License)
Plugin Version: 11464 (2011-04-15)
Plugin Release: 2.0.2
Change History:
2.0.2: Foswikitask:Item10630: Config.spec really is necessary
2.0.1: Foswikitask:Item10630: remove unnecessary files from manifest
2.0: Foswikitask:Item10196: correctly handle dot prefixed files
2.0rc: Foswikitask:Item9322: Update for version 1.1 of Foswiki
20 Feb 2009: Port to Foswiki
December 2007: add AttachAsUser?
November 2007: Initial release
Dependencies: None
Plugin Home: http://foswiki.org/Extensions/UpdateAttachmentsPlugin
Related Topics: Plugins, DeveloperDocumentationCategory, AdminDocumentationCategory, DefaultPreferences, SitePreferences

PackageForm edit

ExtensionClassification Data and Files, User interactivity
ExtensionType PluginPackage
Compatibility Foswiki 1.1.x Not tested on Foswiki 1.0.x. Use the 20 Feb 2009 release for Foswiki 1.0 if needed.
ImageUrl
DemoUrl http://
SupportUrl UpdateAttachmentsPlugin
DevelopedInSVN Yes
ModificationPolicy CoordinateWithAuthor
Topic attachments
I Attachment Action Size Date Who Comment
UpdateAttachmentsPlugin.md5md5 UpdateAttachmentsPlugin.md5 manage 0.2 K 15 Apr 2011 - 03:14 GeorgeClark  
UpdateAttachmentsPlugin.sha1sha1 UpdateAttachmentsPlugin.sha1 manage 0.2 K 15 Apr 2011 - 03:15 GeorgeClark  
UpdateAttachmentsPlugin.tgztgz UpdateAttachmentsPlugin.tgz manage 43.3 K 15 Apr 2011 - 03:14 GeorgeClark  
UpdateAttachmentsPlugin.zipzip UpdateAttachmentsPlugin.zip manage 46.4 K 15 Apr 2011 - 03:14 GeorgeClark  
UpdateAttachmentsPlugin_installerEXT UpdateAttachmentsPlugin_installer manage 4.3 K 15 Apr 2011 - 03:14 GeorgeClark  
wikiring-attach.pngpng wikiring-attach.png manage 33.5 K 15 Apr 2011 - 03:14 GeorgeClark  
wikiringlogo20x20.pngpng wikiringlogo20x20.png manage 1.3 K 15 Apr 2011 - 03:14 GeorgeClark  
Topic revision: 14 Feb 2012, ValentinKozlov
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons LicenseGet Foswiki at sourceforge.net. Fast, secure and Free Open Source software downloads