fixed the bug of not honoring database_store_gmt in post-commit and post-revprop-commit
This commit is contained in:
parent
0459989cd0
commit
750db30352
@ -28,6 +28,8 @@ UPGRADING FROM 0.2.0
|
|||||||
mysql> UPDATE issue_change SET createdby=updatedby, createdon=updatedon;
|
mysql> UPDATE issue_change SET createdby=updatedby, createdon=updatedon;
|
||||||
mysql> create the issue_coderev table according to the definition found in codepot.mysql
|
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> 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
|
INSTALLATION ON CENTOS
|
||||||
|
|
||||||
|
@ -36,6 +36,8 @@ CREATE TABLE project_membership (
|
|||||||
userid VARCHAR(32) NOT NULL,
|
userid VARCHAR(32) NOT NULL,
|
||||||
priority INTEGER NOT NULL,
|
priority INTEGER NOT NULL,
|
||||||
UNIQUE KEY membership (projectid, userid),
|
UNIQUE KEY membership (projectid, userid),
|
||||||
|
KEY userid_index (userid),
|
||||||
|
KEY projectid_index (projectid),
|
||||||
CONSTRAINT membership_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
CONSTRAINT membership_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
||||||
ON DELETE CASCADE ON UPDATE CASCADE
|
ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
) charset=utf8 engine=InnoDB;
|
) charset=utf8 engine=InnoDB;
|
||||||
|
@ -57,6 +57,8 @@ CREATE TABLE "cpot_project_membership" (
|
|||||||
UNIQUE ("projectid", "userid"),
|
UNIQUE ("projectid", "userid"),
|
||||||
CONSTRAINT membership_projectid FOREIGN KEY ("projectid") REFERENCES "cpot_project"("id") ON DELETE CASCADE
|
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" (
|
CREATE TABLE "cpot_wiki" (
|
||||||
"projectid" VARCHAR(32) NOT NULL,
|
"projectid" VARCHAR(32) NOT NULL,
|
||||||
|
@ -55,6 +55,8 @@ CREATE TABLE project_membership (
|
|||||||
CONSTRAINT membership_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
CONSTRAINT membership_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
||||||
ON DELETE CASCADE ON UPDATE CASCADE
|
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 (
|
CREATE TABLE wiki (
|
||||||
projectid VARCHAR(32) NOT NULL,
|
projectid VARCHAR(32) NOT NULL,
|
||||||
|
@ -5,7 +5,7 @@ use strict;
|
|||||||
use Config::Simple;
|
use Config::Simple;
|
||||||
use DBI;
|
use DBI;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
use POSIX qw(strftime);
|
use POSIX;
|
||||||
|
|
||||||
use SVN::Core;
|
use SVN::Core;
|
||||||
use SVN::Repos;
|
use SVN::Repos;
|
||||||
@ -53,6 +53,7 @@ sub get_config
|
|||||||
database_name => $cfg->param ("database_name"),
|
database_name => $cfg->param ("database_name"),
|
||||||
database_driver => $cfg->param ("database_driver"),
|
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"),
|
||||||
|
|
||||||
email_sender => $cfg->param ("email_sender"),
|
email_sender => $cfg->param ("email_sender"),
|
||||||
commit_notification => $cfg->param ("commit_notification"),
|
commit_notification => $cfg->param ("commit_notification"),
|
||||||
@ -157,7 +158,7 @@ sub find_issue_reference_in_commit_message
|
|||||||
|
|
||||||
sub write_commit_log
|
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 |
|
#| 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 |
|
#| 895 | code | codepot | svn,codepot,72 | 2011-10-10 14:26:43 | commit | hyunghwan.chung |
|
||||||
|
|
||||||
my $message = "svn,$projectid,$revision";
|
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.
|
# 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?
|
# 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.
|
# 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.
|
# 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 ();
|
$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 (?,?,?,?,?,?)");
|
#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))
|
#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,?,?)");
|
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, 'commit', $userid))
|
if (!$query || !$query->execute ('code', $projectid, $message, $timestamp, 'commit', $userid))
|
||||||
{
|
{
|
||||||
my $errstr = $dbh->errstr();
|
my $errstr = $dbh->errstr();
|
||||||
if ($query) { $query->finish (); }
|
if ($query) { $query->finish (); }
|
||||||
@ -192,7 +202,6 @@ sub write_commit_log
|
|||||||
return (0, undef);
|
return (0, undef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub get_author
|
sub get_author
|
||||||
{
|
{
|
||||||
my $pool = SVN::Pool->new(undef);
|
my $pool = SVN::Pool->new(undef);
|
||||||
@ -458,7 +467,7 @@ if (!defined($dbh))
|
|||||||
my $raw_commit_message = get_commit_message();
|
my $raw_commit_message = get_commit_message();
|
||||||
|
|
||||||
find_issue_reference_in_commit_message ($dbh, $cfg->{database_prefix}, $REPOBASE, $REV, $raw_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')
|
if (lc($cfg->{commit_notification}) eq 'yes')
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ use strict;
|
|||||||
use Config::Simple;
|
use Config::Simple;
|
||||||
use DBI;
|
use DBI;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
use POSIX qw(strftime);
|
use POSIX;
|
||||||
|
|
||||||
use SVN::Core;
|
use SVN::Core;
|
||||||
use SVN::Repos;
|
use SVN::Repos;
|
||||||
@ -39,7 +39,8 @@ sub get_config
|
|||||||
database_password => $cfg->param ("database_password"),
|
database_password => $cfg->param ("database_password"),
|
||||||
database_name => $cfg->param ("database_name"),
|
database_name => $cfg->param ("database_name"),
|
||||||
database_driver => $cfg->param ("database_driver"),
|
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;
|
return $config;
|
||||||
@ -141,7 +142,7 @@ sub find_issue_reference_in_commit_message
|
|||||||
|
|
||||||
sub write_revprop_change_log
|
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 |
|
#| 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 |
|
#| 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 $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 ();
|
$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 (?,?,?,?,?,?)");
|
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();
|
my $errstr = $dbh->errstr();
|
||||||
if ($query) { $query->finish (); }
|
if ($query) { $query->finish (); }
|
||||||
@ -209,7 +219,7 @@ if (!defined($dbh))
|
|||||||
my $raw_commit_message = get_commit_message();
|
my $raw_commit_message = get_commit_message();
|
||||||
|
|
||||||
find_issue_reference_in_commit_message ($dbh, $cfg->{database_prefix}, $REPOBASE, $REV, $raw_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);
|
close_database ($dbh);
|
||||||
|
|
||||||
exit (0);
|
exit (0);
|
||||||
|
@ -124,6 +124,8 @@ var GraphApp = (function()
|
|||||||
|
|
||||||
function handle_double_click (nodeid)
|
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++)
|
for (var i = 0, j = this.data.nodes.length; i < j; i++)
|
||||||
{
|
{
|
||||||
if (this.data.nodes[i].id == nodeid)
|
if (this.data.nodes[i].id == nodeid)
|
||||||
@ -194,7 +196,6 @@ var GraphApp = (function()
|
|||||||
this.resize ();
|
this.resize ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.refresh_button.button("enable");
|
this.refresh_button.button("enable");
|
||||||
this.refresh_spin.removeClass ("fa-cog fa-spin");
|
this.refresh_spin.removeClass ("fa-cog fa-spin");
|
||||||
this.ajax_req = null;
|
this.ajax_req = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user