MediaWiki  1.23.12
importImages.inc File Reference

Support functions for the importImages.php script. More...

Go to the source code of this file.

Functions

 findAuxFile ( $file, $auxExtension, $maxStrip=1)
 Find an auxilliary file with the given extension, matching the give base file path. More...
 
 findFiles ( $dir, $exts, $recurse=false)
 Search a directory for files with one of a set of extensions. More...
 
 getFileCommentFromSourceWiki ( $wiki_host, $file)
 
 getFileUserFromSourceWiki ( $wiki_host, $file)
 
 splitFilename ( $filename)
 Split a filename into filename and extension. More...
 

Detailed Description

Support functions for the importImages.php script.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Author
Rob Church robch.nosp@m.ur@g.nosp@m.mail..nosp@m.com
Mij mij@b.nosp@m.itch.nosp@m.x.it

Definition in file importImages.inc.

Function Documentation

◆ findAuxFile()

findAuxFile (   $file,
  $auxExtension,
  $maxStrip = 1 
)

Find an auxilliary file with the given extension, matching the give base file path.

$maxStrip determines how many extensions may be stripped from the original file name before appending the new extension. For example, with $maxStrip = 1 (the default), file files acme.foo.bar.txt and acme.foo.txt would be auxilliary files for acme.foo.bar and the extension ".txt". With $maxStrip = 2, acme.txt would also be acceptable.

Parameters
$filestring base path
$auxExtensionstring the extension to be appended to the base path
$maxStripint the maximum number of extensions to strip from the base path (default: 1)
Returns
string or false

Definition at line 86 of file importImages.inc.

References $f, $file, and $n.

◆ findFiles()

findFiles (   $dir,
  $exts,
  $recurse = false 
)

Search a directory for files with one of a set of extensions.

Parameters
$dirstring Path to directory to search
$extsArray of extensions to search for
$recurseBool Search subdirectories recursively
Returns
mixed Array of filenames on success, or false on failure

Definition at line 34 of file importImages.inc.

References $dir, $ext, $file, $files, array(), list, and splitFilename().

◆ getFileCommentFromSourceWiki()

getFileCommentFromSourceWiki (   $wiki_host,
  $file 
)

Definition at line 114 of file importImages.inc.

References $file, $matches, and Http\get().

◆ getFileUserFromSourceWiki()

getFileUserFromSourceWiki (   $wiki_host,
  $file 
)

Definition at line 124 of file importImages.inc.

References $file, $matches, and Http\get().

◆ splitFilename()

splitFilename (   $filename)

Split a filename into filename and extension.

Parameters
$filenamestring Filename
Returns
array

Definition at line 64 of file importImages.inc.

References $ext, $fname, and array().

Referenced by findFiles().