Extension:ViewFiles
ViewFiles Release status: stable |
|||
---|---|---|---|
![]() |
|||
Implementation | Special page | ||
Description | Allows users to view the contents of a limited set of files made available by the system administrator. | ||
Author(s) | Nathan Larson (Leucostictetalk) | ||
Latest version | 1.1.0 (April 5, 2014 | )||
MediaWiki | 1.19+ | ||
PHP | 5,3+ | ||
Database changes | No | ||
License | GPL | ||
Download | |||
Example | meta.inclumedia.org | ||
|
|||
Translate the ViewFiles extension if it is available at translatewiki.net |
|||
Check usage and version matrix; code metrics |
The ViewFiles extension allows users to view the contents of a limited set of files made available by the system administrator. A possible use for this extension would be to enable your users to see the current contents of your configuration files (e.g. LocalSettings.php and InitialiseSettings.php) or customized skin files so that they could better assist with troubleshooting and make recommendations for configuration changes. Don't forget, if you're going to use this to display files such as LocalSettings.php that contain sensitive data, you'll want to get that data out of webroot before exposing those files to the world.
Contents
Installation[edit | edit source]
Download SyntaxHighlight_GeSHi[edit | edit source]
- Download the latest version of SyntaxHighlight GeSHi
- Create a folder in the extensions folder named SyntaxHighlight_GeSHi
- Move the files to the extensions/SyntaxHighlight_GeSHi/ folder
Download ViewFiles[edit | edit source]
- Download the latest version of ViewFiles
- Create a folder in the extensions folder named ViewFiles
- Move the files to the extensions/ViewFiles/ folder
Install SyntaxHighlight_GeSHi and ViewFiles[edit | edit source]
- Edit LocalSettings.php in the root of your MediaWiki installation, and add the following line near the bottom:
require_once("$IP/extensions/ViewFiles/ViewFiles.php"); require_once("$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php"); require_once("$IP/extensions/SyntaxHighlight_GeSHi/geshi/geshi.php");
See Extension:SyntaxHighlight_GeSHi#Default_Source_Language for information on how to set a default source language (optional; will not affect how files are displayed by ViewFiles).
Configuration[edit | edit source]
The only required configuration setting is $wgViewFilesFilePathList.
$wgViewFilesIntro[edit | edit source]
What to begin the page with; e.g.
$wgViewFilesIntro = "__FORCETOC__\n";
$wgViewFilesBegin[edit | edit source]
What to begin each file listing with; defaults to:
$wgViewFilesBegin = '<source lang="$1">' . "\n";
$wgViewFilesEnd[edit | edit source]
What to end each file listing with; defaults to:
$wgViewFilesEnd = '</source>' . "\n";
$wgViewFilesFileLangList[edit | edit source]
This list of filenames and associated languages overrides GeSHi's extension lookup. Defaults to:
$wgViewFilesFileLangList = array ( '.htaccess' => 'apache', 'robots.txt' => 'robots', );
$wgViewFilesFilePathList[edit | edit source]
Create a list of files and their paths, e.g.:
$wgViewFilesPathList = array( 'LocalSettings.php' => "$IP/LocalSettings.php", 'robots.txt' => "$IP/../robots.txt" );