Difference between revisions of "Extension:Backup.php"

From Organic Design wiki
(interface to backup.pl)
 
(comments for execute() todo)
Line 35: Line 35:
 
global $wgOut;
 
global $wgOut;
 
$title = Title::makeTitle(NS_SPECIAL,'Backups');
 
$title = Title::makeTitle(NS_SPECIAL,'Backups');
$wgOut->addWikiText(wfMsg('example-message','exampleParameter'));
+
 
$wgOut->addHTML(
+
# create a sortable table for all wiki's found and accessible in mysql
wfElement('form',array('action' => $title->getLocalURL('action=submit'),'method' => 'post'),null)
+
# - each row has: name,domains,dir,db,prefix,active,backup-hrs,delete,backup,version
. '<textarea name="target" cols=25 rows=10></textarea>'
+
 
. wfElement('input',array('type' => 'submit'))
+
# create a sortable table of all backup files
. '</form>'
+
# - each row has same cols as above +backup-filename -backup -delete
);
+
 
 +
# add list of backup.pl job queue (and link to MW log of completed items)
 +
 
 
}
 
}
  

Revision as of 09:25, 9 June 2007

<?php

  1. Extension:Backups
Info.svg These are the MediaWiki extensions we're using and/or developing. Please refer to the information on the mediawiki.org wiki for installation and usage details. Extensions here which have no corresponding mediawiki article are either not ready for use or have been superseded. You can also browse our extension code in our local Subversion repository or our GitHub mirror.

Template:Php

  1. - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
  2. - Author: User:NadCategory:Extensions created with Template:SpecialPage
  3. - Started: 2007-06-09
  4. - 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";

  1. 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');

# create a sortable table for all wiki's found and accessible in mysql # - each row has: name,domains,dir,db,prefix,active,backup-hrs,delete,backup,version

# create a sortable table of all backup files # - each row has same cols as above +backup-filename -backup -delete

# add list of backup.pl job queue (and link to MW log of completed items)

}

}

  1. 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()); } ?>