Extension:Backup.php
<?php
- Extension:Backups
- - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
- - Author: User:NadCategory:Extensions created with Template:SpecialPage
- - Started: 2007-06-09
- - This is a SpecialPage which acts as an in-wiki interface to backup.pl which reduces the backup/compress/distribute queue
if (!defined('MEDIAWIKI')) die('Not an entry point.');
define('BACKUPS_VERSION','0.0.0, 2007-06-09');
$wgExtensionFunctions[] = 'wfSetupBackups';
$wgExtensionCredits['specialpage'][] = array( 'name' => 'Special:Backups', 'author' => 'User:Nad', 'description' => 'A special page for backing up and restoring multiple wikis on a server', 'url' => 'http://www.organicdesign.co.nz/Extension:Backup_&_Restore', 'version' => BACKUPS_VERSION );
require_once "$IP/includes/SpecialPage.php";
- Define a new class based on the SpecialPage class
class SpecialBackups extends SpecialPage {
# Constructor function SpecialSearchLog() { SpecialPage::SpecialPage('Backups','sysop'); }
# Override SpecialPage::execute() # - $param is from the URL, eg Special:Backups/param function execute($param) { global $wgOut; $title = Title::makeTitle(NS_SPECIAL,'Backups'); $wgOut->addWikiText(wfMsg('example-message','exampleParameter')); $wgOut->addHTML( wfElement('form',array('action' => $title->getLocalURL('action=submit'),'method' => 'post'),null) . '<textarea name="target" cols=25 rows=10></textarea>' . wfElement('input',array('type' => 'submit')) . '</form>' ); }
}
- Called from $wgExtensionFunctions array when initialising extensions
function wfSetupBackups() { global $wgLanguageCode,$wgMessageCache;
# Add the messages used by the specialpage if ($wgLanguageCode == 'en') { $wgMessageCache->addMessages(array( 'backups' => 'Backup & restore wikis', 'exampleMessage' => "Example message: $1", )); }
# Add the specialpage to the environment SpecialPage::addPage(new SpecialBackups()); } ?>



