internal package Foswiki::Configure::Util

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

StaticMethod mapTarget($root, $file )

Map a standard filename from the default paths to any alternate file locations defined in $Foswiki::cfg. Adjust for changes in directory names and also Web names. The following mapping is performed:

Web names

Topic Names

  • NotifyTopicName
  • HomeTopicName
  • WebPrefsTopicName

Directory locations

  • DataDir
  • PubDir
  • WorkingDir
  • TemplateDir
  • ToolsDir
  • LocalesDir
  • ScriptDir


  • ScriptSuffix
  • MimeTypesFileName

StaticMethod getMappedWebTopic( $file )

Extract a mapped Web,TopicName from the default path from a topic in the manifest. (Works for topics, not attachments)

Returns ($web, $topic)

Web names

Topic Names

  • NotifyTopicName
  • HomeTopicName
  • WebPrefsTopicName

StaticMethod createArchive($name, $dir, $delete )

Create an archive of the passed directory.
  • $name is the directory to be backed up and the filename of the archive to be created. $name will be given a suffix of the backup type - depends on what type of backup tools are installed.
  • $dir is the root directory of the backups - typically the working/configure/backup directory
  • $delete - set if the directory being backed up should be deleted after archive is created.

StaticMethod unpackArchive($archive [,$dir] )

Unpack an archive. The unpacking method is determined from the file extension e.g. .zip, .tgz. .tar, etc. If $dir is not given, unpack to a temporary directory, the name of which is returned.

StaticMethod listDir($dir, [$dflag], [$path] )

Recursively list the files in directory $dir. Optional $dflag can be set to 1 to cause the list to exclude the directory names from the list.

If $path is used internally for the recursive directory list. It is appended to the Directory. The list of files in @names is relative to the $dir directory. Subroutine called recursively for each subdirectory encountered.

StaticMethod getPerlLocation( )

This routine will read in the first line of the bin/configure script and recover the location of the perl interpreter.

Optional parameter is file used to retrieve the shebang. If not specified, defaults to the configure script

StaticMethod rewriteShebang($file, $newShebang )

This routine will rewrite the Shebang line of the target script with the specified script name.

Topic revision: r1 - 19 Apr 2011, ProjectContributor
This site is powered by FoswikiCopyright © CC-BY-SA by the contributing authors. All material on this collaboration platform is copyrighted under CC-BY-SA by the contributing authors unless otherwise noted.
Ideas, requests, problems regarding Foswiki? Send feedback