}
if (forge_check_global_perm ('approve_projects')) {
- $res = db_query_params("SELECT count(*) AS count FROM groups WHERE status='P'",array());
+ $res = db_query_params('SELECT count(*) AS count FROM groups
+ WHERE group_id > 4
+ AND status = $1
+ AND register_time > 0
+ AND is_template = 0',
+ array('P'));
$row = db_fetch_array($res);
$pending_projects = $row['count'];
--- /dev/null
+#!/bin/mksh
+#-
+# MediaWiki Plugin full dump/restore for FusionForge
+#
+# Copyright © 2013
+# Thorsten “mirabilos” Glaser <t.glaser@tarent.de>
+# All rights reserved.
+#
+# This file is part of FusionForge. FusionForge is free software;
+# you can redistribute it and/or modify it under the terms of the
+# GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the Licence, or (at your option)
+# any later version.
+#
+# FusionForge is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with FusionForge; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#-
+# Dumps all pages of a FusionForge MediaWiki plugin project, with their
+# complete history, plus all images and other files, into a tarball to
+# be imported into another wiki by mw-fullrestore.
+
+if [[ $# != 1 || $1 = *@([ ])* || -e $1.fulldump || \
+ ! -d /var/lib/gforge/plugins/mediawiki/wikidata/$1/images/. ]]; then
+ print -u2 'Syntax: mw-fulldump projectname'
+ exit 255
+fi
+
+wd=$PWD
+set -x
+set -e
+rm -rf "/var/lib/gforge/plugins/mediawiki/wikidata/$1/fulldump"
+mkdir "/var/lib/gforge/plugins/mediawiki/wikidata/$1/fulldump"
+cd "/var/lib/gforge/plugins/mediawiki/wikidata/$1/fulldump"
+/usr/share/gforge/plugins/mediawiki/bin/mw-wrapper.php "$1" \
+ dumpUploads.php >mf1.txt
+sed \
+ "s\ 1mwstore://local-backend/local-public\ 1/var/lib/gforge/plugins/mediawiki/wikidata/$1/images\ 1" \
+ <mf1.txt >mf2.txt
+mkdir mfi
+if [[ -s mf2.txt ]]; then
+ ln $(<mf2.txt) mfi/
+fi
+/usr/share/gforge/plugins/mediawiki/bin/mw-wrapper.php "$1" \
+ dumpBackup.php --full >df.xml
+rm -f mf?.txt
+cd ..
+paxtar -M dist -czf "$wd/$1.fulldump" fulldump
+rm -rf fulldump
+exit 0
--- /dev/null
+#!/bin/mksh
+#-
+# MediaWiki Plugin full dump/restore for FusionForge
+#
+# Copyright © 2013
+# Thorsten “mirabilos” Glaser <t.glaser@tarent.de>
+# All rights reserved.
+#
+# This file is part of FusionForge. FusionForge is free software;
+# you can redistribute it and/or modify it under the terms of the
+# GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the Licence, or (at your option)
+# any later version.
+#
+# FusionForge is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with FusionForge; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#-
+# Restores all pages and images from a file stored by mw-fulldump.
+# Passing not a file generated by mw-fulldump is Undefined Behaviour.
+#
+# Existing pages and files in the wiki will not be deleted; existing
+# pages with same names as those in the dump will be overwritten I guess.
+
+if [[ $# != 2 || $1 = *@([ ])* || ! -s $2 || \
+ ! -d /var/lib/gforge/plugins/mediawiki/wikidata/$1/images/. ]]; then
+ print -u2 'Syntax: mw-fullrestore tgtprojectname src.fulldump'
+ exit 255
+fi
+
+set -x
+set -e
+rm -rf "/var/lib/gforge/plugins/mediawiki/wikidata/$1/fulldump"
+(cd "/var/lib/gforge/plugins/mediawiki/wikidata/$1" && paxtar -xzf -) <"$2"
+cd "/var/lib/gforge/plugins/mediawiki/wikidata/$1/fulldump"
+/usr/share/gforge/plugins/mediawiki/bin/mw-wrapper.php "$1" \
+ importImages.php mfi/
+/usr/share/gforge/plugins/mediawiki/bin/mw-wrapper.php "$1" \
+ importDump.php df.xml
+cd ..
+rm -rf fulldump
+chown -R www-data:www-data \
+ "/var/lib/gforge/plugins/mediawiki/wikidata/$1/images"
+/usr/share/gforge/plugins/mediawiki/bin/mw-wrapper.php "$1" \
+ rebuildrecentchanges.php
+/usr/share/gforge/plugins/mediawiki/bin/mw-wrapper.php "$1" update.php --quick
+exit 0
if (!is_dir($projects_path)) {
echo "Creating $projects_path...\n";
mkdir($projects_path, 0755, true);
+ chmod($projects_path, 0755);
}
if (!is_dir($master_path)) {
echo "Creating $master_path...\n";
mkdir($master_path, 0755, true);
+ chmod($master_path, 0755);
}
function mysymlink($from, $to) {
cron_debug(" Creating project dir $project_dir.");
mkdir($project_dir, 0775, true);
+ chmod($project_dir, 0775);
$f = fopen("$project_dir/ProjectSettings.php", "w");
fwrite($f, '<?php
var $dstappendself = false;
function getTitle($subpage="") {
- return 'SpecialForgeRedir';
+ return $this;
}
function getRedirect($subpage="") {
$line = fgets ($pipe) ;
fclose ($pipe) ;
- if (preg_match ("/^Shared repository/", $line) != 0) {
+ if (preg_match ("/^Shared repository/", $line) != 0
+ || preg_match ("/^Repository branch/", $line) != 0) {
$repo_exists = true ;
}
}
<h2><?php echo _('Project Maintenance'); ?></h2>
<ul>
<li><?php
- $res=db_query_params ('SELECT count(*) AS count FROM groups',
- array()) ;
-
+ $res = db_query_params('SELECT count(*) AS count FROM groups
+ WHERE group_id > 4
+ AND register_time > 0
+ AND is_template = 0',
+ array());
$row = db_fetch_array($res);
printf(_('Registered projects: <strong>%1$s</strong>'), $row['count']);
?></li>
<li><?php
- $res=db_query_params ('SELECT count(*) AS count FROM groups WHERE status=$1',
- array('A')) ;
-
+ $res = db_query_params('SELECT count(*) AS count FROM groups
+ WHERE group_id > 4
+ AND status = $1
+ AND register_time > 0
+ AND is_template = 0',
+ array('A'));
$row = db_fetch_array($res);
printf(_('Active projects: <strong>%1$s</strong>'), $row['count']);
?></li>
<li><?php
- $res=db_query_params ('SELECT count(*) AS count FROM groups WHERE status=$1 AND is_template!=1',
- array('P')) ;
-
+ $res = db_query_params('SELECT count(*) AS count FROM groups
+ WHERE group_id > 4
+ AND status = $1
+ AND register_time > 0
+ AND is_template = 0',
+ array('P'));
$row = db_fetch_array($res);
printf(_('Pending projects: <strong>%1$s</strong>'), $row['count']);
?></li>