diff --git a/codepot/README b/codepot/README index 93949846..bdfa74ac 100644 --- a/codepot/README +++ b/codepot/README @@ -28,6 +28,8 @@ UPGRADING FROM 0.2.0 mysql> UPDATE issue_change SET createdby=updatedby, createdon=updatedon; mysql> create the issue_coderev table according to the definition found in codepot.mysql mysql> ALTER TABLE user_settings ADD COLUMN(user_summary VARCHAR(255) NULL); + mysql> CREATE INDEX projectid_index on project_membership(projectid); + mysql> CREATE INDEX userid_index on project_membership(userid); INSTALLATION ON CENTOS diff --git a/codepot/etc/codepot.mysql b/codepot/etc/codepot.mysql index fc831e8a..1a0835ff 100644 --- a/codepot/etc/codepot.mysql +++ b/codepot/etc/codepot.mysql @@ -36,6 +36,8 @@ CREATE TABLE project_membership ( userid VARCHAR(32) NOT NULL, priority INTEGER NOT NULL, UNIQUE KEY membership (projectid, userid), + KEY userid_index (userid), + KEY projectid_index (projectid), CONSTRAINT membership_projectid FOREIGN KEY (projectid) REFERENCES project(id) ON DELETE CASCADE ON UPDATE CASCADE ) charset=utf8 engine=InnoDB; diff --git a/codepot/etc/codepot.oracle b/codepot/etc/codepot.oracle index bb1b242d..b9164fa4 100644 --- a/codepot/etc/codepot.oracle +++ b/codepot/etc/codepot.oracle @@ -57,6 +57,8 @@ CREATE TABLE "cpot_project_membership" ( UNIQUE ("projectid", "userid"), CONSTRAINT membership_projectid FOREIGN KEY ("projectid") REFERENCES "cpot_project"("id") ON DELETE CASCADE ); +CREATE INDEX cpot_projectid_index ON "cpot_project_membership"("projectid"); +CREATE INDEX cpot_userid_index ON "cpot_project_membership"("userid"); CREATE TABLE "cpot_wiki" ( "projectid" VARCHAR(32) NOT NULL, diff --git a/codepot/etc/codepot.pgsql b/codepot/etc/codepot.pgsql index 388a5b46..2a88ca2b 100644 --- a/codepot/etc/codepot.pgsql +++ b/codepot/etc/codepot.pgsql @@ -55,6 +55,8 @@ CREATE TABLE project_membership ( CONSTRAINT membership_projectid FOREIGN KEY (projectid) REFERENCES project(id) ON DELETE CASCADE ON UPDATE CASCADE ); +CREATE INDEX projectid_index ON project_membership(projectid); +CREATE INDEX userid_index ON project_membership(userid); CREATE TABLE wiki ( projectid VARCHAR(32) NOT NULL, diff --git a/codepot/etc/post-commit.in b/codepot/etc/post-commit.in index cb31aabb..97f26ae9 100644 --- a/codepot/etc/post-commit.in +++ b/codepot/etc/post-commit.in @@ -5,7 +5,7 @@ use strict; use Config::Simple; use DBI; use File::Basename; -use POSIX qw(strftime); +use POSIX; use SVN::Core; use SVN::Repos; @@ -53,6 +53,7 @@ sub get_config database_name => $cfg->param ("database_name"), database_driver => $cfg->param ("database_driver"), database_prefix => $cfg->param ("database_prefix"), + database_store_gmt => $cfg->param ("database_store_gmt"), email_sender => $cfg->param ("email_sender"), commit_notification => $cfg->param ("commit_notification"), @@ -157,7 +158,7 @@ sub find_issue_reference_in_commit_message sub write_commit_log { - my ($dbh, $prefix, $projectid, $revision, $userid) = @_; + my ($dbh, $prefix, $projectid, $revision, $userid, $store_gmt) = @_; #+------+---------+-----------+---------------------------+---------------------+---------------+-----------------+ #| id | type | projectid | message | createdon | action | userid | @@ -165,21 +166,30 @@ sub write_commit_log #| 895 | code | codepot | svn,codepot,72 | 2011-10-10 14:26:43 | commit | hyunghwan.chung | my $message = "svn,$projectid,$revision"; + my $timestamp; + if (($store_gmt =~ /^\d+?$/ && int($store_gmt) != 0) || (lc($store_gmt) eq 'yes')) + { + $timestamp = POSIX::strftime ('%Y-%m-%d %H:%M:%S', gmtime()); + } + else + { + $timestamp = POSIX::strftime ('%Y-%m-%d %H:%M:%S', localtime()); + } # the PHP side is executing ALTER SESSION SET NLS_TIMESTAMP_FORMAT='YYYY-MM-DD HH24:MI:SS.FF. # do i have to do it here or use the database time (CURRENT_TIMESTAMP) instead? # make sure that you have the same time between the app server and the data server. # to minize side-effect of using the time of data server. - #my $createdon = strftime ('%Y-%m-%d %H:%M:%S', localtime()); + #my $createdon = POSIX::strftime ('%Y-%m-%d %H:%M:%S', localtime()); $dbh->begin_work (); #my $query = $dbh->prepare ("INSERT INTO ${QC}${prefix}log${QC} (${QC}type${QC},${QC}projectid${QC},${QC}message${QC},${QC}createdon${QC},${QC}action${QC},${QC}userid${QC}) VALUES (?,?,?,?,?,?)"); #if (!$query || !$query->execute ('code', $projectid, $message, $createdon, 'commit', $userid)) - my $query = $dbh->prepare ("INSERT INTO ${QC}${prefix}log${QC} (${QC}type${QC},${QC}projectid${QC},${QC}message${QC},${QC}createdon${QC},${QC}action${QC},${QC}userid${QC}) VALUES (?,?,?,CURRENT_TIMESTAMP,?,?)"); - if (!$query || !$query->execute ('code', $projectid, $message, 'commit', $userid)) + my $query = $dbh->prepare ("INSERT INTO ${QC}${prefix}log${QC} (${QC}type${QC},${QC}projectid${QC},${QC}message${QC},${QC}createdon${QC},${QC}action${QC},${QC}userid${QC}) VALUES (?,?,?,?,?,?)"); + if (!$query || !$query->execute ('code', $projectid, $message, $timestamp, 'commit', $userid)) { my $errstr = $dbh->errstr(); if ($query) { $query->finish (); } @@ -192,7 +202,6 @@ sub write_commit_log return (0, undef); } - sub get_author { my $pool = SVN::Pool->new(undef); @@ -458,7 +467,7 @@ if (!defined($dbh)) my $raw_commit_message = get_commit_message(); find_issue_reference_in_commit_message ($dbh, $cfg->{database_prefix}, $REPOBASE, $REV, $raw_commit_message); -write_commit_log ($dbh, $cfg->{database_prefix}, $REPOBASE, $REV, $AUTHOR); +write_commit_log ($dbh, $cfg->{database_prefix}, $REPOBASE, $REV, $AUTHOR, $cfg->{database_store_gmt}); if (lc($cfg->{commit_notification}) eq 'yes') { diff --git a/codepot/etc/post-revprop-change.in b/codepot/etc/post-revprop-change.in index 53619894..4b46929e 100644 --- a/codepot/etc/post-revprop-change.in +++ b/codepot/etc/post-revprop-change.in @@ -5,7 +5,7 @@ use strict; use Config::Simple; use DBI; use File::Basename; -use POSIX qw(strftime); +use POSIX; use SVN::Core; use SVN::Repos; @@ -39,7 +39,8 @@ sub get_config database_password => $cfg->param ("database_password"), database_name => $cfg->param ("database_name"), database_driver => $cfg->param ("database_driver"), - database_prefix => $cfg->param ("database_prefix") + database_prefix => $cfg->param ("database_prefix"), + database_store_gmt => $cfg->param ("database_store_gmt") }; return $config; @@ -141,7 +142,7 @@ sub find_issue_reference_in_commit_message sub write_revprop_change_log { - my ($dbh, $prefix, $projectid, $revision, $userid, $propname, $action) = @_; + my ($dbh, $prefix, $projectid, $revision, $userid, $propname, $action, $store_gmt) = @_; #+------+---------+-----------+---------------------------+---------------------+---------------+-----------------+ #| id | type | projectid | message | createdon | action | userid | @@ -149,12 +150,21 @@ sub write_revprop_change_log #| 1610 | code | codepot | svn,codepot,98,svn:log,M | 2014-05-16 22:27:36 | revpropchange | hyunghwan.chung | my $message = "svn,$projectid,$revision,$propname,$action"; - my $createdon = strftime ('%Y-%m-%d %H:%M:%S', localtime()); + my $timestamp; + + if (($store_gmt =~ /^\d+?$/ && int($store_gmt) != 0) || (lc($store_gmt) eq 'yes')) + { + $timestamp = POSIX::strftime ('%Y-%m-%d %H:%M:%S', gmtime()); + } + else + { + $timestamp = POSIX::strftime ('%Y-%m-%d %H:%M:%S', localtime()); + } $dbh->begin_work (); my $query = $dbh->prepare ("INSERT INTO ${QC}${prefix}log${QC} (${QC}type${QC},${QC}projectid${QC},${QC}message${QC},${QC}createdon${QC},${QC}action${QC},${QC}userid${QC}) VALUES (?,?,?,?,?,?)"); - if (!$query || !$query->execute ('code', $projectid, $message, $createdon, 'revpropchange', $userid)) + if (!$query || !$query->execute ('code', $projectid, $message, $timestamp, 'revpropchange', $userid)) { my $errstr = $dbh->errstr(); if ($query) { $query->finish (); } @@ -209,7 +219,7 @@ if (!defined($dbh)) my $raw_commit_message = get_commit_message(); find_issue_reference_in_commit_message ($dbh, $cfg->{database_prefix}, $REPOBASE, $REV, $raw_commit_message); -write_revprop_change_log ($dbh, $cfg->{database_prefix}, $REPOBASE, $REV, $USER, $PROPNAME, $ACTION); +write_revprop_change_log ($dbh, $cfg->{database_prefix}, $REPOBASE, $REV, $USER, $PROPNAME, $ACTION, $cfg->{database_store_gmt}); close_database ($dbh); exit (0); diff --git a/codepot/src/codepot/views/project_map.php b/codepot/src/codepot/views/project_map.php index b2fb9dcd..b22ac3f2 100644 --- a/codepot/src/codepot/views/project_map.php +++ b/codepot/src/codepot/views/project_map.php @@ -124,6 +124,8 @@ var GraphApp = (function() function handle_double_click (nodeid) { + // TODO: store node-id to name mapping and use it + // instead of iterating in a loop. for (var i = 0, j = this.data.nodes.length; i < j; i++) { if (this.data.nodes[i].id == nodeid) @@ -194,7 +196,6 @@ var GraphApp = (function() this.resize (); } - this.refresh_button.button("enable"); this.refresh_spin.removeClass ("fa-cog fa-spin"); this.ajax_req = null;