# added databse_port to codepot.ini.in
# fixed some code for postgresql # added codepot.pgsql
This commit is contained in:
parent
8bc9834807
commit
f3e0be9e00
@ -17,6 +17,7 @@ Source0: %{name}-%{version}.tar.gz
|
||||
|
||||
Requires: httpd %{php_package_name} %{php_package_name}-ldap %{php_package_name}-mysql %{php_package_name}-gd subversion subversion-perl mod_dav_svn mod_perl perl perl-LDAP perl-Config-Simple perl-URI perl-DBI perl-Digest-SHA1
|
||||
# %{php_package_name}-pecl-svn > 1.2.0
|
||||
# %{php_package_name}-pgsql perl-DBD-Pg
|
||||
|
||||
BuildRequires: subversion-devel neon-devel %{php_package_name}-devel
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||
@ -70,6 +71,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%config(noreplace) /etc/codepot/codepot.ini
|
||||
/etc/codepot/codepot.mysql
|
||||
/etc/codepot/codepot.pgsql
|
||||
/etc/codepot/codepot.a2ldap
|
||||
/etc/codepot/codepot.httpd
|
||||
/etc/codepot/start-commit
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
cfgdir=$(CFGDIR)
|
||||
cfg_DATA = codepot.ini codepot.mysql codepot.a2ldap codepot.httpd
|
||||
cfg_DATA = codepot.ini codepot.mysql codepot.pgsql codepot.a2ldap codepot.httpd
|
||||
cfg_SCRIPTS = start-commit pre-commit post-commit pre-revprop-change post-revprop-change cloc.pl
|
||||
|
||||
perldir=$(CFGDIR)/perl/Codepot
|
||||
|
@ -207,7 +207,7 @@ top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
wwwdir = @wwwdir@
|
||||
cfg_DATA = codepot.ini codepot.mysql codepot.a2ldap codepot.httpd
|
||||
cfg_DATA = codepot.ini codepot.mysql codepot.pgsql codepot.a2ldap codepot.httpd
|
||||
cfg_SCRIPTS = start-commit pre-commit post-commit pre-revprop-change post-revprop-change cloc.pl
|
||||
perldir = $(CFGDIR)/perl/Codepot
|
||||
perl_SCRIPTS = perl/Codepot/AccessHandler.pm perl/Codepot/AuthenHandler.pm
|
||||
|
@ -10,8 +10,11 @@ default_site_name = "@PACKAGE@"
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; database settings
|
||||
;
|
||||
; database_driver: mysql for MySQL, postgre for PostgreSQL
|
||||
;------------------------------------------------------------------------------
|
||||
database_hostname = "localhost"
|
||||
database_port = ""
|
||||
database_username = ""
|
||||
database_password = ""
|
||||
database_name = ""
|
||||
|
@ -173,12 +173,30 @@ CREATE TABLE file (
|
||||
|
||||
UNIQUE KEY file_id (projectid, name),
|
||||
UNIQUE KEY (encname),
|
||||
INDEX tagged_file_id (projectid, tag, name),
|
||||
INDEX file_tagged_name (projectid, tag, name),
|
||||
|
||||
CONSTRAINT file_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
) charset=utf8 engine=InnoDB;
|
||||
|
||||
CREATE TABLE code_review (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
rev BIGINT NOT NULL,
|
||||
sno BIGINT NOT NULL,
|
||||
comment TEXT NOT NULL,
|
||||
|
||||
createdon DATETIME NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
|
||||
updatedon DATETIME NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL,
|
||||
|
||||
UNIQUE KEY code_review_id (projectid, rev, sno),
|
||||
|
||||
CONSTRAINT code_review_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
) charset=utf8 engine=InnoDB;
|
||||
|
||||
CREATE TABLE log (
|
||||
id BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
@ -204,20 +222,3 @@ CREATE TABLE user (
|
||||
enabled CHAR(1) NOT NULL DEFAULT 'N' CHECK(enabled in ('Y', 'N'))
|
||||
) charset=utf8 engine=InnoDB;
|
||||
|
||||
CREATE TABLE code_review (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
rev BIGINT NOT NULL,
|
||||
sno BIGINT NOT NULL,
|
||||
comment TEXT NOT NULL,
|
||||
|
||||
createdon DATETIME NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
|
||||
updatedon DATETIME NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL,
|
||||
|
||||
UNIQUE KEY code_review_id (projectid, rev, sno),
|
||||
|
||||
CONSTRAINT code_review_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
) charset=utf8 engine=InnoDB;
|
||||
|
245
codepot/etc/codepot.pgsql
Normal file
245
codepot/etc/codepot.pgsql
Normal file
@ -0,0 +1,245 @@
|
||||
-- ------------------------------------------------------------
|
||||
-- This file is the Codepot database schema file for PostreSQL.
|
||||
-- Note this file doesn't mandate which database to use.
|
||||
--
|
||||
-- Assumining "local all all password" in /var/lib/pgsql/data/pg_hba.conf
|
||||
--
|
||||
-- $ sudo -u postgres psql
|
||||
-- postgres=# CREATE USER codepot WITH PASSWORD 'codepot';
|
||||
-- postgres=# \du
|
||||
-- postgres=# CREATE DATABASE codepot;
|
||||
-- postgres=# \l
|
||||
-- postgres=# ALTER DATABASE "codepot" OWNER TO codepot;
|
||||
-- postgres=# \l
|
||||
-- postgres=# \q
|
||||
--
|
||||
-- $ psql -U codepot -W codepot
|
||||
-- postgres=# \i codepot.pgsql
|
||||
-- postgres=# \dt
|
||||
-- postgres=# \q
|
||||
-- ------------------------------------------------------------
|
||||
|
||||
CREATE TABLE site (
|
||||
id VARCHAR(32) PRIMARY KEY,
|
||||
name VARCHAR(128) NOT NULL,
|
||||
summary VARCHAR(255) NOT NULL,
|
||||
text TEXT NOT NULL,
|
||||
|
||||
createdon TIMESTAMP NOT NULL,
|
||||
updatedon TIMESTAMP NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE project (
|
||||
id VARCHAR(32) PRIMARY KEY,
|
||||
name VARCHAR(255) UNIQUE NOT NULL,
|
||||
summary VARCHAR(255) NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
commitable CHAR(1) NOT NULL DEFAULT 'Y',
|
||||
public CHAR(1) NOT NULL DEFAULT 'Y',
|
||||
|
||||
createdon TIMESTAMP NOT NULL,
|
||||
updatedon TIMESTAMP NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL
|
||||
|
||||
);
|
||||
|
||||
CREATE TABLE project_membership (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
userid VARCHAR(32) NOT NULL,
|
||||
priority INTEGER NOT NULL,
|
||||
UNIQUE (projectid, userid),
|
||||
CONSTRAINT membership_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE wiki (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
text TEXT NOT NULL,
|
||||
columns INT NOT NULL DEFAULT 1,
|
||||
|
||||
createdon TIMESTAMP NOT NULL,
|
||||
updatedon TIMESTAMP NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL,
|
||||
|
||||
UNIQUE (projectid, name),
|
||||
|
||||
CONSTRAINT wiki_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE wiki_attachment (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
wikiname VARCHAR(255) NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
encname VARCHAR(255) NOT NULL,
|
||||
|
||||
createdon TIMESTAMP NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
|
||||
UNIQUE (projectid, wikiname, name),
|
||||
|
||||
CONSTRAINT wiki_attachment_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
|
||||
CONSTRAINT wiki_attachment_wikiid FOREIGN KEY (projectid,wikiname) REFERENCES wiki(projectid,name)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE issue (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
id BIGINT NOT NULL,
|
||||
summary VARCHAR(255) NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
|
||||
type VARCHAR(32) NOT NULL,
|
||||
status VARCHAR(32) NOT NULL,
|
||||
owner VARCHAR(255) NOT NULL,
|
||||
priority VARCHAR(32) NOT NULL,
|
||||
|
||||
createdon TIMESTAMP NOT NULL,
|
||||
updatedon TIMESTAMP NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL,
|
||||
|
||||
PRIMARY KEY (projectid, id),
|
||||
|
||||
CONSTRAINT issue_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX issue_status_type_summary ON issue(projectid, status, type, summary);
|
||||
|
||||
CREATE INDEX issue_summary ON issue(projectid, summary);
|
||||
|
||||
CREATE TABLE issue_attachment (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
issueid BIGINT NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
encname VARCHAR(255) NOT NULL,
|
||||
|
||||
createdon TIMESTAMP NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
|
||||
UNIQUE (projectid, issueid, name),
|
||||
|
||||
CONSTRAINT issue_attachment_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
|
||||
CONSTRAINT issue_attachment_issueid FOREIGN KEY (projectid,issueid) REFERENCES issue(projectid,id)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE issue_change (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
id BIGINT NOT NULL,
|
||||
sno BIGINT NOT NULL,
|
||||
|
||||
type VARCHAR(32) NOT NULL,
|
||||
status VARCHAR(32) NOT NULL,
|
||||
owner VARCHAR(255) NOT NULL,
|
||||
priority VARCHAR(32) NOT NULL,
|
||||
comment TEXT NOT NULL,
|
||||
|
||||
updatedon TIMESTAMP NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL,
|
||||
|
||||
PRIMARY KEY (projectid, id, sno),
|
||||
|
||||
CONSTRAINT issue_update_id FOREIGN KEY (projectid,id) REFERENCES issue(projectid,id)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX issue_update_time ON issue_change(projectid, id, updatedon);
|
||||
|
||||
CREATE TABLE issue_change_attachment (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
issueid BIGINT NOT NULL,
|
||||
issuesno BIGINT NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
encname VARCHAR(255) NOT NULL,
|
||||
|
||||
createdon TIMESTAMP NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
|
||||
UNIQUE (projectid, issueid, name),
|
||||
|
||||
CONSTRAINT issue_change_attachment_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
|
||||
CONSTRAINT issue_change_attachment_issueidsno FOREIGN KEY (projectid,issueid,issuesno) REFERENCES issue_change(projectid,id,sno)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE file (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
encname VARCHAR(255) NOT NULL,
|
||||
tag VARCHAR(54) NOT NULL,
|
||||
summary VARCHAR(255) NOT NULL,
|
||||
md5sum CHAR(32) NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
|
||||
createdon TIMESTAMP NOT NULL,
|
||||
updatedon TIMESTAMP NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL,
|
||||
|
||||
UNIQUE (projectid, name),
|
||||
UNIQUE (encname),
|
||||
|
||||
CONSTRAINT file_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX file_tagged_name ON file(projectid, tag, name);
|
||||
|
||||
|
||||
CREATE TABLE code_review (
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
rev BIGINT NOT NULL,
|
||||
sno BIGINT NOT NULL,
|
||||
comment TEXT NOT NULL,
|
||||
|
||||
createdon TIMESTAMP NOT NULL,
|
||||
createdby VARCHAR(32) NOT NULL,
|
||||
|
||||
updatedon TIMESTAMP NOT NULL,
|
||||
updatedby VARCHAR(32) NOT NULL,
|
||||
|
||||
UNIQUE (projectid, rev, sno),
|
||||
|
||||
CONSTRAINT code_review_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE log (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
projectid VARCHAR(32) NOT NULL,
|
||||
type VARCHAR(16) NOT NULL,
|
||||
action VARCHAR(16) NOT NULL,
|
||||
userid VARCHAR(32) NOT NULL,
|
||||
message TEXT NOT NULL,
|
||||
createdon TIMESTAMP NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX log_timed_project_type_action ON log(createdon, projectid, type, action);
|
||||
|
||||
CREATE TABLE user_settings (
|
||||
userid VARCHAR(32) PRIMARY KEY,
|
||||
code_hide_line_num CHAR(1) NOT NULL,
|
||||
code_hide_metadata CHAR(1) NOT NULL,
|
||||
icon_name VARCHAR(255) UNIQUE NULL
|
||||
);
|
||||
|
||||
CREATE TABLE "user" (
|
||||
userid VARCHAR(32) PRIMARY KEY,
|
||||
passwd VARCHAR(255) NOT NULL,
|
||||
email VARCHAR(255),
|
||||
enabled CHAR(1) NOT NULL DEFAULT 'N' CHECK(enabled in ('Y', 'N'))
|
||||
);
|
@ -23,6 +23,7 @@ sub get_config
|
||||
|
||||
my $config = {
|
||||
database_hostname => $cfg->param ("database_hostname"),
|
||||
database_port => $cfg->param ("database_port"),
|
||||
database_username => $cfg->param ("database_username"),
|
||||
database_password => $cfg->param ("database_password"),
|
||||
database_name => $cfg->param ("database_name"),
|
||||
@ -40,9 +41,16 @@ sub open_database
|
||||
my $dbtype = $cfg->{database_driver};
|
||||
my $dbname = $cfg->{database_name};
|
||||
my $dbhost = $cfg->{database_hostname};
|
||||
my $dbport = $cfg->{database_port};
|
||||
|
||||
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
||||
|
||||
my $dbstr = "DBI:$dbtype:database=$dbname;";
|
||||
if (length($dbhost) > 0) { $dbstr .= "host=$dbhost;"; }
|
||||
if (length($dbport) > 0) { $dbstr .= "port=$dbport;"; }
|
||||
|
||||
my $dbh = DBI->connect(
|
||||
"DBI:$dbtype:$dbname:$dbhost",
|
||||
$dbstr,
|
||||
$cfg->{database_username},
|
||||
$cfg->{database_password},
|
||||
{ RaiseError => 0, PrintError => 0, AutoCommit => 0 }
|
||||
@ -102,7 +110,7 @@ if (!defined($cfg))
|
||||
my $dbh = open_database ($cfg);
|
||||
if (!defined($dbh))
|
||||
{
|
||||
print (STDERR "Cannot open database\n");
|
||||
printf (STDERR "Cannot open database - %s\n", $DBI::errstr);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ sub get_config
|
||||
|
||||
my $config = {
|
||||
database_hostname => $cfg->param ("database_hostname"),
|
||||
database_port => $cfg->param ("database_port"),
|
||||
database_username => $cfg->param ("database_username"),
|
||||
database_password => $cfg->param ("database_password"),
|
||||
database_name => $cfg->param ("database_name"),
|
||||
@ -45,9 +46,16 @@ sub open_database
|
||||
my $dbtype = $cfg->{database_driver};
|
||||
my $dbname = $cfg->{database_name};
|
||||
my $dbhost = $cfg->{database_hostname};
|
||||
my $dbport = $cfg->{database_port};
|
||||
|
||||
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
||||
|
||||
my $dbstr = "DBI:$dbtype:database=$dbname;";
|
||||
if (length($dbhost) > 0) { $dbstr .= "host=$dbhost;"; }
|
||||
if (length($dbport) > 0) { $dbstr .= "port=$dbport;"; }
|
||||
|
||||
my $dbh = DBI->connect(
|
||||
"DBI:$dbtype:$dbname:$dbhost",
|
||||
$dbstr,
|
||||
$cfg->{database_username},
|
||||
$cfg->{database_password},
|
||||
{ RaiseError => 0, PrintError => 0, AutoCommit => 0 }
|
||||
@ -104,7 +112,7 @@ if (!defined($cfg))
|
||||
my $dbh = open_database ($cfg);
|
||||
if (!defined($dbh))
|
||||
{
|
||||
print (STDERR "Cannot open database\n");
|
||||
printf (STDERR "Cannot open database - %s\n", $DBI::errstr);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@ sub get_config
|
||||
|
||||
my $config = {
|
||||
database_hostname => $cfg->param ('database_hostname'),
|
||||
database_port => $cfg->param ("database_port"),
|
||||
database_username => $cfg->param ('database_username'),
|
||||
database_password => $cfg->param ('database_password'),
|
||||
database_name => $cfg->param ('database_name'),
|
||||
@ -65,9 +66,16 @@ sub open_database
|
||||
my $dbtype = $cfg->{database_driver};
|
||||
my $dbname = $cfg->{database_name};
|
||||
my $dbhost = $cfg->{database_hostname};
|
||||
my $dbport = $cfg->{database_port};
|
||||
|
||||
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
||||
|
||||
my $dbstr = "DBI:$dbtype:database=$dbname;";
|
||||
if (length($dbhost) > 0) { $dbstr .= "host=$dbhost;"; }
|
||||
if (length($dbport) > 0) { $dbstr .= "port=$dbport;"; }
|
||||
|
||||
my $dbh = DBI->connect(
|
||||
"DBI:$dbtype:$dbname:$dbhost",
|
||||
$dbstr,
|
||||
$cfg->{database_username},
|
||||
$cfg->{database_password},
|
||||
{ RaiseError => 0, PrintError => 0, AutoCommit => 0 }
|
||||
@ -510,7 +518,7 @@ if (defined($topdirs))
|
||||
#my $dbh = open_database ($cfg);
|
||||
#if (!defined($dbh))
|
||||
#{
|
||||
# print (STDERR "Cannot open database\n");
|
||||
# printf (STDERR "Cannot open database - %s\n", $DBI::errstr);
|
||||
# exit (1);
|
||||
#}
|
||||
#
|
||||
|
@ -29,6 +29,7 @@ sub get_config
|
||||
|
||||
my $config = {
|
||||
database_hostname => $cfg->param ("database_hostname"),
|
||||
database_port => $cfg->param ("database_port"),
|
||||
database_username => $cfg->param ("database_username"),
|
||||
database_password => $cfg->param ("database_password"),
|
||||
database_name => $cfg->param ("database_name"),
|
||||
@ -48,9 +49,16 @@ sub open_database
|
||||
my $dbtype = $cfg->{database_driver};
|
||||
my $dbname = $cfg->{database_name};
|
||||
my $dbhost = $cfg->{database_hostname};
|
||||
my $dbport = $cfg->{database_port};
|
||||
|
||||
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
||||
|
||||
my $dbstr = "DBI:$dbtype:database=$dbname;";
|
||||
if (length($dbhost) > 0) { $dbstr .= "host=$dbhost;"; }
|
||||
if (length($dbport) > 0) { $dbstr .= "port=$dbport;"; }
|
||||
|
||||
my $dbh = DBI->connect(
|
||||
"DBI:$dbtype:$dbname:$dbhost",
|
||||
$dbstr,
|
||||
$cfg->{database_username},
|
||||
$cfg->{database_password},
|
||||
{ RaiseError => 0, PrintError => 0, AutoCommit => 0 }
|
||||
@ -161,7 +169,7 @@ elsif ($ACTION eq 'M' || $ACTION eq 'A')
|
||||
my $dbh = open_database ($cfg);
|
||||
if (!defined($dbh))
|
||||
{
|
||||
print (STDERR "Cannot open database\n");
|
||||
printf (STDERR "Cannot open database - %s\n", $DBI::errstr);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ sub get_config
|
||||
|
||||
my $config = {
|
||||
database_hostname => $cfg->param ("database_hostname"),
|
||||
database_port => $cfg->param ("database_port"),
|
||||
database_username => $cfg->param ("database_username"),
|
||||
database_password => $cfg->param ("database_password"),
|
||||
database_name => $cfg->param ("database_name"),
|
||||
@ -38,9 +39,16 @@ sub open_database
|
||||
my $dbtype = $cfg->{database_driver};
|
||||
my $dbname = $cfg->{database_name};
|
||||
my $dbhost = $cfg->{database_hostname};
|
||||
my $dbport = $cfg->{database_port};
|
||||
|
||||
if ($dbtype eq 'postgre') { $dbtype = 'Pg'; }
|
||||
|
||||
my $dbstr = "DBI:$dbtype:database=$dbname;";
|
||||
if (length($dbhost) > 0) { $dbstr .= "host=$dbhost;"; }
|
||||
if (length($dbport) > 0) { $dbstr .= "port=$dbport;"; }
|
||||
|
||||
my $dbh = DBI->connect(
|
||||
"DBI:$dbtype:$dbname:$dbhost",
|
||||
$dbstr,
|
||||
$cfg->{database_username},
|
||||
$cfg->{database_password},
|
||||
{ RaiseError => 0, PrintError => 0, AutoCommit => 0 }
|
||||
@ -99,7 +107,7 @@ if (!defined($cfg))
|
||||
my $dbh = open_database ($cfg);
|
||||
if (!defined($dbh))
|
||||
{
|
||||
print (STDERR "Cannot open database\n");
|
||||
printf (STDERR "Cannot open database - %s\n", $DBI::errstr);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
@ -12,28 +12,30 @@ use Digest::SHA1 qw (sha1_hex);
|
||||
|
||||
|
||||
my $CFG_FILE = '@CFGDIR@/codepot.ini';
|
||||
my $USER_TABLE_NAME = 'user';
|
||||
|
||||
sub get_config
|
||||
{
|
||||
my $cfg = new Config::Simple();
|
||||
my $cfg = new Config::Simple();
|
||||
|
||||
if (!$cfg->read ($CFG_FILE))
|
||||
{
|
||||
return undef;
|
||||
}
|
||||
if (!$cfg->read ($CFG_FILE))
|
||||
{
|
||||
return undef;
|
||||
}
|
||||
|
||||
my $config = {
|
||||
database_hostname => $cfg->param ("database_hostname"),
|
||||
database_username => $cfg->param ("database_username"),
|
||||
database_password => $cfg->param ("database_password"),
|
||||
database_name => $cfg->param ("database_name"),
|
||||
database_driver => $cfg->param ("database_driver"),
|
||||
database_prefix => $cfg->param ("database_prefix"),
|
||||
my $config = {
|
||||
database_hostname => $cfg->param ("database_hostname"),
|
||||
database_port => $cfg->param ("database_port"),
|
||||
database_username => $cfg->param ("database_username"),
|
||||
database_password => $cfg->param ("database_password"),
|
||||
database_name => $cfg->param ("database_name"),
|
||||
database_driver => $cfg->param ("database_driver"),
|
||||
database_prefix => $cfg->param ("database_prefix"),
|
||||
|
||||
codepot_user_executor => $cfg->param("codepot_user_executor")
|
||||
};
|
||||
};
|
||||
|
||||
return $config;
|
||||
return $config;
|
||||
}
|
||||
|
||||
sub open_database
|
||||
@ -43,9 +45,24 @@ sub open_database
|
||||
my $dbtype = $cfg->{database_driver};
|
||||
my $dbname = $cfg->{database_name};
|
||||
my $dbhost = $cfg->{database_hostname};
|
||||
my $dbport = $cfg->{database_port};
|
||||
my $dbprefix = $cfg->{database_prefix};
|
||||
|
||||
if ($dbtype eq 'postgre')
|
||||
{
|
||||
$dbtype = 'Pg';
|
||||
|
||||
# in postgresql, 'user' is a reserved word.
|
||||
# it requires quotes for the word to be used as a normal word
|
||||
if (length($dbprefix) <= 0) { $USER_TABLE_NAME = '"user"'; }
|
||||
}
|
||||
|
||||
my $dbstr = "DBI:$dbtype:database=$dbname;";
|
||||
if (length($dbhost) > 0) { $dbstr .= "host=$dbhost;"; }
|
||||
if (length($dbport) > 0) { $dbstr .= "port=$dbport;"; }
|
||||
|
||||
my $dbh = DBI->connect(
|
||||
"DBI:$dbtype:$dbname:$dbhost",
|
||||
$dbstr,
|
||||
$cfg->{database_username},
|
||||
$cfg->{database_password},
|
||||
{ RaiseError => 0, PrintError => 0, AutoCommit => 0 }
|
||||
@ -87,7 +104,7 @@ sub authenticate_database
|
||||
{
|
||||
my ($dbh, $prefix, $userid, $password) = @_;
|
||||
|
||||
my $query = $dbh->prepare ("SELECT userid,passwd FROM ${prefix}user WHERE userid=? and enabled='N'");
|
||||
my $query = $dbh->prepare ("SELECT userid,passwd FROM ${prefix}${USER_TABLE_NAME}} WHERE userid=? and enabled='N'");
|
||||
if (!$query || !$query->execute ($userid))
|
||||
{
|
||||
return (-1, $dbh->errstr());
|
||||
@ -119,7 +136,7 @@ sub add_user
|
||||
|
||||
$dbh->begin_work ();
|
||||
|
||||
my $query = $dbh->prepare ("INSERT INTO ${prefix}user (userid,passwd,email,enabled) VALUES (?, ?, ?, ?)");
|
||||
my $query = $dbh->prepare ("INSERT INTO ${prefix}${USER_TABLE_NAME} (userid,passwd,email,enabled) VALUES (?, ?, ?, ?)");
|
||||
if (!$query || !$query->execute ($userid, $fmt_pw, $email, 'N'))
|
||||
{
|
||||
my $errstr = $dbh->errstr();
|
||||
@ -139,7 +156,7 @@ sub delete_user
|
||||
|
||||
$dbh->begin_work ();
|
||||
|
||||
my $query = $dbh->prepare ("DELETE FROM ${prefix}user WHERE userid=?");
|
||||
my $query = $dbh->prepare ("DELETE FROM ${prefix}${USER_TABLE_NAME} WHERE userid=?");
|
||||
if (!$query || !$query->execute ($userid) || $query->rows() <= 0)
|
||||
{
|
||||
my $errstr = $dbh->errstr();
|
||||
@ -159,7 +176,7 @@ sub toggle_user
|
||||
|
||||
$dbh->begin_work ();
|
||||
|
||||
my $query = $dbh->prepare ("UPDATE ${prefix}user SET enabled=? WHERE userid=?");
|
||||
my $query = $dbh->prepare ("UPDATE ${prefix}${USER_TABLE_NAME} SET enabled=? WHERE userid=?");
|
||||
if (!$query || !$query->execute ($enabled, $userid) || $query->rows() <= 0)
|
||||
{
|
||||
my $errstr = $dbh->errstr();
|
||||
@ -271,7 +288,7 @@ if ($allowed_to_execute == 0)
|
||||
my $dbh = open_database ($cfg);
|
||||
if (!defined($dbh))
|
||||
{
|
||||
print (STDERR "Cannot open database\n");
|
||||
printf (STDERR "Cannot open database - %s\n", $DBI::errstr);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ $active_group = "default";
|
||||
$active_record = TRUE;
|
||||
|
||||
$db['default']['hostname'] = CODEPOT_DATABASE_HOSTNAME;
|
||||
$db['default']['port'] = CODEPOT_DATABASE_PORT;
|
||||
$db['default']['username'] = CODEPOT_DATABASE_USERNAME;
|
||||
$db['default']['password'] = CODEPOT_DATABASE_PASSWORD;
|
||||
$db['default']['database'] = CODEPOT_DATABASE_NAME;
|
||||
@ -51,6 +52,7 @@ $db['default']['char_set'] = "utf8";
|
||||
$db['default']['dbcollat'] = "utf8_general_ci";
|
||||
|
||||
$db['auth-mysql']['hostname'] = CODEPOT_AUTH_MYSQL_HOSTNAME;
|
||||
$db['auth-mysql']['port'] = CODEPOT_AUTH_MYSQL_PORT;
|
||||
$db['auth-mysql']['username'] = CODEPOT_AUTH_MYSQL_USERNAME;
|
||||
$db['auth-mysql']['password'] = CODEPOT_AUTH_MYSQL_PASSWORD;
|
||||
$db['auth-mysql']['database'] = CODEPOT_AUTH_MYSQL_NAME;
|
||||
|
@ -111,7 +111,11 @@ class IssueModel extends Model
|
||||
|
||||
if ($hour_limit > 0)
|
||||
{
|
||||
$this->db->where ("updatedon >= SYSDATE() - INTERVAL {$hour_limit} HOUR");
|
||||
//$this->db->where ("updatedon >= SYSDATE() - INTERVAL {$hour_limit} HOUR");
|
||||
if (CODEPOT_DATABASE_DRIVER == 'mysql')
|
||||
$this->db->where ("updatedon >= CURRENT_TIMESTAMP - INTERVAL {$hour_limit} HOUR");
|
||||
else
|
||||
$this->db->where ("updatedon >= CURRENT_TIMESTAMP - INTERVAL '{$hour_limit} HOUR'");
|
||||
}
|
||||
|
||||
if (strlen($userid) > 0)
|
||||
|
@ -57,7 +57,14 @@ class ProjectModel extends Model
|
||||
$this->db->trans_start ();
|
||||
|
||||
$this->db->select ('count(id) as count');
|
||||
$this->db->order_by ('name', 'asc');
|
||||
// having this line to make it same as getEntries()
|
||||
// causes postgresql to emit this error:
|
||||
// column "project.name" must appear in the GROUP BY clause or
|
||||
// be used in an aggregate function.
|
||||
//
|
||||
// let's just comment it out as counting without sorting
|
||||
// is ok.
|
||||
//$this->db->order_by ('name', 'asc');
|
||||
|
||||
if ($search->or == 'Y')
|
||||
{
|
||||
|
@ -147,6 +147,7 @@ $this->load->view (
|
||||
|
||||
$history_anchor_text = '<i class="fa fa-history"></i> ' . $this->lang->line('History');
|
||||
$download_anchor_text = '<i class="fa fa-download"></i> ' . $this->lang->line('Download');
|
||||
$diff_anchor_text = '<i class="fa fa-server"></i> ' . $this->lang->line('Difference');
|
||||
|
||||
$xpar = $this->converter->AsciiToHex ($headpath);
|
||||
|
||||
@ -158,7 +159,7 @@ if ($file['created_rev'] != $file['head_rev'])
|
||||
|
||||
print anchor ("code/file/{$project->id}/${xpar}{$revreq}", $this->lang->line('Details'));
|
||||
print ' | ';
|
||||
print anchor ("code/diff/{$project->id}/{$xpar}{$revreq}", $this->lang->line('Difference'));
|
||||
print anchor ("code/diff/{$project->id}/{$xpar}{$revreq}", $diff_anchor_text);
|
||||
print ' | ';
|
||||
|
||||
if ($revision > 0)
|
||||
|
@ -99,33 +99,31 @@ $this->load->view (
|
||||
|
||||
<div class="menu" id="code_diff_mainarea_menu">
|
||||
<?php
|
||||
$history_anchor_text = '<i class="fa fa-history"></i> ' . $this->lang->line('History');
|
||||
$diff_anchor_text = '<i class="fa fa-server"></i> ' . $this->lang->line('Difference');
|
||||
$fulldiff_anchor_text = '<i class="fa fa-tasks"></i> ' . $this->lang->line('Full Difference');
|
||||
$blame_anchor_text = '<i class="fa fa-bomb"></i> ' . $this->lang->line('Blame');
|
||||
|
||||
$xpar = $this->converter->AsciiTohex ($headpath);
|
||||
print anchor (
|
||||
"code/file/{$project->id}/{$xpar}{$revreq}",
|
||||
$this->lang->line('Details'));
|
||||
print ' | ';
|
||||
print anchor (
|
||||
"code/blame/{$project->id}/{$xpar}{$revreq}",
|
||||
'<i class="fa fa-bomb"></i> ' . $this->lang->line('Blame'));
|
||||
print anchor ("code/blame/{$project->id}/{$xpar}{$revreq}", $blame_anchor_text);
|
||||
|
||||
print ' | ';
|
||||
|
||||
if (!$fullview)
|
||||
{
|
||||
print anchor (
|
||||
"code/fulldiff/{$project->id}/{$xpar}{$revreq}",
|
||||
$this->lang->line('Full Difference'));
|
||||
print anchor ("code/fulldiff/{$project->id}/{$xpar}{$revreq}", $fulldiff_anchor_text);
|
||||
}
|
||||
else
|
||||
{
|
||||
print anchor (
|
||||
"code/diff/{$project->id}/{$xpar}{$revreq}",
|
||||
$this->lang->line('Difference'));
|
||||
print anchor ("code/diff/{$project->id}/{$xpar}{$revreq}", $diff_anchor_text);
|
||||
}
|
||||
|
||||
print ' | ';
|
||||
|
||||
|
||||
$history_anchor_text = '<i class="fa fa-history"></i> ' . $this->lang->line('History');
|
||||
if ($revision1 > 0)
|
||||
{
|
||||
if ($xpar == '') $revtrailer = $revreqroot;
|
||||
|
@ -166,6 +166,8 @@ $this->load->view (
|
||||
$blame_anchor_text = '<i class="fa fa-bomb"></i> ' . $this->lang->line('Blame');
|
||||
$history_anchor_text = '<i class="fa fa-history"></i> ' . $this->lang->line('History');
|
||||
$download_anchor_text = '<i class="fa fa-download"></i> ' . $this->lang->line('Download');
|
||||
$diff_anchor_text = '<i class="fa fa-server"></i> ' . $this->lang->line('Difference');
|
||||
$fulldiff_anchor_text = '<i class="fa fa-tasks"></i> ' . $this->lang->line('Full Difference');
|
||||
|
||||
if ($file['created_rev'] != $file['head_rev'])
|
||||
{
|
||||
@ -177,9 +179,9 @@ $this->load->view (
|
||||
|
||||
print anchor ("code/blame/{$project->id}/${xpar}{$revreq}", $blame_anchor_text);
|
||||
print ' | ';
|
||||
print anchor ("code/diff/{$project->id}/{$xpar}{$revreq}", $this->lang->line('Difference'));
|
||||
print anchor ("code/diff/{$project->id}/{$xpar}{$revreq}", $diff_anchor_text);
|
||||
print ' | ';
|
||||
print anchor ("code/fulldiff/{$project->id}/{$xpar}{$revreq}", $this->lang->line('Full Difference'));
|
||||
print anchor ("code/fulldiff/{$project->id}/{$xpar}{$revreq}", $fulldiff_anchor_text);
|
||||
print ' | ';
|
||||
|
||||
if ($revision > 0)
|
||||
|
@ -493,6 +493,9 @@ $this->load->view (
|
||||
|
||||
$history_anchor_text = '<i class="fa fa-history"></i> ' . $this->lang->line('History');
|
||||
$download_anchor_text = '<i class="fa fa-download"></i> ' . $this->lang->line('Download');
|
||||
$diff_anchor_text = '<i class="fa fa-server"></i> ' . $this->lang->line('Difference');
|
||||
$fulldiff_anchor_text = '<i class="fa fa-tasks"></i> ' . $this->lang->line('Full Difference');
|
||||
$blame_anchor_text = '<i class="fa fa-bomb"></i> ' . $this->lang->line('Blame');
|
||||
|
||||
if ($revision > 0)
|
||||
{
|
||||
@ -512,8 +515,6 @@ $this->load->view (
|
||||
|
||||
usort ($file['content'], 'comp_files');
|
||||
|
||||
$blame_anchor_text = '<i class="fa fa-bomb"></i> ' . $this->lang->line('Blame');
|
||||
|
||||
print '<table id="code_folder_mainarea_result_table" class="fit-width-result-table">';
|
||||
print '<tr class="heading">';
|
||||
print '<th>' . $this->lang->line('Name') . '</th>';
|
||||
@ -591,14 +592,10 @@ $this->load->view (
|
||||
print anchor ("code/blame/{$project->id}/{$hexpath}{$revreq}", $blame_anchor_text);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print anchor (
|
||||
"code/diff/{$project->id}/{$hexpath}{$revreq}",
|
||||
$this->lang->line('Difference'));
|
||||
print anchor ("code/diff/{$project->id}/{$hexpath}{$revreq}", $diff_anchor_text);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print anchor (
|
||||
"code/fulldiff/{$project->id}/{$hexpath}{$revreq}",
|
||||
$this->lang->line('Full Difference'));
|
||||
print anchor ("code/fulldiff/{$project->id}/{$hexpath}{$revreq}", $fulldiff_anchor_text);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ $this->load->view (
|
||||
'<i class="fa fa-bomb"></i> ' . $this->lang->line('Blame'));
|
||||
print ' | ';
|
||||
print anchor ("code/diff/{$project->id}/{$xfullpath}/{$h['rev']}",
|
||||
$this->lang->line('Difference'));
|
||||
'<i class="fa fa-server"></i> ' . $this->lang->line('Difference'));
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -175,7 +175,7 @@ $this->load->view (
|
||||
// let's track the copy path.
|
||||
//
|
||||
$paths = $h['paths'];
|
||||
$colspan = ($file['type'] == 'file' || $file['type'] == 'dir')? 5: 4;
|
||||
$colspan = 6;
|
||||
foreach ($paths as $p)
|
||||
{
|
||||
if (array_key_exists ('copyfrom', $p) &&
|
||||
|
@ -414,6 +414,8 @@ $history = $file['history'];
|
||||
print '<th></th>';
|
||||
print '</tr>';
|
||||
*/
|
||||
$diff_anchor_text = '<i class="fa fa-server"></i> ' . $this->lang->line('Difference');
|
||||
$fulldiff_anchor_text = '<i class="fa fa-tasks"></i> ' . $this->lang->line('Full Difference');
|
||||
|
||||
$rowclasses = array ('odd', 'even');
|
||||
$rowcount = 0;
|
||||
@ -431,11 +433,11 @@ $history = $file['history'];
|
||||
print '<td>';
|
||||
//print anchor ("code/blame/{$project->id}/{$xpar}/{$history['rev']}", $this->lang->line('Blame'));
|
||||
//print ' ';
|
||||
print anchor ("code/diff/{$project->id}/{$xpar}/{$history['rev']}", $this->lang->line('Difference'));
|
||||
print anchor ("code/diff/{$project->id}/{$xpar}/{$history['rev']}", $diff_anchor_text);
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
print anchor ("code/fulldiff/{$project->id}/{$xpar}/{$history['rev']}", $this->lang->line('Full Difference'));
|
||||
print anchor ("code/fulldiff/{$project->id}/{$xpar}/{$history['rev']}", $fulldiff_anchor_text);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
@ -45,6 +45,7 @@ function load_ini ($file)
|
||||
array ('max_logs_in_project_home', 'integer', 5),
|
||||
|
||||
array ('database_hostname', 'string', 'localhost'),
|
||||
array ('database_port', 'string', ''),
|
||||
array ('database_username', 'string', ''),
|
||||
array ('database_password', 'string', ''),
|
||||
array ('database_name', 'string', ''),
|
||||
@ -52,6 +53,7 @@ function load_ini ($file)
|
||||
array ('database_prefix', 'string', ''),
|
||||
|
||||
array ('auth_mysql_hostname', 'string', 'localhost'),
|
||||
array ('auth_mysql_port', 'string', ''),
|
||||
array ('auth_mysql_username', 'string', ''),
|
||||
array ('auth_mysql_password', 'string', ''),
|
||||
array ('auth_mysql_name', 'string', ''),
|
||||
|
Loading…
Reference in New Issue
Block a user