View | Details | Raw Unified | Return to bug 30984
Collapse All | Expand All

(-)a/C4/Log.pm (-2 / +8 lines)
Lines 27-32 use warnings; Link Here
27
use Data::Dumper qw( Dumper );
27
use Data::Dumper qw( Dumper );
28
use JSON qw( to_json );
28
use JSON qw( to_json );
29
use Scalar::Util qw( blessed );
29
use Scalar::Util qw( blessed );
30
use File::Basename qw( basename );
30
31
31
use C4::Context;
32
use C4::Context;
32
use Koha::Logger;
33
use Koha::Logger;
Lines 89-97 sub logaction { Link Here
89
        }
90
        }
90
    }
91
    }
91
92
93
    my $script =
94
        $interface eq 'cron'        ? basename($0)
95
      : $interface eq 'commandline' ? basename($0)
96
      :                               undef;
97
92
    my $dbh = C4::Context->dbh;
98
    my $dbh = C4::Context->dbh;
93
    my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info,interface) values (now(),?,?,?,?,?,?)");
99
    my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info,interface,script) values (now(),?,?,?,?,?,?,?)");
94
    $sth->execute($usernumber,$modulename,$actionname,$objectnumber,$infos,$interface);
100
    $sth->execute($usernumber,$modulename,$actionname,$objectnumber,$infos,$interface,$script);
95
    $sth->finish;
101
    $sth->finish;
96
102
97
    my $logger = Koha::Logger->get(
103
    my $logger = Koha::Logger->get(
(-)a/installer/data/mysql/atomicupdate/bug_30984.pl (+17 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "30984",
5
    description => "Log the cron script that generated an action log if there is one",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        if( !column_exists( 'action_logs', 'script' ) ) {
10
            $dbh->do(q{
11
                ALTER TABLE action_logs
12
                ADD COLUMN script mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the name of the cron script that caused this change'
13
                AFTER interface
14
            });
15
        }
16
    },
17
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 175-180 CREATE TABLE `action_logs` ( Link Here
175
  `object` int(11) DEFAULT NULL COMMENT 'the object that the action was taken against (could be a borrowernumber, itemnumber, etc)',
175
  `object` int(11) DEFAULT NULL COMMENT 'the object that the action was taken against (could be a borrowernumber, itemnumber, etc)',
176
  `info` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'information about the action (usually includes SQL statement)',
176
  `info` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'information about the action (usually includes SQL statement)',
177
  `interface` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the context this action was taken in',
177
  `interface` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the context this action was taken in',
178
  `script` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'the name of the cron script that caused this change',
178
  PRIMARY KEY (`action_id`),
179
  PRIMARY KEY (`action_id`),
179
  KEY `timestamp_idx` (`timestamp`),
180
  KEY `timestamp_idx` (`timestamp`),
180
  KEY `user_idx` (`user`),
181
  KEY `user_idx` (`user`),
181
- 

Return to bug 30984