4 * Copyright (C) 2010 Olaf Lenz
6 * This file is part of FusionForge.
8 * FusionForge is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * FusionForge is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 /** This script will set up the structure required to use the
27 require_once dirname(__FILE__) . '/../../../www/env.inc.php';
28 require_once $gfcommon.'include/pre.php';
30 $echo_links = $argc >= 1;
32 $master_path = forge_get_config('master_path', 'mediawiki');
33 $projects_path = forge_get_config('projects_path', 'mediawiki');
34 $src_path = forge_get_config('src_path', 'mediawiki');
37 if (!is_dir($projects_path)) {
38 echo "Creating $projects_path...\n";
39 mkdir($projects_path, 0755, true);
40 chmod($projects_path, 0755);
43 if (!is_dir($master_path)) {
44 echo "Creating $master_path...\n";
45 mkdir($master_path, 0755, true);
46 chmod($master_path, 0755);
49 function mysymlink($from, $to) {
51 if (!@symlink($from, $to)) {
52 echo "Could not create symbolic link from $from to $to.\n";
60 # install links in master
61 echo "Creating symlinks from $master_path to $src_path...\n";
62 if (!($dh = opendir($src_path))) {
63 echo "Could not open mediawiki source directory $src_path!\n";
74 while ($file = readdir($dh)) {
75 if (!isset($ignore_file[$file]) || !$ignore_file[$file]) {
76 $from = "$src_path/$file";
77 $to = "$master_path/$file";
78 mysymlink($from, $to);
84 // link LocalSettings.php from forge_get_config('source_path')/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php
85 $from = forge_get_config('source_path')."/plugins/mediawiki/www/LocalSettings.php";
86 $to = "$master_path/LocalSettings.php";
87 mysymlink($from, $to);
89 // create skin directory
90 $todir = "$master_path/skins";
91 if (!is_dir($todir)) {
95 // link FusionForge skin file
96 $fromdir = forge_get_config('source_path')."/plugins/mediawiki/mediawiki-skin";
97 $from = "$fromdir/FusionForge.php";
98 $to = "$todir/FusionForge.php";
99 mysymlink($from, $to);
101 // create skin subdir
102 $todir = "$todir/fusionforge";
106 // link fusionforge.css files
107 $fromdir = "$fromdir/fusionforge";
108 $from = "$fromdir/fusionforge.css";
109 $to = "$todir/fusionforge.css";
110 mysymlink($from, $to);
112 // link the rest of the files from monobook skin
113 $fromdir = "$src_path/skins/monobook";
115 $dh = opendir($fromdir);
116 $ignore_file = array(
120 while ($file = readdir($dh)) {
121 if (!isset($ignore_file[$file]) || !$ignore_file[$file]) {
122 $from = "$fromdir/$file";
123 $to = "$todir/$file";
124 mysymlink($from, $to);
131 // c-file-style: "bsd"