+2004-05-16 Roland Mas <99.roland.mas@aist.enst.fr>
+
+ * SCM pluginification: new SCMPlugin class, SCM pages now call the
+ SCM plugins instead of hardcoding CVS. More hooks.
+
2004-05-12 Tom Copeland <tom@infoether.com>
* www/include/snippet_caching.php: Modified queries to use GROUP BY
* www/my/index.php: Fixed bug #788: Site admin's 'my page' shows
news postings from deleted projects
+2004-04-25 Roland Mas <99.roland.mas@aist.enst.fr>
+
+ * utils/ldap/sql2ldif.pl (dump_header): Added an Unix account for
+ SCM systems such as Subversion.
+
2004-04-16 Christian Bayle <bayle@debian.org>
* Added DirectoryIndex in etc/httpd.d/40virtualhost
return $this->plugins_data ;
}
+ /**
+ * GetPluginObject() - get a particular plugin object
+ *
+ * @param pluginname - name of plugin
+ * @return a plugin object
+ */
+ function GetPluginObject ($pluginname) {
+ return $this->plugins_objects [$pluginname] ;
+ }
+
/**
* PluginIsInstalled() - is a plugin installed?
*
*/
function LoadPlugins () {
$plugins_data = $this->GetPlugins() ;
- $include_path = "/usr/lib/gforge/plugins/" ;
+ $include_path = $GLOBALS['sys_plugins_path'] ;
foreach ($plugins_data as $p_id => $p_name) {
$filename = $include_path . $p_name . "/include/".$p_name."-init.php" ;
if (file_exists ($filename)) {
}
return true ;
}
+
+ /**
+ * CountHookListeners() - number of listeners on a particular hook
+ *
+ * @param hookname - name of the hook
+ */
+ function CountHookListeners ($hookname) {
+ if (isset($this->hooks_to_plugins[$hookname])) {
+ $p_list = $this->hooks_to_plugins[$hookname];
+ return count ($p_list) ;
+ } else {
+ return 0 ;
+ }
+
+ }
}
/**
return $PLUGINMANAGER_OBJ ;
}
+/**
+ * plugin_get_object() - get a particular Plugin object
+ *
+ * @param pluginname - a plugin name
+ * @return the Plugin object
+ */
+function &plugin_get_object ($pluginname) {
+ global $PLUGINMANAGER_OBJ;
+ return $PLUGINMANAGER_OBJ->Getpluginobject ($pluginname) ;
+}
+
/**
* register_plugin () - register a plugin
*
return $pm->RunHooks ($hookname, $params) ;
}
+/**
+ * plugin_hook_listeners () - count the number of listeners on a hook
+ *
+ * @param hookname - name of the hook
+ */
+function plugin_hook_listeners ($hookname, $params=false) {
+ $pm =& plugin_manager_get_object () ;
+ return $pm->CountHookListeners ($hookname) ;
+}
+
/**
* setup_plugin_manager () - initialise the plugin ingrastructure
*
--- /dev/null
+<?php
+/**
+ * SCM object
+ *
+ * Provides an base class for an SCM plugin
+ *
+ * This file is copyright (c) Roland Mas <lolando@debian.org>, 2004
+ *
+ * $Id$
+ *
+ * This file is part of GForge.
+ *
+ * GForge 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 License, or
+ * (at your option) any later version.
+ *
+ * GForge 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 GForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+require_once('common/include/scm.php');
+
+class SCM extends Plugin {
+ /**
+ * SCM() - constructor
+ *
+ */
+ function SCM () {
+ $this->Plugin() ;
+ }
+
+ function register () {
+ global $scm_list ;
+
+ $scm_list[] = $this->name ;
+ }
+}
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>
* @param string The users fax.
* @param string The users title.
* @param char(2) The users ISO country_code.
+ * @param bool Whether to send an email or not
* @returns The newly created user ID
*
*/
function create($unix_name,$firstname,$lastname,$password1,$password2,$email,
$mail_site,$mail_va,$language_id,$timezone,$jabber_address,$jabber_only,$theme_id,
- $unix_box='shell',$address='',$address2,$phone='',$fax='',$title='',$ccode='US') {
+ $unix_box='shell',$address='',$address2='',$phone='',$fax='',$title='',$ccode='US',$send_mail=true) {
global $Language;
if (!$theme_id) {
$this->setError($Language->getText('account_register','err_themeid'));
}
$Language->loadLanguageID($language_id);
-
- $this->sendRegistrationEmail();
+
+ if ($send_mail) {
+ $this->sendRegistrationEmail();
+ }
db_commit();
return $id;
--- /dev/null
+<?php
+
+$scm_list = array () ;
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>
$hook_params['passwd'] = $passwd ;
plugin_hook ("session_before_login", $hook_params) ;
+ return session_login_valid_dbonly ($loginname, $passwd, $allowpending) ;}
+
+function session_login_valid_dbonly ($loginname, $passwd, $allowpending) {
+ global $feedback,$Language;
+
// Try to get the users from the database using user_id and (MD5) user_pw
$res = db_query("
SELECT user_id,status,unix_pw
$res = db_query ("UPDATE users
SET user_pw='" . md5($passwd) . "'
WHERE user_id='".$usr['user_id']."'");
- return session_login_valid($loginname, $passwd, $allowpending) ;
+ return session_login_valid_dbonly($loginname, $passwd, $allowpending) ;
}
} else {
// If we're here, then the user has typed a password matching the (MD5) user_pw
$res = db_query ("UPDATE users
SET unix_pw='" . account_genunixpw($passwd) . "'
WHERE user_id='".$usr['user_id']."'");
- return session_login_valid($loginname, $passwd, $allowpending) ;
+ return session_login_valid_dbonly($loginname, $passwd, $allowpending) ;
} else {
// Invalidate (MD5) user_pw, refuse authentication
$res = db_query ("UPDATE users
$server_admin $domain_name $newsadmin_groupid $statsadmin_groupid
$skill_list/ ;
-sub is_lesser ( $$ ) ;
-sub is_greater ( $$ ) ;
-sub debug ( $ ) ;
-sub parse_sql_file ( $ ) ;
-
require ("/etc/gforge/local.pl") ;
require ("/usr/lib/gforge/lib/sqlparser.pm") ; # Our magic SQL parser
+require ("/usr/lib/gforge/lib/sqlhelper.pm") ; # Our SQL functions
-debug "You'll see some debugging info during this installation." ;
-debug "Do not worry unless told otherwise." ;
+&debug ("You'll see some debugging info during this installation.") ;
+&debug ("Do not worry unless told otherwise.") ;
if ( "$sys_dbname" ne "gforge" || "$sys_dbuser" ne "gforge" ) {
$dbh ||= DBI->connect("DBI:Pg:dbname=$sys_dbname","$sys_dbuser","$sys_dbpasswd");
if ($array [0] == 0) { # No 'groups' table
# Installing SF 2.6 from scratch
$action = "installation" ;
- debug "Creating initial Sourceforge database from files." ;
+ &debug ("Creating initial Sourceforge database from files.") ;
&create_metadata_table ("2.5.9999") ;
@array = $sth->fetchrow_array () ;
$sth->finish () ;
if ($array[0] == 0) {
- debug "Updating debian_meta_data table." ;
+ &debug ("Updating debian_meta_data table.") ;
$query = "INSERT INTO debian_meta_data (key, value) VALUES ('current-path', 'scratch-to-2.6')" ;
# debug $query ;
$sth = $dbh->prepare ($query) ;
$sth->execute () ;
$sth->finish () ;
}
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
} else { # A 'groups' table exists
}
$version = &get_db_version ;
- if (is_lesser $version, "2.5.9999") {
- debug "Found an old (2.5) database, will upgrade to 2.6" ;
+ if (&is_lesser ($version, "2.5.9999")) {
+ &debug ("Found an old (2.5) database, will upgrade to 2.6") ;
$query = "SELECT count(*) from debian_meta_data where key = 'current-path'";
# debug $query ;
$sth->finish () ;
if ($array[0] == 0) {
- # debug "Updating debian_meta_data table." ;
+ # &debug ("Updating debian_meta_data table.") ;
$query = "INSERT INTO debian_meta_data (key, value) VALUES ('current-path', '2.5-to-2.6')" ;
# debug $query ;
$sth = $dbh->prepare ($query) ;
$sth->execute () ;
$sth->finish () ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
}
($path eq 'scratch-to-2.6') && do {
$version = &get_db_version ;
$target = "2.5.9999.1+global+data+done" ;
- if (is_lesser $version, $target) {
+ if (&is_lesser ($version, $target)) {
my @filelist = qw{ /usr/lib/gforge/db/sf-2.6-complete.sql } ;
# TODO: user_rating.sql
foreach my $file (@filelist) {
- debug "Processing $file" ;
+ &debug ("Processing $file") ;
@reqlist = @{ &parse_sql_file ($file) } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.5.9999.2+local+data+done" ;
- if (is_lesser $version, $target) {
- debug "Adding local data." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Adding local data.") ;
do "/etc/gforge/local.pl" or die "Cannot read /etc/gforge/local.pl" ;
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.5.9999.3+skills+done" ;
- if (is_lesser $version, $target) {
- debug "Inserting skills." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Inserting skills.") ;
foreach my $skill (split /;/, $skill_list) {
push @reqlist, "INSERT INTO people_skill (name) VALUES ('$skill')" ;
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+1" ;
- if (is_lesser $version, $target) {
- debug "Updating debian_meta_data table." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Updating debian_meta_data table.") ;
$query = "DELETE FROM debian_meta_data WHERE key = 'current-path'" ;
# debug $query ;
$sth = $dbh->prepare ($query) ;
$sth->finish () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.5-8" ;
- if (is_lesser $version, $target) {
- debug "Adding row to people_job_category." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Adding row to people_job_category.") ;
$query = "INSERT INTO people_job_category VALUES (100, 'Undefined', 0)" ;
$sth = $dbh->prepare ($query) ;
$sth->execute () ;
$sth->finish () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.5-25" ;
- if (is_lesser $version, $target) {
- debug "Adding row to supported_languages." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Adding row to supported_languages.") ;
$query = "INSERT INTO supported_languages VALUES (15, 'Korean', 'Korean.class', 'Korean', 'kr')" ;
$sth = $dbh->prepare ($query) ;
$sth->execute () ;
$sth->finish () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.5-27" ;
- if (is_lesser $version, $target) {
- debug "Fixing unix_box entries." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Fixing unix_box entries.") ;
$query = "update groups set unix_box = 'shell'" ;
$sth = $dbh->prepare ($query) ;
$sth->execute () ;
$sth->finish () ;
- debug "Also fixing a few sequences." ;
+ &debug ("Also fixing a few sequences.") ;
- &bump_sequence_to ("bug_pk_seq", 100) ;
- &bump_sequence_to ("project_task_pk_seq", 100) ;
+ &bump_sequence_to ($dbh, "bug_pk_seq", 100) ;
+ &bump_sequence_to ($dbh, "project_task_pk_seq", 100) ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.5-30" ;
- if (is_lesser $version, $target) {
- debug "Adding rows to supported_languages." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Adding rows to supported_languages.") ;
@reqlist = (
"INSERT INTO supported_languages VALUES (16,'Bulgarian','Bulgarian.class','Bulgarian','bg')",
"INSERT INTO supported_languages VALUES (17,'Greek','Greek.class','Greek','el')",
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.5-32" ;
- if (is_lesser $version, $target) {
- debug "Fixing unix_uid entries." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Fixing unix_uid entries.") ;
$query = "UPDATE users SET unix_uid = nextval ('unix_uid_seq') WHERE unix_status != 'N' AND status != 'P' AND unix_uid = 0" ;
$sth = $dbh->prepare ($query) ;
$sth->finish () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.5.9999.1+temp+data+dropped" ;
- if (is_lesser $version, $target) {
- debug "Preparing to upgrade your database - dropping temporary tables" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Preparing to upgrade your database - dropping temporary tables") ;
my @tables = qw/ user_metric_tmp1_1 user_metric_tmp1_2
user_metric_tmp1_3 user_metric_tmp1_4
user_metric_history_date_userid / ;
foreach my $table (@tables) {
- &drop_table_if_exists ($table) ;
+ &drop_table_if_exists ($dbh, $table) ;
}
foreach my $sequence (@sequences) {
- &drop_sequence_if_exists ($sequence) ;
+ &drop_sequence_if_exists ($dbh, $sequence) ;
}
foreach my $index (@indexes) {
- &drop_index_if_exists ($index) ;
+ &drop_index_if_exists ($dbh, $index) ;
}
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.5.9999.2+data+upgraded" ;
- if (is_lesser $version, $target) {
- debug "Upgrading your database scheme from 2.5" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading your database scheme from 2.5") ;
my $pg_version = &get_pg_version ;
- if (is_lesser $pg_version, "7.3") {
+ if (&is_lesser ($pg_version, "7.3")) {
@reqlist = (
"DROP INDEX groups_pkey",
"DROP INDEX users_pkey",
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.5.9999.3+artifact+transcoded" ;
- if (is_lesser $version, $target) {
- debug "Transcoding the artifact data fields" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Transcoding the artifact data fields") ;
$query = "SELECT id,bin_data FROM artifact_file ORDER BY id ASC" ;
# debug $query ;
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.5.9999.4+groups+inserted" ;
- if (is_lesser $version, $target) {
- debug "Inserting missing groups" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Inserting missing groups") ;
@reqlist = (
"INSERT INTO groups (group_name, homepage,
}
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+1" ;
- if (is_lesser $version, $target) {
- debug "Database has successfully been converted." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Database has successfully been converted.") ;
$query = "DELETE FROM debian_meta_data WHERE key = 'current-path'" ;
# debug $query ;
$sth = $dbh->prepare ($query) ;
$sth->finish () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+2" ;
- if (is_lesser $version, $target) {
- debug "Updating permissions on system groups." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Updating permissions on system groups.") ;
$query = "UPDATE groups SET group_name='Site Admin', is_public=1 WHERE group_id=1" ;
# debug $query ;
$sth = $dbh->prepare ($query) ;
$sth->finish () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+3" ;
- if (is_lesser $version, $target) {
- debug "Creating table group_cvs_history." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Creating table group_cvs_history.") ;
$query = "CREATE TABLE group_cvs_history (
id integer DEFAULT nextval('group_cvs_history_pk_seq'::text) NOT NULL,
group_id integer DEFAULT '0' NOT NULL,
$sth->finish () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+4" ;
- if (is_lesser $version, $target) {
- debug "Registering Savannah themes." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Registering Savannah themes.") ;
$query = "SELECT max(theme_id) FROM themes" ;
# debug $query ;
$sth->finish () ;
my $maxid = $array [0] ;
- &bump_sequence_to ("themes_pk_seq", $maxid) ;
+ &bump_sequence_to ($dbh, "themes_pk_seq", $maxid) ;
@reqlist = (
"INSERT INTO themes (dirname, fullname) VALUES ('savannah_codex', 'Savannah CodeX')",
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+5" ;
- if (is_lesser $version, $target) {
- debug "Registering yet another Savannah theme." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Registering yet another Savannah theme.") ;
$query = "INSERT INTO themes (dirname, fullname) VALUES ('savannah_darkslate', 'Savannah Dark Slate')";
# debug $query ;
$sth->finish () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+6" ;
- if (is_lesser $version, $target) {
- debug "Updating language codes." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Updating language codes.") ;
@reqlist = (
"UPDATE supported_languages SET language_code='en' where classname='English'",
}
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+7" ;
- if (is_lesser $version, $target) {
- debug "Fixing artifact-related views." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Fixing artifact-related views.") ;
- &drop_view_if_exists ("artifact_file_user_vw") ;
- &drop_view_if_exists ("artifact_history_user_vw") ;
- &drop_view_if_exists ("artifact_message_user_vw") ;
- &drop_view_if_exists ("artifactperm_artgrouplist_vw") ;
- &drop_view_if_exists ("artifactperm_user_vw") ;
- &drop_view_if_exists ("artifact_vw") ;
+ &drop_view_if_exists ($dbh, "artifact_file_user_vw") ;
+ &drop_view_if_exists ($dbh, "artifact_history_user_vw") ;
+ &drop_view_if_exists ($dbh, "artifact_message_user_vw") ;
+ &drop_view_if_exists ($dbh, "artifactperm_artgrouplist_vw") ;
+ &drop_view_if_exists ($dbh, "artifactperm_user_vw") ;
+ &drop_view_if_exists ($dbh, "artifact_vw") ;
@reqlist = (
"CREATE VIEW artifact_file_user_vw as SELECT af.id, af.artifact_id, af.description, af.bin_data, af.filename, af.filesize, af.filetype, af.adddate, af.submitted_by, users.user_name, users.realname FROM artifact_file af, users WHERE (af.submitted_by = users.user_id)",
}
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+8" ;
- if (is_lesser $version, $target) {
- debug "Adding integrity constraints between the Trove map tables." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Adding integrity constraints between the Trove map tables.") ;
@reqlist = (
"ALTER TABLE trove_group_link ADD CONSTRAINT tgl_group_id_fk FOREIGN KEY (group_id) REFERENCES groups(group_id) MATCH FULL",
}
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+9" ;
- if (is_lesser $version, $target) {
- debug "Adding extra fields to the groups table." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Adding extra fields to the groups table.") ;
@reqlist = (
"ALTER TABLE groups ADD COLUMN use_ftp integer",
}
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+10" ;
- if (is_lesser $version, $target) {
- debug "Updating supported_languages table." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Updating supported_languages table.") ;
my $pg_version = &get_pg_version ;
- if (is_lesser $pg_version, "7.3") {
+ if (&is_lesser ($pg_version, "7.3")) {
@reqlist = (
"ALTER TABLE supported_languages RENAME TO supported_languages_old",
"CREATE TABLE supported_languages (language_id integer DEFAULT nextval('supported_languages_pk_seq'::text) NOT NULL, name text, filename text, classname text, language_code character(5))",
}
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+11" ;
- if (is_lesser $version, $target) {
- debug "Adding tables for the plugin subsystem." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Adding tables for the plugin subsystem.") ;
@reqlist = (
"CREATE SEQUENCE plugins_pk_seq",
}
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+12" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20021125.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20021125.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20021125.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+13" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20021212.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20021212.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20021212.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+14" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20021213.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20021213.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20021213.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+15" ;
- if (is_lesser $version, $target) {
- debug "Transcoding documentation data fields" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Transcoding documentation data fields") ;
$query = "SELECT docid,data FROM doc_data ORDER BY docid ASC" ;
# debug $query ;
$sth = $dbh->prepare ($query) ;
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+16" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20021214.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20021214.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20021214.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+17" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20021215.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20021215.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20021215.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+18" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20021216.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20021216.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20021216.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+19" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20021223.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20021223.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20021223.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+20" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20030102.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20030102.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20030102.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+21" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20030105.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20030105.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20030105.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+22" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20030107.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20030107.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20030107.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+23" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20030109.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20030109.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20030109.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+24" ;
- if (is_lesser $version, $target) {
+ if (&is_lesser ($version, $target)) {
- debug "Adjusting language sequense" ;
+ &debug ("Adjusting language sequences") ;
$query = "SELECT max(language_id) FROM supported_languages" ;
$sth = $dbh->prepare ($query) ;
@array = $sth->fetchrow_array () ;
$sth->finish () ;
my $maxid = $array [0] ;
- &bump_sequence_to ("supported_languages_pk_seq", $maxid) ;
+ &bump_sequence_to ($dbh, "supported_languages_pk_seq", $maxid) ;
- debug "Upgrading with 20030112.sql" ;
+ &debug ("Upgrading with 20030112.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20030112.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+25" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20030113.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20030113.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20030113.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+26" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20030131.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20030131.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20030131.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+27" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20030209.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20030209.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20030209.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+28" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20030312.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20030312.sql") ;
my $pg_version = &get_pg_version ;
- if (is_lesser $pg_version, "7.3") {
+ if (&is_lesser ($pg_version, "7.3")) {
@reqlist = (
"DROP TRIGGER projtask_insert_depend_trig ON project_task",
"DROP FUNCTION projtask_insert_depend ()",
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing $target." ;
+ &debug ("Committing $target.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+29" ;
- if (is_lesser $version, $target) {
- debug "Registering KDE theme." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Registering KDE theme.") ;
$query = "INSERT INTO themes (dirname, fullname) VALUES ('kde', 'KDE')";
# debug $query ;
$sth->finish () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+30" ;
- if (is_lesser $version, $target) {
- debug "Registering Dark Aqua theme." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Registering Dark Aqua theme.") ;
$query = "INSERT INTO themes (dirname, fullname) VALUES ('darkaqua', 'Dark Aqua')";
# debug $query ;
$sth->finish () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "2.6-0+checkpoint+31" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20030513.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20030513.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20030513.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "3.0-1" ;
- if (is_lesser $version, $target) {
- debug "Database schema is now version 3.0-1." ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Database schema is now version 3.0-1.") ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "3.0-7" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20030822.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20030822.sql") ;
@reqlist = (
"DROP TRIGGER artifactgroup_update_trig ON artifact",
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "3.1-0+1" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20031105.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20031105.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20031105.sql") } ;
foreach my $s (@reqlist) {
$sth->finish () ;
}
- debug "Upgrading with 20031124.sql" ;
+ &debug ("Upgrading with 20031124.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20031124.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "3.1-0+2" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20031129.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20031129.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20031129.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "3.1-0+3" ;
- if (is_lesser $version, $target) {
+ if (&is_lesser ($version, $target)) {
# Yes, I know. 20031126 < 20031129, yet we apply that change later.
# Blame tperdue for late committing.
# They are independent anyway.
- debug "Upgrading with 20031126.sql" ;
+ &debug ("Upgrading with 20031126.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20031126.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "3.2.1-0+2" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20031205.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20031205.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20031205.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "3.2.1-0+3" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20040130.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20040130.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20040130.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "3.2.1-0+4" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20040204.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20040204.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20040204.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "3.2.1-0+5" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20040315.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20040315.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20040315.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "3.3.0-0+0" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20040325.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20040325.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20040325.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "3.3.0-0+1" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 200403252.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 200403252.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/200403252.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
$version = &get_db_version ;
$target = "3.3.0-0+3" ;
- if (is_lesser $version, $target) {
- debug "Upgrading with 20040507.sql" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading with 20040507.sql") ;
@reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20040507.sql") } ;
foreach my $s (@reqlist) {
@reqlist = () ;
&update_db_version ($target) ;
- debug "Committing." ;
+ &debug ("Committing.") ;
$dbh->commit () ;
}
- debug "It seems your database $action went well and smoothly. That's cool." ;
- debug "Please enjoy using Gforge." ;
+ &debug ("It seems your database $action went well and smoothly. That's cool.") ;
+ &debug ("Please enjoy using Gforge.") ;
# There should be a commit at the end of every block above.
# If there is not, then it might be symptomatic of a problem.
if ($@) {
warn "Transaction aborted because $@" ;
- debug "Transaction aborted because $@" ;
- debug "Last SQL query was:\n$query\n(end of query)" ;
+ &debug ("Transaction aborted because $@") ;
+ &debug ("Last SQL query was:\n$query\n(end of query)") ;
$dbh->rollback ;
my $version = &get_db_version ;
if ($version) {
- debug "Your database schema is at version $version" ;
+ &debug ("Your database schema is at version $version") ;
} else {
- debug "Couldn't get your database schema version." ;
+ &debug ("Couldn't get your database schema version.") ;
}
- debug "Please report this bug on the Debian bug-tracking system." ;
- debug "Please include the previous messages as well to help debugging." ;
- debug "You should not worry too much about this," ;
- debug "your DB is still in a consistent state and should be usable." ;
+ &debug ("Please report this bug on the Debian bug-tracking system.") ;
+ &debug ("Please include the previous messages as well to help debugging.") ;
+ &debug ("You should not worry too much about this,") ;
+ &debug ("your DB is still in a consistent state and should be usable.") ;
exit 1 ;
}
$dbh->rollback ;
$dbh->disconnect ;
-sub is_lesser ( $$ ) {
- my $v1 = shift || 0 ;
- my $v2 = shift || 0 ;
-
- my $rc = system "dpkg --compare-versions $v1 lt $v2" ;
-
- return (! $rc) ;
-}
-
-sub is_greater ( $$ ) {
- my $v1 = shift || 0 ;
- my $v2 = shift || 0 ;
-
- my $rc = system "dpkg --compare-versions $v1 gt $v2" ;
-
- return (! $rc) ;
-}
-
sub get_pg_version () {
my $command = q(dpkg -s postgresql | awk '/^Version: / { print $2 }') ;
my $version = qx($command) ;
return $version ;
}
-sub debug ( $ ) {
- my $v = shift ;
- chomp $v ;
- print STDERR "$v\n" ;
-}
-
sub create_metadata_table ( $ ) {
my $v = shift || "2.5-7+just+before+8" ;
# Do we have the metadata table?
# Let's create this table if we have it not
if ($array [0] == 0) {
- debug "Creating debian_meta_data table." ;
+ &debug ("Creating debian_meta_data table.") ;
$query = "CREATE TABLE debian_meta_data (key varchar primary key, value text not null)" ;
# debug $query ;
$sth = $dbh->prepare ($query) ;
# Empty table? We'll have to fill it up a bit
if ($array [0] == 0) {
- debug "Inserting first data into debian_meta_data table." ;
+ &debug ("Inserting first data into debian_meta_data table.") ;
$query = "INSERT INTO debian_meta_data (key, value) VALUES ('db-version', '$v')" ;
# debug $query ;
$sth = $dbh->prepare ($query) ;
sub update_db_version ( $ ) {
my $v = shift or die "Not enough arguments" ;
- debug "Updating debian_meta_data table." ;
+ &debug ("Updating debian_meta_data table.") ;
$query = "UPDATE debian_meta_data SET value = '$v' WHERE key = 'db-version'" ;
# debug $query ;
my $sth = $dbh->prepare ($query) ;
return $version ;
}
-
-sub drop_table_if_exists ( $ ) {
- my $tname = shift or die "Not enough arguments" ;
- $query = "SELECT count(*) FROM pg_class WHERE relname='$tname' AND relkind='r'" ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- my @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- if ($array [0] != 0) {
- # debug "Dropping table $tname" ;
- $query = "DROP TABLE $tname" ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
-}
-
-sub drop_sequence_if_exists ( $ ) {
- my $sname = shift or die "Not enough arguments" ;
- $query = "SELECT count(*) FROM pg_class WHERE relname='$sname' AND relkind='S'" ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- my @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- if ($array [0] != 0) {
- # debug "Dropping sequence $sname" ;
- $query = "DROP SEQUENCE $sname" ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
-}
-
-sub drop_index_if_exists ( $ ) {
- my $iname = shift or die "Not enough arguments" ;
- $query = "SELECT count(*) FROM pg_class WHERE relname='$iname' AND relkind='i'" ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- my @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- if ($array [0] != 0) {
- # debug "Dropping index $iname" ;
- $query = "DROP INDEX $iname" ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
-}
-
-sub drop_view_if_exists ( $ ) {
- my $iname = shift or die "Not enough arguments" ;
- $query = "SELECT count(*) FROM pg_class WHERE relname='$iname' AND relkind='v'" ;
- my $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- my @array = $sth->fetchrow_array () ;
- $sth->finish () ;
-
- if ($array [0] != 0) {
- # debug "Dropping view $iname" ;
- $query = "DROP VIEW $iname" ;
- # debug $query ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- $sth->finish () ;
- }
-}
-
-sub bump_sequence_to ( $$ ) {
- my ($sth, @array, $seqname, $targetvalue) ;
-
- $seqname = shift ;
- $targetvalue = shift ;
-
- do {
- $query = "select nextval ('$seqname')" ;
- $sth = $dbh->prepare ($query) ;
- $sth->execute () ;
- @array = $sth->fetchrow_array () ;
- $sth->finish () ;
- } until $array[0] >= $targetvalue ;
-}
+++ /dev/null
-#! /bin/sh
-#
-# $Id$
-#
-# Configure CVS for Sourceforge
-# Christian Bayle, Roland Mas, debian-sf (Sourceforge for Debian)
-
-set -e
-
-if [ $(id -u) != 0 ] ; then
- echo "You must be root to run this, please enter passwd"
- exec su -c "$0 $1"
-fi
-
-case "$1" in
- configure)
- echo "Modifying inetd for cvs server"
- echo "CVS usual config is changed for gforge one"
- # First, dedupe the commented lines
- update-inetd --remove "cvspserver stream tcp nowait.400 root /usr/sbin/tcpd /usr/lib/gforge/bin/cvs-pserver"
- update-inetd --comment-chars "#SF_WAS_HERE#" --enable cvspserver
- # Then, insinuate ourselves
- update-inetd --comment-chars "#SF_WAS_HERE#" --disable cvspserver
- update-inetd --add "cvspserver stream tcp nowait.400 root /usr/sbin/tcpd /usr/lib/gforge/bin/cvs-pserver"
- ;;
-
- purge)
- echo "Purging inetd for cvs server"
- # echo "You should dpkg-reconfigure cvs to use std install"
- update-inetd --remove "cvspserver stream tcp nowait.400 root /usr/sbin/tcpd /usr/lib/gforge/bin/cvs-pserver"
- update-inetd --comment-chars "#SF_WAS_HERE#" --enable cvspserver
- ;;
-
- *)
- echo "Usage: $0 {configure|purge}"
- exit 1
-esac
--- /dev/null
+# $Id$
+#
+# A few SQL helper functions
+#
+### AUTHOR/COPYRIGHT
+# This file is copyright 2004 Roland Mas <99.roland.mas@aist.enst.fr>.
+#
+# This is Free Software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License version 2, as published by the
+# Free Software Foundation.
+#
+### USAGE
+# drop_view_if_exists ("view_name") ;
+# drop_table_if_exists ("table_name") ;
+# drop_index_if_exists ("index_name") ;
+# drop_sequence_if_exists ("sequence_name") ;
+# remove_plugin_from_groups ("plugin_name") ;
+# remove_plugin_from_users ("plugin_name") ;
+#
+### BUGS
+# * No real bugs known -- yet
+#
+### TODO
+
+use strict ;
+
+use subs qw/ &get_plugin_id &remove_plugin_from_groups
+ &remove_plugin_from_users &drop_table_if_exists
+ &drop_index_if_exists &drop_sequence_if_exists
+ &drop_view_if_exists &bump_sequence_to &update_plugin_db_version
+ &get_plugin_db_version &debug &create_plugin_metadata_table
+ &is_lesser &is_greater/ ;
+
+sub get_plugin_id ( $$ ) ;
+sub remove_plugin_from_groups ( $$ ) ;
+sub remove_plugin_from_users ( $$ ) ;
+sub drop_table_if_exists ( $$ ) ;
+sub drop_index_if_exists ( $$ ) ;
+sub drop_sequence_if_exists ( $$ ) ;
+sub drop_view_if_exists ( $$ ) ;
+sub bump_sequence_to ( $$$ ) ;
+sub update_plugin_db_version ( $$$ ) ;
+sub get_plugin_db_version ( $$ ) ;
+sub create_plugin_metadata_table ( $$$ ) ;
+sub is_lesser ( $$ ) ;
+sub is_greater ( $$ ) ;
+sub debug ( $ ) ;
+
+sub drop_table_if_exists ( $$ ) {
+ my $dbh = shift or die "Not enough arguments" ;
+ my $tname = shift or die "Not enough arguments" ;
+ my $query = "SELECT count(*) FROM pg_class WHERE relname='$tname' AND relkind='r'" ;
+ my $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ my @array = $sth->fetchrow_array () ;
+ $sth->finish () ;
+
+ if ($array [0] != 0) {
+ # debug "Dropping table $tname" ;
+ $query = "DROP TABLE $tname" ;
+ # debug $query ;
+ $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ $sth->finish () ;
+ }
+}
+
+sub drop_sequence_if_exists ( $$ ) {
+ my $dbh = shift or die "Not enough arguments" ;
+ my $sname = shift or die "Not enough arguments" ;
+ my $query = "SELECT count(*) FROM pg_class WHERE relname='$sname' AND relkind='S'" ;
+ my $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ my @array = $sth->fetchrow_array () ;
+ $sth->finish () ;
+
+ if ($array [0] != 0) {
+ # debug "Dropping sequence $sname" ;
+ $query = "DROP SEQUENCE $sname" ;
+ # debug $query ;
+ $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ $sth->finish () ;
+ }
+}
+
+sub drop_index_if_exists ( $$ ) {
+ my $dbh = shift or die "Not enough arguments" ;
+ my $iname = shift or die "Not enough arguments" ;
+ my $query = "SELECT count(*) FROM pg_class WHERE relname='$iname' AND relkind='i'" ;
+ my $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ my @array = $sth->fetchrow_array () ;
+ $sth->finish () ;
+
+ if ($array [0] != 0) {
+ # debug "Dropping index $iname" ;
+ $query = "DROP INDEX $iname" ;
+ # debug $query ;
+ $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ $sth->finish () ;
+ }
+}
+
+sub drop_view_if_exists ( $$ ) {
+ my $dbh = shift or die "Not enough arguments" ;
+ my $vname = shift or die "Not enough arguments" ;
+
+ my $query = "SELECT count(*) FROM pg_class WHERE relname='$vname' AND relkind='v'" ;
+ my $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ my @array = $sth->fetchrow_array () ;
+ $sth->finish () ;
+
+ if ($array [0] != 0) {
+ # debug "Dropping view $vname" ;
+ $query = "DROP VIEW $vname" ;
+ # debug $query ;
+ $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ $sth->finish () ;
+ }
+}
+
+sub bump_sequence_to ( $$$ ) {
+ my $dbh = shift or die "Not enough arguments" ;
+ my $seqname = shift or die "Not enough arguments" ;
+ my $targetvalue = shift or die "Not enough arguments" ;
+
+ my ($sth, @array) ;
+
+ do {
+ my $query = "select nextval ('$seqname')" ;
+ $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ @array = $sth->fetchrow_array () ;
+ $sth->finish () ;
+ } until $array[0] >= $targetvalue ;
+}
+
+sub get_plugin_id ( $$ ) {
+ my $dbh = shift or die "Not enough arguments" ;
+ my $pluginname = shift or die "Not enough arguments" ;
+
+ my $pluginid = -1 ;
+
+ my $query = "SELECT plugin_id FROM plugins WHERE plugin_name = '$pluginname'" ;
+ my $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ if (my @array = $sth->fetchrow_array ()) {
+ $pluginid = $array [0] ;
+ }
+ $sth->finish () ;
+
+ return $pluginid ;
+}
+
+sub remove_plugin_from_groups ( $$ ) {
+ my $dbh = shift or die "Not enough arguments" ;
+ my $pluginid = shift or die "Not enough arguments" ;
+
+ my $query = "DELETE FROM group_plugin WHERE plugin_id = $pluginid" ;
+ my $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ $sth->finish () ;
+}
+
+sub remove_plugin_from_users ( $$ ) {
+ my $dbh = shift or die "Not enough arguments" ;
+ my $pluginid = shift or die "Not enough arguments" ;
+
+ my $query = "DELETE FROM user_plugin WHERE plugin_id = $pluginid" ;
+ my $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ $sth->finish () ;
+}
+
+sub update_plugin_db_version ( $$$ ) {
+ my $dbh = shift or die "Not enough arguments" ;
+ my $pluginname = shift or die "Not enough arguments" ;
+ my $v = shift or die "Not enough arguments" ;
+
+ my $tablename = "plugin_" .$pluginname . "_meta_data" ;
+
+ debug "Updating $tablename table." ;
+ my $query = "UPDATE $tablename SET value = '$v' WHERE key = 'db-version'" ;
+ # debug $query ;
+ my $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ $sth->finish () ;
+}
+
+sub get_plugin_db_version ( $$ ) {
+ my $dbh = shift or die "Not enough arguments" ;
+ my $pluginname = shift or die "Not enough arguments" ;
+
+ my $tablename = "plugin_" .$pluginname . "_meta_data" ;
+
+ my $query = "SELECT value FROM $tablename WHERE key = 'db-version'" ;
+ # debug $query ;
+ my $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ my @array = $sth->fetchrow_array () ;
+ $sth->finish () ;
+
+ my $version = $array [0] ;
+
+ return $version ;
+}
+
+sub debug ( $ ) {
+ my $v = shift ;
+ chomp $v ;
+ print STDERR "$v\n" ;
+}
+
+sub create_plugin_metadata_table ( $$$ ) {
+ my $dbh = shift or die "Not enough arguments" ;
+ my $pluginname = shift or die "Not enough arguments" ;
+ my $v = shift || "0" ;
+
+ my $tablename = "plugin_" .$pluginname . "_meta_data" ;
+ # Do we have the metadata table?
+
+ my $query = "SELECT count(*) FROM pg_class WHERE relname = '$tablename' and relkind = 'r'";
+ # debug $query ;
+ my $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ my @array = $sth->fetchrow_array () ;
+ $sth->finish () ;
+
+ # Let's create this table if we have it not
+
+ if ($array [0] == 0) {
+ debug "Creating $tablename table." ;
+ $query = "CREATE TABLE $tablename (key varchar primary key, value text not null)" ;
+ # debug $query ;
+ $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ $sth->finish () ;
+ }
+
+ $query = "SELECT count(*) FROM $tablename WHERE key = 'db-version'";
+ # debug $query ;
+ $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ @array = $sth->fetchrow_array () ;
+ $sth->finish () ;
+
+ # Empty table? We'll have to fill it up a bit
+
+ if ($array [0] == 0) {
+ debug "Inserting first data into $tablename table." ;
+ $query = "INSERT INTO $tablename (key, value) VALUES ('db-version', '$v')" ;
+ # debug $query ;
+ $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ $sth->finish () ;
+ }
+}
+
+sub is_lesser ( $$ ) {
+ my $v1 = shift || 0 ;
+ my $v2 = shift || 0 ;
+
+ my $rc = system "dpkg --compare-versions $v1 lt $v2" ;
+
+ return (! $rc) ;
+}
+
+sub is_greater ( $$ ) {
+ my $v1 = shift || 0 ;
+ my $v2 = shift || 0 ;
+
+ my $rc = system "dpkg --compare-versions $v1 gt $v2" ;
+
+ return (! $rc) ;
+}
+
+1 ;
sub parse_sql_file ( $ ) {
my $f = shift ;
- open F, $f || die "Could not open file $f: $!\n" ;
+ open F, $f or die "Could not open file $f: $!\n" ;
# This is a state machine to parse potentially complex SQL files
# into individual SQL requests/statements
+++ /dev/null
-#! /bin/sh
-#
-# $Id$
-#
-# Generate CVS repositories tarballs
-# Christian Bayle, Roland Mas, debian-sf (Sourceforge for Debian)
-
-set -e
-
-if [ $(id -u) != 0 ] ; then
- echo "You must be root to run this, please enter passwd"
- exec su -c "$0 $1"
-fi
-
-CVSROOT=/var/lib/gforge/chroot/cvsroot
-CVSTARDIR=/var/lib/gforge/cvstarballs
-
-case "$1" in
- generate)
- cd $CVSROOT
- ls | while read dir ; do
- tar czf $CVSTARDIR/${dir}-cvsroot.tar.gz.new ${dir}
- mv $CVSTARDIR/${dir}-cvsroot.tar.gz.new $CVSTARDIR/${dir}-cvsroot.tar.gz
- done
- ;;
-
- update)
- ;;
-
- purge)
- ;;
-
- *)
- echo "Usage: $0 {generate}"
- exit 1
- ;;
-
-esac
/usr/lib/gforge/bin/user_dump_update.pl
/usr/lib/gforge/bin/group_dump_update.pl
/usr/lib/gforge/bin/ssh_dump_update.pl
- [ -f /usr/lib/gforge/bin/cvs_dump.pl ] && su -s /bin/sh gforge -c /usr/lib/gforge/bin/cvs_dump.pl
- [ -f /usr/lib/gforge/bin/cvs_update.pl ] && /usr/lib/gforge/bin/cvs_update.pl
+ [ -f /usr/lib/gforge/bin/cvs_dump.pl ] && su -s /bin/sh gforge -c /usr/lib/gforge/bin/cvs_dump.pl || true
+ [ -f /usr/lib/gforge/bin/cvs_update.pl ] && /usr/lib/gforge/bin/cvs_update.pl || true
#CB#su gforge -c /usr/lib/gforge/bin/dump_database.pl -s /bin/sh
#CB#su gforge -c /usr/lib/gforge/bin/ssh_dump.pl -s /bin/sh
+gforge (3.3.0+scm-0+1) experimental; urgency=low
+
+ * [Roland] First try at the pluginification of SCM.
+
+ -- Roland Mas <lolando@debian.org> Sun, 25 Apr 2004 21:12:11 +0200
+
gforge (3.3.0-4woody9) stable; urgency=low
* [Christian] Added new sql upgrade (2004*.sql)
patch from Hidenari Miwa and Tsutomu Tominaga.
* [Roland] Also use 20031126.sql, for the "cron manager" feature.
* [Roland] Also use 20031205.sql.
+ * [Christian] Now use setup script (wrapped in gforge-config)
+ * [Christian] Added dependencies in control file so all package of the same version are
+ installed when you apt-get install gforge
- -- Roland Mas <lolando@debian.org> Tue, 2 Mar 2004 23:23:04 +0100
+ -- Christian Bayle <bayle@debian.org> Wed, 3 Mar 2004 10:08:06 +0100
gforge (3.1-12) unstable; urgency=low
Package: gforge
Architecture: all
Conflicts: sourceforge
-Depends: debconf (>= 1.0.32), gforge-common (= ${Source-Version}), gforge-web-apache (= ${Source-Version})| gforge-web (= ${Source-Version}), gforge-db-postgresql (= ${Source-Version})| gforge-db (= ${Source-Version}), gforge-mta-exim4 (= ${Source-Version}) | gforge-mta-exim (= ${Source-Version}) | gforge-mta-postfix (= ${Source-Version}) | gforge-mta (= ${Source-Version}), gforge-shell-ldap (= ${Source-Version})| gforge-shell (= ${Source-Version}), gforge-cvs (= ${Source-Version}), gforge-ftp-proftpd (= ${Source-Version})| gforge-ftp (= ${Source-Version}), gforge-ldap-openldap (= ${Source-Version})| gforge-ldap (= ${Source-Version}), gforge-dns-bind9 (= ${Source-Version})| gforge-dns (= ${Source-Version}), gforge-lists-mailman (= ${Source-Version})| gforge-lists (= ${Source-Version})
+Depends: debconf (>= 1.0.32), gforge-common (= ${Source-Version}), gforge-web-apache (= ${Source-Version})| gforge-web (= ${Source-Version}), gforge-db-postgresql (= ${Source-Version})| gforge-db (= ${Source-Version}), gforge-mta-exim4 (= ${Source-Version}) | gforge-mta-exim (= ${Source-Version}) | gforge-mta-postfix (= ${Source-Version}) | gforge-mta (= ${Source-Version}), gforge-shell-ldap (= ${Source-Version})| gforge-shell (= ${Source-Version}), gforge-ftp-proftpd (= ${Source-Version})| gforge-ftp (= ${Source-Version}), gforge-ldap-openldap (= ${Source-Version})| gforge-ldap (= ${Source-Version}), gforge-dns-bind9 (= ${Source-Version})| gforge-dns (= ${Source-Version}), gforge-lists-mailman (= ${Source-Version})| gforge-lists (= ${Source-Version})
+Suggests: gforge-cvs (= ${Source-Version})
Description: Collaborative development tool - meta-package
GForge provides many tools to help collaboration in a
development project, such as bug-tracking, task management,
Package: gforge-cvs
Architecture: all
-Depends: gforge-common, gforge-ldap-openldap | gforge-ldap, cvs, rcs, apache (>= 1.3.9) | apache-ssl (>= 1.3.9) | apache-perl (>= 1.3.9), libapache-mod-ssl | apache-ssl, perl, debianutils (>= 1.7), debconf (>= 1.0.32), ssh, libnss-ldap (>=184-1), libpam-ldap
+Depends: gforge-common, gforge-ldap-openldap | gforge-ldap, cvs, rcs, apache (>= 1.3.9) | apache-ssl (>= 1.3.9) | apache-perl (>= 1.3.9), libapache-mod-ssl | apache-ssl, perl, debianutils (>= 1.7), debconf (>= 1.0.32), ssh, libnss-ldap (>=184-1), libpam-ldap, gforge-plugin-scmcvs
Replaces: sourceforge-cvs (>> 2.6-0+11)
Conflicts: sourceforge-cvs
Description: Collaborative development tool - CVS management
+++ /dev/null
-#
-# Regular cron jobs for the gforge-cvs package
-#
-
-# CVS tarballs
-5 2 * * * root [ -x /usr/lib/gforge/bin/tarballs.sh ] && /usr/lib/gforge/bin/tarballs.sh generate > /dev/null 2>&1
#
install -m 755 cronjobs/db_stats_agg.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
install -m 755 cronjobs/massmail.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
-
install -m 755 cronjobs/vacuum.php $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- #
install -m 755 deb-specific/stats_projects_logparse.pl $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- #
install -m 755 deb-specific/get_news_notapproved.pl $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- #
- install -m 755 deb-specific/install-db.sh $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 deb-specific/db-upgrade.pl $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 644 deb-specific/sqlparser.pm $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/lib/
- install -m 755 deb-specific/sf-add-skill $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- #
- install -m 755 deb-specific/register-theme $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- install -m 755 deb-specific/unregister-theme $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
- #
- install -m 755 deb-specific/register-plugin $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
+ install -m 755 deb-specific/install-db.sh $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
+ install -m 755 deb-specific/db-upgrade.pl $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
+ install -m 644 deb-specific/sqlparser.pm $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/lib/
+ install -m 644 deb-specific/sqlhelper.pm $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/lib/
+ install -m 755 deb-specific/sf-add-skill $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
+ install -m 755 deb-specific/register-theme $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
+ install -m 755 deb-specific/unregister-theme $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/bin/
+
+ install -m 755 deb-specific/register-plugin $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
install -m 755 deb-specific/unregister-plugin $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
#
install -m 644 deb-specific/view_bug.sql $(CURDIR)/debian/gforge-db-postgresql/usr/lib/gforge/db/
# gforge-shell-ldap
cd $(CURDIR)/debian/gforge-shell-ldap/var/lib/gforge/chroot/var/lib/gforge/chroot && ln -s ../../../../home .
- # gforge-cvs
- install -m 755 deb-specific/stats_cvs.pl $(CURDIR)/debian/gforge-cvs/usr/lib/gforge/bin/
- install -m 755 deb-specific/install-cvs.sh $(CURDIR)/debian/gforge-cvs/usr/lib/gforge/bin/
- install -m 755 deb-specific/cvs-pserver $(CURDIR)/debian/gforge-cvs/usr/lib/gforge/bin/
- install -m 755 deb-specific/cvssh.pl $(CURDIR)/debian/gforge-cvs/bin/cvssh
- install -m 755 cgi-bin/cvsweb.cgi $(CURDIR)/debian/gforge-cvs/usr/lib/gforge/cgi-bin/cvsweb.cgi
- install -m 755 cgi-bin/cvsweb.cgi $(CURDIR)/debian/gforge-cvs/usr/lib/gforge/bin/cvsweb.cgi
- install -m 644 etc/cvsweb.conf $(CURDIR)/debian/gforge-cvs/etc/gforge/
- install -m 755 deb-specific/tarballs.sh $(CURDIR)/debian/gforge-cvs/usr/lib/gforge/bin/
- install -m 755 deb-specific/cvs_dump.pl $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
- install -m 755 deb-specific/cvs_update.pl $(CURDIR)/debian/gforge-common/usr/lib/gforge/bin/
- install -m 755 www/tarballs.php $(CURDIR)/debian/gforge-cvs/usr/share/gforge/cvs
-
# gforge-ftp-proftpd
install -m 755 deb-specific/install-ftp.sh $(CURDIR)/debian/gforge-ftp-proftpd/usr/lib/gforge/bin/
install -m 644 deb-specific/sf-proftpd.conf $(CURDIR)/debian/gforge-ftp-proftpd/etc/gforge/
+++ /dev/null
-# -*-perl-*-
-# Configuration of cvsweb.cgi, the
-# CGI interface to CVS Repositories.
-#
-# (c) 1998-1999 H. Zeller <zeller@think.de>
-# 1999 H. Nordström <hno@hem.passagen.se>
-# based on work by Bill Fenner <fenner@freebsd.org>
-# $Id$
-#
-# See utils/cvsweb for more details on copyright and licence
-###
-
-##############
-# CVS Root
-##############
-# CVSweb can handle several CVS-Repositories
-# at once. Enter a short symbolic names and the
-# full path of these repositories here.
-# NOTE that the symbolic names may not contain
-# whitespaces.
-# Note, that cvsweb currently needs to have physical access
-# to the CVS repository so :pserver:someone@xyz.com:/data/cvsroot
-# won't work!
-
-# 'symbolic_name' 'path_to_the_actual_repository'
-%CVSROOT = (
-# Uncomment next line and modify the path if you have only one CVS repository.
- 'GForge-CVS' => '/var/lib/gforge/chroot/cvsroot',
- );
-
-# This tree is enabled by default when
-# you enter the page
-$cvstreedefault = 'GForge-CVS';
-
-##############
-# Defaults for UserSettings
-##############
-%DEFAULTVALUE = (
- # sortby: File sort order
- # file Sort by filename
- # rev Sort by revision number
- # date Sort by commit date
- # author Sort by author
- # log Sort by log message
-
- "sortby" => "file",
-
- # hideattic: Hide or show files in Attic
- # 1 Hide files in Attic
- # 0 Show files in Attic
-
- "hideattic" => "1",
-
- # logsort: Sort order for CVS logs
- # date Sort revisions by date
- # rev Sort revision by revision number
- # cvs Don't sort them. Same order as CVS/RCS shows them.
-
- "logsort" => "date",
-
- # f: Default diff format
- # h Human readable
- # u Unified diff
- # c Context diff
- # s Side by side
- "f" => "h",
-
- # hidecvsroot: Don't show the CVSROOT directory
- # 1 Hide CVSROOT directory
- # 0 Show CVSROOT directory
- "hidecvsroot" => "0",
-
- # hidenonreadable: Don't show entries which cannot be read
- # 1 Hide non-readable entries
- # 0 Show non-readable entries
- "hidenonreadable" => "1",
-);
-
-##############
-# some layout stuff
-##############
-
-# color settings in the body-tag
-$body_tag = '<body text="#000000" bgcolor="#ffffff" link="#0000ff" alink="#ff0000" vlink="#800080">';
-
-# Wanna have a logo on the page ?
-#$logo = '<img src="somelogo.jpg">';
-
-# The title of the Page on startup
-$defaulttitle = "CVS Repository";
-
-# The address is shown on the footer
-$address = "<font size=-1>CVSweb by <zeller\@think.de></font>";
-
-# Default page background color for the diffs
-# and annotations
-$backcolor = "#eeeeee";
-
-# color of navigation Header for
-# diffs and annotations
-$navigationHeaderColor = '#9999ee';
-
-$long_intro = <<EOT;
-<p>
-This is a WWW interface for CVS Repositories.
-You can browse the file hierarchy by picking directories
-(which have slashes after them, <i>e.g.</i>, <b>src/</b>).
-If you pick a file, you will see the revision history
-for that file.
-Selecting a revision number will download that revision of
-the file. There is a link at each revision to display
-diffs between that revision and the previous one, and
-a form at the bottom of the page that allows you to
-display diffs between arbitrary revisions.
-</p>
-<p>
-This script has been written by Bill Fenner
-<<a href="mailto:fenner\@freebsd.org">fenner\@freebsd.org</a>>
-and improved by Henner Zeller
-<<a href="mailto:zeller\@think.de">zeller\@think.de</a>>,
-Henrik Nordström
-<<a href="mailto:hno\@hem.passagen.se">hno\@hem.passagen.se</a>>, and
-Ken Coar
-<<a href="mailto:Ken.Coar\@Golux.Com">Ken.Coar\@Golux.Com</a>>;
-it is covered by the
-<a href="http://www.opensource.org/licenses/bsd-license.html">BSD-Licence</a>.
-</p>
-<p>
-If you would like to use this CGI script on your own web server and
-CVS tree, see Zeller's
-<a href="http://linux.fh-heilbronn.de/~zeller/cgi/cvsweb.cgi"
->CVSweb distribution site</a>. Bill's original script can be found
-<a href="http://www.freebsd.org/~fenner/cvsweb/">here</a>.
-</p>
-<p>
-Please send any suggestions, comments, etc. to
-<a href="mailto:fenner\@freebsd.org">Bill Fenner</a> or, regarding the
-modifications, to
-<a href="mailto:zeller\@think.de">Henner Zeller</a>,
-<a href="mailto:hno\@hem.passagen.se">Henrik Nordström</a>, or
-<a href="mailto:Ken.Coar\@Golux.Com">Ken Coar</a>.
-</p>
-EOT
-
-$short_instruction = <<EOT;
-<p>
-Click on a directory to enter that directory. Click on a file to display
-its revision history and to get a chance to display diffs between revisions.
-</p>
-EOT
-
-# used icons; if icon-url is empty, the text representation is used; if
-# you do not want to have an ugly tooltip for the icon, remove the
-# text-representation.
-# The width and height of the icon allow the browser to correcly display
-# the table while still loading the icons.
-# These default icons are coming with apache.
-# If these icons are too large, check out the miniicons in the
-# icons/ directory; they have a width/height of 16/16
-# format: TEXT ICON-URL width height
-%ICONS = (
- back => [ ("[BACK]", "/images/cvsweb/back.png", 20, 22) ],
- dir => [ ("[DIR]", "/images/cvsweb/dir.png", 20, 22) ],
- file => [ ("[TXT]", "/images/cvsweb/text.png", 20, 22) ],
- );
-
-# the length to which the last logentry should
-# be truncated when shown in the directory view
-$shortLogLen = 80;
-
-# Show author of last change
-$show_author = 1;
-
-##############
-# table view for directories
-##############
-
-# Show directory as table
-# this is much more readable but has one
-# drawback: the whole table has to be loaded
-# before common browsers display it which may
-# be annoying if you have a slow link - and a
-# large directory ..
-$dirtable = 1;
-
-# show different colors for even/odd rows
-@tabcolors = ('#ccccee', '#ffffff');
-$tablepadding = 2;
-
-# Color of Header
-$columnHeaderColorDefault = '#cccccc';
-$columnHeaderColorSorted = '#88ff88';
-
-#
-# If you want to have colored borders
-# around each row, uncomment this
-# $tableBorderColor = '#999999';
-
-#
-# Modules in the repository that should not be displayed, either by default
-# nor by explicit path specification.
-#
-@HideModules = (
- );
-
-#
-# Use CVSROOT/CVSROOT/descriptions for describing the directories/modules
-# See INSTALL section 8
-#
-$use_descriptions = 0;
-
-##############
-# Human Readable Diff
-##############
-
-# (c) 1998 H. Zeller <zeller@think.de>
-#
-# Generates two columns of color encoded
-# diff; much like xdiff or emacs-ediff mode.
-#
-# The diff-stuff is a piece of code I once made for
-# cvs2html which is under GPL,
-# see http://www.sslug.dk/cvs2html
-# (c) 1997/98 Peter Toft <pto@sslug.imm.dtu.dk>
-#
-# some parameters to screw:
-##
-
-# make lines breakable so that the columns do not
-# exceed the width of the browser
-$hr_breakable = 1;
-
-# give out function names in human readable diffs
-# this just makes sense if we have C-files, otherwise
-# diff's heuristic doesn't work well ..
-# ( '-p' option to diff)
-$hr_funout = 0;
-
-# ignore whitespaces for human readable diffs
-# (indendation and stuff ..)
-# ( '-w' option to diff)
-$hr_ignwhite = 1;
-
-# ignore diffs which are caused by
-# keyword-substitution like $Id - Stuff
-# ( '-kk' option to rcsdiff)
-$hr_ignkeysubst = 1;
-
-# Colors and font to show the diff type of code changes
-$diffcolorHeading = '#99cccc'; # color of 'Line'-head of each diffed file
-$diffcolorEmpty = '#cccccc'; # color of 'empty' lines
-$diffcolorRemove = '#ff9999'; # Removed line(s) (left) ( - )
-$diffcolorChange = '#99ff99'; # Changed line(s) ( both )
-$diffcolorAdd = '#ccccff'; # Added line(s) ( - ) (right)
-$diffcolorDarkChange = '#99cc99'; # lines, which are empty in change
-$difffontface = "Helvetica,Arial";
-$difffontsize = "-1";
-
-# the width of the textinput of the
-# request-diff-form
-$inputTextSize = 12;
-
-##############
-# Mime Types
-##############
-
-# mapping to mimetypes to help
-# cvsweb to guess the correct mime-type on
-# checkout; you can use the mime.types from
-# apache here:
-$mime_types='/etc/apache/mime.types';
-
-# quick mime-type lookup; maps file-suffices to
-# mime-types for displaying checkouts in the browser.
-# Further MimeTypes will be found in the
-# file $mime_types (apache style mime.types - file)
-# - add common mappings here for faster lookup
-%MTYPES = (
- "html" => "text/html",
- "shtml" => "text/html",
- "gif" => "image/gif",
- "jpeg" => "image/jpeg",
- "jpg" => "image/jpeg",
- "png" => "image/png",
- "xpm" => "image/xpm",
- "*" => "text/plain",
- );
-
-##############
-# Misc
-##############
-# allow annotation of files
-# this requires rw-access to the
-# CVSROOT/history file (if you have one)
-# and rw-access to the subdirectory to
-# place the lock so you maybe don't want it
-$allow_annotate = 1;
-
-# allow pretty-printed version of files
-$allow_markup = 1;
-
-# allow compression with gzip
-# of output if the Browser accepts
-# it (HTTP_ACCEPT_ENCODING=gzip)
-# [make sure to have gzip in the path]
-$allow_compress = 1;
-
-# Make use of javascript functions.
-# This way you can select one of your CVSroot
-# without pressing 'Go' (.. if you do have more
-# than one CVSROOT defined)
-$use_java_script = 1;
-
-# open Download-Links in another window
-$open_extern_window = 1;
-
-# The size of this extern window; this size option
-# needs use_java_script to be defined
-# just comment them if you don't want to have a fixed
-# size
-#$extern_window_width = 600;
-#$extern_window_height = 440;
-
-# Edit Options
-# Enable form to edit your options (hideattic,sortbydate)
-# this isn't necessary if you've $dirtable defined 'cause
-# this allows editing of all your options more intuitive
-$edit_option_form = (not $dirtable);
-
-# remember to set the path to your
-# rcsutils: rlog, rcsdiff (gzip if you use compression)
-$ENV{'PATH'} = '/bin:/usr/bin';
-
-# If you have files which automatically refers to other files
-# (such as HTML) then this allows you to browse the checked
-# out files as if outside CVS.
-$checkout_magic = 1;
-
-# Show last changelog message for sub directories
-# The current implementation makes many assumptions and may show the
-# incorrect file at some times. The main assumption is that the last
-# modified file has the newest filedate. But some CVS operations
-# touches the file without even when a new version is't checked in,
-# and TAG based browsing essientially puts this out of order, unless
-# the last checkin was on the same tag as you are viewing.
-# Enable this if you like the feature, but don't rely on correct results.
-$show_subdir_lastmod = 0;
-
-# Background color of logentry in markup
-$markupLogColor = "#ffffff";
-
-# Show CVS log when viewing file contents
-$show_log_in_markup = 1;
-
-# Tabstop used to expand tabs in colored diffs. If undefined then
-# tabs are always expanded to 8 spaces.
-$tabstop = 8;
-
-# if you wish to display absolute times in your local timezone,
-# then define mytz and fill in the strings for your standard and
-# daylight time. Note that you must also make sure the system
-# timezone is correctly set.
-# @mytz=("EST", "EDT");
-
-# cvsweb is friendly to caches by indicating a suitable
-# last-modified timestamp. Doing this uses slightly more
-# CPU so you might want to disable it if you have a slow
-# server
-$use_moddate = 1;
-
-# Allows downloading a tarball of the current directory if set.
-# Bear in mind that this allows downloading a tarball of your entire
-# repository, which can take a lot of time and disk space to create!
-# If you enable this, you may need to make sure that cvsweb can write to
-# CVSROOT/val-tags, due to a bug in cvs.
-$allow_tar = '';
-
-#EOF
Include {gforge_etc}/httpd.secrets
</Directory>
+ ScriptAliasMatch ^/plugins/([^/]*)/cgi-bin/(.*) /usr/lib/gforge/plugins/$1/cgi-bin/$2
+
# Debian Sourceforge without the DNS delegation
# Project home pages are in a virtual /www/<group> location
AliasMatch ^/www/([^/]*)/(.*) {gforge_chroot}{groupdir}/$1/htdocs/$2
+++ /dev/null
-#
-# cvs.* hosts
-#
-# This is magic for virtual hosting!
-UseCanonicalName Off
-# This example is so beautiful that I keep it
-# And can be used in a better way e.g. creating a cvs directory by group
-<VirtualHost {ip_address}:80>
- ServerName cvs.{domain_name}
- ServerAlias cvs.*.{domain_name}
- DocumentRoot {gforge_chroot}{groupdir}/
- VirtualDocumentRoot {gforge_chroot}{groupdir}/%2/htdocs
- VirtualScriptAlias {gforge_chroot}{groupdir}/%2/cgi-bin
- <Directory {gforge_chroot}{groupdir}>
- Options Indexes FollowSymlinks
- AllowOverride All
- order allow,deny
- allow from all
- </Directory>
- LogFormat "%h %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" gforge
- CustomLog "|{cronolog_path} {var_log_gforge}/%Y/%m/%d/gforge.log" gforge
- # Ensure that we don't try to use SSL on SSL Servers
- <IfModule apache_ssl.c>
- SSLDisable
- </IfModule>
-</VirtualHost>
-
--- /dev/null
+//
+// Plugins configuration
+//
+// Path to plugins directory
+$sys_plugins_path='{sys_plugins_path}';
\ No newline at end of file
DEFAULTsys_localization_enable_timestamp_checking=true
DEFAULTsys_localinc=$ETCDIR/local.inc
DEFAULTsys_jabber_pass=$(dd if=/dev/urandom count=256 bs=1 2> /dev/null | md5sum | cut -b1-8)
+ DEFAULTsys_plugins_path=/usr/lib/gforge/plugins/
#
# TODO
#usr_lib_gforge=$GFGDIR
then
VHOST=$ETCDIR/httpd.d/55vhost
fi
- for i in $ETCDIR/httpd.d/[0-4][0-9]* $VHOST $ETCDIR/httpd.d/[6-9][0-9]* $ETCDIR/httpd.d/httpd.secrets
+ for i in $(ls -1 $ETCDIR/httpd.d/[0-4][0-9]* 2> /dev/null | grep -v dpkg) $VHOST $(ls -1 $ETCDIR/httpd.d/[6-9][0-9]* 2> /dev/null | grep -v dpkg) $ETCDIR/httpd.d/httpd.secrets
do
$BINDIR/fill-in-the-blanks.pl $i $ETCDIR/`basename $i`.gforge-new $CONFFILEOUT
done
$file_dir = "/var/lib/gforge/"; # Where should we stick files we're working with
$cvs_root = "/var/lib/gforge/chroot/cvsroot/"; # Where should we stick files we're working with
$dummy_uid = "9999"; # UserID of the dummy user that will own group's files
+$scm_uid = "9998"; # UserID of the dummy user that will be used for SCM systems such as Subversion
$date = int(time()/3600/24); # Get the number of days since 1/1/1970 for /etc/shadow
$ldap_prefix = "/usr/local/ldap/bin/"; # Where OpenLDAP tools installed
$chroot="/var/lib/gforge/chroot";
&db_connect;
+$scm_username = "gforge_scm" ;
+
# dump_header();
# if (!($#ARGV+1)) {
# exit;
# }
+print "dn: uid=$scm_username,ou=People,$sys_ldap_base_dn
+uid: $scm_username
+cn: Gforge SCM user
+objectClass: account
+objectClass: posixAccount
+objectClass: top
+objectClass: shadowAccount
+objectClass: debGforgeAccount
+userPassword: {crypt}x
+shadowLastChange: 10879
+shadowMax: 99999
+shadowWarning: 7
+loginShell: /bin/false
+debGforgeCvsShell: /bin/false
+uidNumber: $scm_uid
+gidNumber: $scm_uid
+homeDirectory: $chroot/svnroot
+gecos: Gforge SCM user
+
+" ;
+
#
# Dump user entries (ou=People)
#
while(my ($username) = $rel->fetchrow()) {
print "memberUid: $username\n";
}
+ print "memberUid: $scm_username\n" ;
print "\n";
}
while(my ($username) = $rel->fetchrow()) {
print "memberUid: $username\n";
}
+ print "memberUid: $scm_username\n" ;
print "\n";
}
return false;
}
+ $hook_params = array () ;
+ $hook_params['group_id'] = $group_id ;
+ plugin_hook ("group_approved", $hook_params) ;
+
return true;
}
(($toptab == 'news') ? $selected=(count($TABS_TITLES)-1) : '' );
}
- // CVS
+ // SCM systems
if ($project->usesCVS()) {
$TABS_DIRS[]='/scm/?group_id='.$group;
$TABS_TITLES[]=$Language->getText('group','short_cvs');
(($toptab == 'scm_index') ? $selected=(count($TABS_TITLES)-1) : '' );
}
+ // groupmenu_after_scm hook
+ $hookParams['DIRS'] = &$TABS_DIRS;
+ $hookParams['TITLES'] = &$TABS_TITLES;
+ $hookParams['toptab'] = &$toptab;
+ $hookParams['selected'] = &$selected;
+ $hookParams['group_id'] = $group ;
+
+ plugin_hook ("groupmenu_scm", $hookParams) ;
+
// Downloads
if ($project->usesFRS()) {
$TABS_DIRS[]='/frs/?group_id='.$group;
$TABS_TITLES[]=$Language->getText('group','short_files');
(($toptab == 'frs') ? $selected=(count($TABS_TITLES)-1) : '' );
}
- // groupmenu Hook
+
+ // groupmenu hook
$hookParams['DIRS'] = &$TABS_DIRS;
$hookParams['TITLES'] = &$TABS_TITLES;
$hookParams['toptab'] = &$toptab;
$hookParams['group'] = $group;
plugin_hook ("groupmenu", $hookParams) ;
+
echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,true,$selected,'white','100%');
}
}
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
?>
account_change_pw_changed return_to You should now $1 Return to UserPrefs $2.
account_change_pw_changed title Successfully Changed Password
account_editsshkeys section Account Preferences
-account_editsshkeys title Edit CVS/SSH Shared Keys
+account_editsshkeys title Edit SSH Shared Keys
account_first about_blurb <p>You are now a registered user on $1, the online development environment for Open Source projects.</p><p>As a registered user, you can participate fully in the activities on the site. You may now post messages to the project message forums, post bugs for software in $1, sign on as a project developer, or even start your own project.</p><p>Enjoy the site, and please provide us with feedback on ways that we can improve $1.</p><p>--the $1 staff.</p>
account_first title Welcome to $1
account_login cookiewarn Cookies must be enabled past this point.
account_register timezone Timezone:
account_register title New Account Registration
account_register update Update
-account_shell autorized_keys CVS/SSH Shared Authorized Keys
+account_shell autorized_keys SSH Shared Authorized Keys
account_shell edit_keys Edit Keys
account_shell shell_box Shell box
account_shell title Shell Account Information
project_admin mail_admin Mail Admin
project_admin news_admin News Admin
project_admin packages Packages
+project_admin plugins_admin Plugins Admin
project_admin project_information Misc. Project Information
+project_admin scm_admin SCM Admin
project_admin section Project: $1
project_admin shell_server Group shell (SSH) server:
project_admin shell_server_group_directory Group directory on shell server:
scm_index modulename modulename
scm_index nohistory This project has no CVS history.
scm_index section Project: $1
-scm_index title CVS
+scm_index title SCM
search artifact_author Submitted By
search artifact_date Date
search artifact_id #
account_change_pw_changed return_to Vous devriez maintenant $1 Retourner aux préférences utilisateur $2.
account_change_pw_changed title Changement de mot de passe réussi.
account_editsshkeys section Mes préférences
-account_editsshkeys title Édition des clefs publiques CVS/SSH
+account_editsshkeys title Édition des clefs publiques SSH
account_first about_blurb <p>Vous êtes maintenant un utilisateur enregistré dans $1, environnement de développement de logiciels libres.</p><p>En tant qu'utilisateur enregistré, vous pouvez participer pleinement aux activités du site. Vous pouvez maintenant adresser des messages dans les forums des projets, faire remonter des bogues dans $1, vous proposer comme développeur d'un projet, et même lancer votre propre projet.</p><p>Profitez du site et n'hésitez pas à nous faire part de vos remarques sur la manière d'améliorer $1.</p><p>-- L'équipe de $1</p>
account_first title Bienvenue sur $1
account_login cookiewarn Vous devez activer les cookies pour aller plus loin.
account_register timezone Fuseau horaire :
account_register title Nouvelle inscription
account_register update Mettre à jour
-account_shell autorized_keys Clés publiques CVS/SSH autorisées
+account_shell autorized_keys Clés publiques SSH autorisées
account_shell edit_keys Éditer les clés
account_shell shell_box Serveur shell
account_shell title Informations relatives au compte shell
scm_index modulename module
scm_index nohistory Ce projet n'a pas d'historique CVS
scm_index section Projet : $1
-scm_index title CVS
+scm_index title SCM
search artifact_author Soumis par
search artifact_date Date
search artifact_id #
require_once('common/include/Plugin.class') ;
require_once('common/include/PluginManager.class') ;
+// SCM-specific plugins subsystem
+require_once('common/include/SCM.class') ;
+
setup_plugin_manager () ;
//determine if they're logged in
if (!$cvs_add_num) {
$cvs_add_num=0;
}
- echo ' ( '.$Language->getText('project_home','cvs_commits',array(number_format($cvs_commit_num,0),number_format($cvs_add_num,0)))." )";
+ echo ' (CVS: '.$Language->getText('project_home','cvs_commits',array(number_format($cvs_commit_num,0),number_format($cvs_add_num,0))).")";
if ($cvs_commit_num || $cvs_add_num) {
echo '<br /> -
<a href="'.account_group_cvsweb_url($project->getUnixName()).'">
Browse CVS</a>';
}
+ $hook_params = array () ;
+ $hook_params['group_id'] = $group_id ;
+ plugin_hook ("scm_stats", $hook_params) ;
}
$HTML->footer(array());
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
?>
<a href="/pm/admin/?group_id=<?php echo $group->getID(); ?>"><?php echo $Language->getText('project_admin','task_manager_admin') ?></a><br />
<a href="/forum/admin/?group_id=<?php echo $group->getID(); ?>"><?php echo $Language->getText('project_admin','forum_admin') ?></a><br />
<a href="/frs/admin/?group_id=<?php echo $group->getID(); ?>"><?php echo $Language->getText('project_admin','frs_admin') ?></a><br />
+<a href="/scm/admin/?group_id=<?php echo $group->getID(); ?>"><?php echo $Language->getText('project_admin','scm_admin') ?></a><br />
<?php echo $HTML->boxBottom(); ?>
</td>
+</tr>
-<td> </td>
+<tr>
+<td>
+<?php
+if (plugin_hook_listeners ("project_admin_plugins") > 0) {
+ echo $HTML->boxTop($Language->getText('project_admin','plugins_admin'));
+ $hook_params = array () ;
+ $hook_params['group_id'] = $group_id ;
+ plugin_hook ("project_admin_plugins", $hook_params) ;
+ echo $HTML->boxBottom();
+}
+?>
+</td>
</tr>
+
</table>
<?php
project_admin_footer(array());
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
?>
--- /dev/null
+<?php
+/**
+ *
+ * SourceForge CVS Frontend
+ *
+ * SourceForge: Breaking Down the Barriers to Open Source Development
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * http://sourceforge.net
+ *
+ * @version $Id$
+ *
+ */
+
+
+require_once('pre.php');
+require_once('common/include/account.php');
+
+//only projects can use cvs, and only if they have it turned on
+$project =& group_get_object($group_id);
+
+if (!$project->isProject()) {
+ exit_error('Error',$Language->getText('scm_index','error_only_projects_can_use_cvs'));
+}
+if (!$project->usesCVS()) {
+ exit_error('Error',$Language->getText('scm_index','error_this_project_has_turned_off'));
+}
+
+site_project_header(array('title'=>$Language->getText('scm_index','cvs_repository'),'group'=>$group_id,'toptab'=>'scm_index','pagename'=>'scm_index','sectionvals'=>array($project->getPublicName())));
+
+if ($submit) {
+ $hook_params = array () ;
+ $hook_params['group_id'] = $group_id ;
+ $scmvars = array_keys ($_GET) ;
+ foreach ($_GET as $key => $value) {
+ foreach ($scm_list as $scm) {
+ if ($key == strstr($key, $scm . "_")) {
+ $hook_params[$key] = $value ;
+ }
+ }
+ }
+ plugin_hook ("scm_admin_update", $hook_params) ;
+}
+
+?>
+<form action="/scm/admin/index.php?group_id=<?php echo $group_id; ?>">
+<?php
+
+ $hook_params = array () ;
+ $hook_params['group_id'] = $group_id ;
+ plugin_hook ("scm_admin_page", $hook_params) ;
+?>
+<input type="hidden" name="group_id" value="<?php echo $group_id; ?>">
+<input type="submit" name="submit" value="Update">
+</form>
+<?php
+
+site_project_footer(array());
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>
+++ /dev/null
-<?php
-/**
- *
- * SourceForge CVS Frontend
- *
- * SourceForge: Breaking Down the Barriers to Open Source Development
- * Copyright 1999-2001 (c) VA Linux Systems
- * http://sourceforge.net
- *
- * @version $Id$
- *
- */
-
-
-require_once('pre.php');
-require_once('common/include/account.php');
-require_once('common/include/cvsweb/ErrorHandler.class');
-require_once('common/include/cvsweb/DirectoryHandler.class');
-require_once('common/include/cvsweb/FileHandler.class');
-require_once('common/include/cvsweb/RCSHandler.class');
-
-//only projects can use cvs, and only if they have it turned on
-$project =& group_get_object($group_id);
-$cvsroot = $project->getUnixName();
-$sys_cvsroot_dir = '/cvsroot/';
-
-if (!$project->isProject()) {
- exit_error($Language->getText('scm_index','error_only_projects_can_use_cvs'));
-}
-if (!$project->usesCVS()) {
- exit_error($language->getText('scm_index','error_this_project_has_turned_off'));
-}
-
-site_project_header(array('title'=>$Language->getText('scm_index','cvs_repository'),'group'=>$group_id,'toptab'=>'scm_index','pagename'=>'scm_index','sectionvals'=>array($project->getPublicName())));
-
-if($project->enableAnonCVS()) {
- $allow = 1;
-} else {
- if(session_loggedin()) {
- $user =& session_get_user();
- $memberRole = $project->getMemberRole($user->getID());
- if($memberRole == 1 || $memberRole == 2) {//only for Project Manager & Developer - others must not view sources
- $allow = 1;
- } else {
- $allow = 0;
- }
- } else {
- $allow = 0;
- }
-}
-
-if ($allow)
-{
- $DHD = new DirectoryHandler();
- $FHD = new FileHandler();
- $RCH = new RCSHandler();
- $CVSROOT = $sys_cvsroot_dir.$cvsroot;
- $DIRNAME = ($dir_name != "")?"/$dir_name":"";
- $DIRNAME = $CVSROOT.$DIRNAME;
-
- $DIRPATH = explode("/",$dir_name);
- echo("Current directory: ");
- for($i=0;$i<count($DIRPATH);$i++)
- {
- $LINKPATH = array();
- for($j=0;$j<=$i;$j++)
- $LINKPATH[] = $DIRPATH[$j];
- $LINK = implode("/",$LINKPATH);
- $value = ($DIRPATH[$i] == "")?$project->getPublicName():$DIRPATH[$i];
- echo("<b><a href=\"/scm/controlleroo.php?group_id=$group_id&dir_name=$LINK&hide_attic=$hide_attic\">[$value]</a>/</b>");
- }
-
- if($hide_attic)
- echo("<br><br>[<a href=\"/scm/controlleroo.php?group_id=$group_id&dir_name=$dir_name&hide_attic=0\">Unhide Attic</a>]");
- else
- echo("<br><br>[<a href=\"/scm/controlleroo.php?group_id=$group_id&dir_name=$dir_name&hide_attic=1\">Hide Attic</a>]");
-
- echo("<br>");
-
- // hide some files and directories
- $hideFile = ".|CVS";
- if($hide_attic)
- $hideFile .= "|Attic";
-
- $DHD->hideFiles($hideFile);
-
- if(false === ($dirContent = $DHD->readDirectory($DIRNAME)))
- echo("Error: ".$DHD->getError());
-
- echo("<table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" width=\"100%\">");
- echo("<tr>");
- echo("<td width=\"20%\" bgcolor=\"#AAAAAA\"><b>File</b></td>");
- echo("<td width=\"10%\" bgcolor=\"#AAAAAA\"><b>REV</b></td>");
- echo("<td width=\"10%\" bgcolor=\"#AAAAAA\"><b>Age</b></td>");
- echo("<td width=\"10%\" bgcolor=\"#AAAAAA\"><b>Author</b></td>");
- echo("<td width=\"50%\" bgcolor=\"#AAAAAA\"><b>Last log entry</b></td>");
- echo("</tr>");
- $i = 0;
- foreach($dirContent AS $k=>$v)
- {
- $bgc = "#F0F0F0";
- if($i % 2 == 0)
- $bgc = "#FFFFFF";
- $i++;
- if($FHD->getFileType($DIRNAME."/".$v) == 1)
- {
- echo("<tr><td colspan=\"5\" width=\"100%\" bgcolor=\"".$bgc."\"><b> ");
- echo("<a href=\"/scm/controlleroo.php?group_id=$group_id&dir_name=$dir_name/$v&hide_attic=$hide_attic\">$v</a>");
- echo("</b></td></tr>");
- }
- //elseif(substr($v,-2) == ",v")
- else
- {
- $rcsFile = $DIRNAME."/".$v;
- $fileName = substr($v,0,-2);
- if(false === ($rcsInfo = $RCH->getRevisionInfo($rcsFile)))
- echo($RCH->getError());
- $fileLink = "<a href=\"/scm/viewFile.php?group_id=$group_id&file_name=$dir_name/$fileName&hide_attic=$hide_attic\">$fileName</a>";
- // create 'Age' string
- $age = time() - strtotime($rcsInfo['DATE']);
- if($age < 24*3600)
- {
- $age /= 3600;
- $age = floor($age)." hour(s)";
- }
- elseif($age < 30*24*3600)
- {
- $age /= 24*3600;
- $age = floor($age)." day(s)";
- }
- else
- {
- $age /= 30*24*3600;
- $age = floor($age)." month(s)";
- }
- echo("<tr>");
- echo("<td width=\"20%\" bgcolor=\"".$bgc."\">» ".$fileLink."</td>");
- echo("<td width=\"10%\" bgcolor=\"".$bgc."\">".$rcsInfo['REV']."</td>");
- echo("<td width=\"10%\" bgcolor=\"".$bgc."\">".$age."</td>");
- echo("<td width=\"10%\" bgcolor=\"".$bgc."\">".$rcsInfo['AUTHOR']."</td>");
- echo("<td width=\"50%\" bgcolor=\"".$bgc."\">".$rcsInfo['LOG']."</td>");
- echo("</tr>");
- }
- }
- echo("</table>");
-}
-else
-{
- echo("Error: u don't have acces rigths to <b>".$project->getPublicName()."</b> CVS root = $cvsroot");
-}
-site_project_footer(array());
-?>
site_project_header(array('title'=>$Language->getText('scm_index','cvs_repository'),'group'=>$group_id,'toptab'=>'scm_index','pagename'=>'scm_index','sectionvals'=>array($project->getPublicName())));
-if($GLOBALS['sys_cvs_single_host']) {
- $cvsrootend=$GLOBALS['sys_cvs_host'].':/cvsroot/'.$project->getUnixName();
-} else {
- $cvsrootend='cvs.'.$project->getUnixName().'.'.$GLOBALS['sys_cvs_host'].':/cvsroot/'.$project->getUnixName();
-}
-// ######################## table for summary info
-?>
-
-<table width="100%">
- <tr valign="top">
- <td width="65%">
-
-<?php
-// ######################## anonymous CVS instructions
-if ($project->enableAnonCVS() && $project->enablePserver()) {
-?>
- <?php echo $Language->getText('scm_index', 'anoncvs'); ?>
- <p>
- <tt>cvs -d:pserver:anonymous@<?php echo $cvsrootend; ?> login
- <br />
- <br />
- cvs -z3 -d:pserver:anonymous@<?php echo $cvsrootend; ?> co <i>modulename</i>
- </tt>
- </p>
- <?php echo $Language->getText('scm_index', 'anoncvsup'); ?>
-<?php
-}
-?>
-
-<?php
-// ############################ developer access
-?>
- <?php echo $Language->getText('scm_index', 'devcvs'); ?>
- <p>
- <tt>export CVS_RSH=ssh
- <br />
- <br />cvs -z3 -d:ext:<i>developername</i>@<?php echo $cvsrootend; ?> co <i>modulename</i>
- </tt>
- </p>
-<?php
-// ################## summary info
-?>
- </td>
- <td width="35%">
- <?php echo $HTML->boxTop($Language->getText('scm_index', 'history')); ?>
-<?php
-// ######################### CVS
-
-$result = db_query("
- SELECT u.realname, sum(commits) as commits, sum(adds) as adds, sum(adds+commits) as combined
- FROM stats_cvs_user s, users u
- WHERE group_id='$group_id' AND s.user_id=u.user_id AND (commits>0 OR adds >0)
- GROUP BY group_id, realname
- ORDER BY combined DESC, realname;
-");
-
-if (db_numrows($result) > 0) {
- print '<hr size="1" />';
-
- $headerMapping = array(
- 'realname' => array("Name", 'width="60%"'),
- 'adds' => array("Adds", 'width="20%"'),
- 'commits' => array("Commits", 'width="20%"')
- );
- ShowResultSet($result,'', false, true, $headerMapping, array('combined'));
-}
-else {
- echo $Language->getText('scm_index', 'nohistory');
-}
-
-// ############################## CVS Browsing
-
-$anonymous = 1;
-if (session_loggedin()) {
- $perm =& $project->getPermission(session_get_user());
- $anonymous = !$perm->isMember();
-}
-
-if ($project->enableAnonCVS() || !$anonymous) {
- echo $Language->getText('scm_index', 'browsetree');
-?>
- <ul>
- <li>Christian Bayle did it<br /><a href="/scm/cvsweb.php/?cvsroot=<?php print $project->getUnixName(); ?>">
- <b><?php echo $Language->getText('scm_index', 'browseit'); ?> (cvsweb php wrapper)</b></a>
- </li>
- <li><a href="<?php print account_group_cvsweb_url($project->getUnixName()); ?>">
- <b><?php echo $Language->getText('scm_index', 'browseit'); ?> (cvsweb)</b></a>
- </li>
- <li>Ronald Petty contrib<br /><a href="/scm/controller.php?group_id=<?php echo $group_id; ?>">
- <b><?php echo $Language->getText('scm_index', 'browseit'); ?> (php)</b></a>
- </li>
- <li>Dragos Moinescu contrib<br /><a href="/scm/controlleroo.php?group_id=<?php echo $group_id; ?>&hide_attic=0">
- <b><?php echo $Language->getText('scm_index', 'browseit'); ?> (php OO)</b></a>
- </li>
- </ul>
-<?php
-}
-
-echo $HTML->boxBottom();
-
-?>
- </td>
- </tr>
-</table>
+$hook_params = array () ;
+$hook_params['group_id'] = $group_id ;
+plugin_hook ("scm_page", $hook_params) ;
-<?php site_project_footer(array()); ?>
+site_project_footer(array()); ?>
+++ /dev/null
-<?php
-/**
- *
- * SourceForge CVS Frontend
- *
- * SourceForge: Breaking Down the Barriers to Open Source Development
- * Copyright 1999-2001 (c) VA Linux Systems
- * http://sourceforge.net
- *
- * @version $Id$
- *
- */
-
-
-require_once('pre.php');
-require_once('common/include/account.php');
-
-require_once('common/include/cvsweb/ErrorHandler.class');
-require_once('common/include/cvsweb/DirectoryHandler.class');
-require_once('common/include/cvsweb/FileHandler.class');
-require_once('common/include/cvsweb/RCSHandler.class');
-
-//only projects can use cvs, and only if they have it turned on
-$project =& group_get_object($group_id);
-$cvsroot = $project->getUnixName();
-$sys_cvsroot_dir = '/cvsroot/';
-
-if (!$project->isProject()) {
- exit_error($Language->getText('scm_index','error_only_projects_can_use_cvs'));
-}
-if (!$project->usesCVS()) {
- exit_error($language->getText('scm_index','error_this_project_has_turned_off'));
-}
-
-site_project_header(array('title'=>$Language->getText('scm_index','cvs_repository'),'group'=>$group_id,'toptab'=>'scm_index','pagename'=>'scm_index','sectionvals'=>array($project->getPublicName())));
-
-if($project->enableAnonCVS()) {
- $allow = 1;
-} else {
- if(session_loggedin()) {
- $user =& session_get_user();
- $memberRole = $project->getMemberRole($user->getID());
- if($memberRole == 1 || $memberRole == 2) {//only for Project Manager & Developer - others must not view sources
- $allow = 1;
- } else {
- $allow = 0;
- }
- } else {
- $allow = 0;
- }
-}
-
-if($allow) {
- $DHD = new DirectoryHandler();
- $FHD = new FileHandler();
- $RCH = new RCSHandler();
- $CVSROOT = $GLOBALS['sys_cvsroot_dir'].$cvsroot;
- $DIRNAME = ($file_name != "")?"$file_name":"";
- $DIRNAME = $CVSROOT.$DIRNAME;
-
- $DIRPATH = explode("/",$file_name);
- for($i=0;$i<count($DIRPATH)-1;$i++) {
- $LINKPATH = array();
- for($j=0;$j<=$i;$j++)
- $LINKPATH[] = $DIRPATH[$j];
- $LINK = implode("/",$LINKPATH);
- $value = ($DIRPATH[$i] == "")?"CVSROOT":$DIRPATH[$i];
- echo("<b><a href=\"/scm/index.php?group_id=$group_id&dir_name=$LINK&hide_attic=$hide_attic\">$value</a>/</b>");
- }
-
- echo("<br>");
- echo("<br>");
- $value = "<font size=\"+2\"><b>".$DIRPATH[count($DIRPATH)-1]."</b></font>";
- $fileLink = "<a href=\"/scm/viewFile.php?group_id=$group_id&file_name=$file_name&r2=$r2&hide_attic=$hide_attic\">$value</a>";
- echo($fileLink);
- echo("<br>");
- echo("<br>");
-
- if($view_action == "")
- $view_action = "l";
-
- $RCSFile = $DIRNAME.",v";
- switch($view_action) {
- case "l":
- if(false === $RCH->getRCSLog($RCSFile))
- echo("Error: ".$RCH->getError());
-
- if (false === ($revisions = $RCH->handleRCSLog())) {
- echo("Error: ".$RCH->getError());
- } else {
- $diffr = "";
- foreach($revisions AS $k=>$v) {
- $viewLink = "<a href=\"/scm/viewFile.php?group_id=$group_id&file_name=$file_name&view_action=v&r=".$v['REV']."&hide_attic=$hide_attic\">view file</a>";
- $diffLink = "<a href=\"/scm/viewFile.php?group_id=$group_id&file_name=$file_name&view_action=d&r2=$diffr&r1=".$v['REV']."&hide_attic=$hide_attic\">revision $diffr</a>";
- if(isset($r2) && $r2 != "")
- $diffLink .= ", or selected <a href=\"/scm/viewFile.php?group_id=$group_id&file_name=$file_name&view_action=d&r2=$r2&r1=".$v['REV']."&hide_attic=$hide_attic\">revision $r2</a>";
- $selectForDiff = "<a href=\"/scm/viewFile.php?group_id=$group_id&file_name=$file_name&view_action=l&r2=".$v['REV']."&hide_attic=$hide_attic\">select for diff</a>";
- echo("<b>Revision:</b> ".$v['REV']." ($viewLink) - ($selectForDiff)<br>");
- echo("<b>Date:</b> ".$v['DATE']."<br>");
- echo("<b>Author:</b> ".$v['AUTHOR']."<br>");
- echo("<b>Branch:</b> ".$v['BRANCH']."<br>");
- echo("<b>Log:</b> ".$v['LOG']."<br>");
- echo("<b>Diff To:</b> $diffLink<br>");
- echo("<hr>");
- $diffr = $v['REV'];
- }
- }
- break;
- case "v":
- if(false === ($content = $RCH->getRCSContent($RCSFile,$r)))
- echo("Error: ".$RCH->getError());
- $content = str_replace("\n","<br>",$content);
- $content = str_replace("\t"," ",$content);
- echo($content);
- break;
- case "d":
- $diffL1 = "<a href=\"/scm/viewFile.php?group_id=$group_id&file_name=$file_name&view_action=d&r2=$r2&r1=$r1&diff_type=SC&hide_attic=$hide_attic\">Short Color Diff</a>";
- $diffL2 = "<a href=\"/scm/viewFile.php?group_id=$group_id&file_name=$file_name&view_action=d&r2=$r2&r1=$r1&diff_type=LC&hide_attic=$hide_attic\">Long Color Diff</a>";
- $diffL3 = "<a href=\"/scm/viewFile.php?group_id=$group_id&file_name=$file_name&view_action=d&r2=$r2&r1=$r1&diff_type=U&hide_attic=$hide_attic\">Unified Diff</a>";
- echo("<b>".$diffL1." | ".$diffL2." | ".$diffL3."</b><br><br>");
- if($diff_type == "")
- $diff_type = "LC";
- if(false === ($content = $RCH->doDiff($RCSFile,$r1,$diff_type,$r2)))
- echo("Error: ".$RCH->getError());
- echo($content);
- break;
- }
-} else {
- echo("Error: u don't have acces rigths to <b>".$project->getPublicName()."</b> CVS root");
-}
-
-site_project_footer(array());
-
-?>