Version: v0.0.0-...-ca42c0b Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2021 License: ISC Imports: 5 Imported by: 0



Package mediawiki provides access to MediaWiki installations to Go web servers via CGI.



View Source
const (
	// Default PHP script to execute, if unspecified by the HTTP request.
	DirIndex = "index.php"

	// Default PHP CGI binary
	PHPExe = "php-cgi"

	// only execute PHP code from these directories (relative to
	// the mediawiki installation directory), but not from their
	// children.
	PHPWhitelistDirs = "/"

	// only serve static assets from these directories (relative
	// to the mediawiki installation directory) and from their
	// children, recursively.
	AssetWhitelistDirsRecursive = "/resources:/skins"


This section is empty.


func New

func New(root, urlprefix, php string) http.Handler

New returns a new HTTP handler that serves the mediawiki installed at root using the PHP CGI executable specified by php. The handler should be installed at urlprefix.


type MediaWiki

type MediaWiki struct {
	Root      string // directory containing Mediawiki files
	URLPrefix string // the URL prefix used for accessing the wiki
	PHPExe    string // php-cgi executable

	// see the constants with the same name for a description of
	// these fields.
	PHPWhitelistDirs            []string
	AssetWhitelistDirsRecursive []string

A *MediaWiki is an http.Handler that serves a mediawiki instance.

func (*MediaWiki) ServeHTTP

func (mw *MediaWiki) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.



  • After install, the server still allows access to the installer until restart.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto