Extension:Git2Pages

From MediaWiki.org
Jump to: navigation, search
Warning Warning: All versions of Git2Pages before 1.1.1, are vulnerable to directory traversal and remote code execution attacks, which could lead into compromisation of your wiki/server. We strongly recommend you to update your copy of Git2Pages to 1.1.1. The tarballs of Special:ExtensionDistributor will be updated as soon as possible, the REL1_23, REL1_24, REL1_25 and master branches of the git repo of Git2Pages already include the security fix.


MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
Git2Pages

Release status:Extension status experimental

ImplementationTemplate:Extension#type Parser extension, Tag, Database
DescriptionTemplate:Extension#description Allow wiki pages to include code from a git repository.
Author(s)Template:Extension#username Teresa Cho (original author)
Dereckson (maintenance)
Contributions by others
Latest versionTemplate:Extension#version 1.1.1 (2015-09-10)
PHPTemplate:Extension#php 5.3+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
ParametersTemplate:Extension#parameters
  • $wgGit2PagesDataDir
Hooks usedTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit

Translate the Git2Pages extension if it is available at translatewiki.net

Check usage and version matrix.

IssuesPhabricator

Open tasks · Report a bug

The Git2Pages extension implements a parser tag so you can transclude snippets of files in a git repository into wiki pages. To do so it executes git commands to clone a repository locally and then reads files from disk.

Usage[edit]

{{#snippet:repository=MYREPO|filename=MYFILE|branch=MYBRANCH|startline=STARTLINE|endline=ENDLINE}} The parameters are:

  • repository - The URL of the git repository. REQUIRED
  • filename - The filename whose data is going to be displayed. REQUIRED
  • branch - The branch to look for the file. OPTIONAL (Default = master)
  • startline - The start of where the snippet will be pulled. OPTIONAL (Default = Start of file)
  • endline - The end of where the snippet will be pulled. OPTIONAL (Default = End of file)

Requirements[edit]

This extension uses wfShellExec() to run shell commands that probably require the bash shell.

Installation[edit]

  • Download and place the file(s) in a directory called Git2Pages in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'Git2Pages' );
    
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'Git2Pages' );, you need to use:

require_once "$IP/extensions/Git2Pages/Git2Pages.php";

See also[edit]