aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mediawiki/files/init_wiki.php
blob: da1d46f5b5b8e25a7d436388fe6435db5465ef46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?
$wiki_root = $argv[1];
$mw_root = '/usr/share/mediawiki';

if (!is_dir("$wiki_root/config")) {
    exit(1);
}

// DefaultSettings.php complain if not defined
define('MEDIAWIKI',1);

require_once("$mw_root/includes/Defines.php");
require_once("$mw_root/includes/AutoLoader.php");
require_once("$mw_root/includes/GlobalFunctions.php");
include("$wiki_root/LocalSettings.php");

$dbclass = 'Database'.ucfirst($wgDBtype);
$wgDatabase = new $dbclass($wgDBserver, 
			$wgDBuser, 
			$wgDBpassword, $wgDBname, 1);
	
$wgDatabase->initial_setup($wgDBpassword, $wgDBname);
$wgDatabase->setup_database();

$dir = "$wiki_root/config";
foreach (scandir($dir) as $item) {
        if (!is_dir($item) || is_link($item))
                unlink($item); 
}
rmdir("$dir");
?>