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

(-)a/Koha/Database/Commenter.pm (-2 / +4 lines)
Lines 77-83 sub new { Link Here
77
        unless ref($self->{dbh}) eq DBI_HANDLE_CLASS;
77
        unless ref($self->{dbh}) eq DBI_HANDLE_CLASS;
78
78
79
    $self->{database} //= ( $self->{dbh}->selectrow_array('SELECT DATABASE()') )[0];
79
    $self->{database} //= ( $self->{dbh}->selectrow_array('SELECT DATABASE()') )[0];
80
    $self->_find_schema unless $self->{schema_file};
80
    $self->_find_schema;
81
    $self->{schema_info} = {};
81
    $self->{schema_info} = {};
82
82
83
    return $self;
83
    return $self;
Lines 159-165 sub renumber { Link Here
159
sub _find_schema {
159
sub _find_schema {
160
    my $self = shift;
160
    my $self = shift;
161
    my $rootdir = C4::Context->config('intranetdir');
161
    my $rootdir = C4::Context->config('intranetdir');
162
    if( -e "$rootdir/". KOHA_STRUCTURE ) {
162
    if( $self->{schema_file} ) {
163
        warn "File ". $self->{schema_file}. " not found!\n" if !-e $self->{schema_file};
164
    } elsif( -e "$rootdir/". KOHA_STRUCTURE ) {
163
        $self->{schema_file} = "$rootdir/". KOHA_STRUCTURE;
165
        $self->{schema_file} = "$rootdir/". KOHA_STRUCTURE;
164
    } elsif( -e "$rootdir/intranet/cgi-bin/". KOHA_STRUCTURE ) {
166
    } elsif( -e "$rootdir/intranet/cgi-bin/". KOHA_STRUCTURE ) {
165
        $self->{schema_file} = "$rootdir/intranet/cgi-bin/". KOHA_STRUCTURE;
167
        $self->{schema_file} = "$rootdir/intranet/cgi-bin/". KOHA_STRUCTURE;
(-)a/misc/maintenance/sync_db_comments.pl (-4 / +4 lines)
Lines 36-49 GetOptions( Link Here
36
  'help|h'     => \$cmd_args->{help},
36
  'help|h'     => \$cmd_args->{help},
37
  'renumber'   => \$cmd_args->{renumber},
37
  'renumber'   => \$cmd_args->{renumber},
38
  'reset'      => \$cmd_args->{reset},
38
  'reset'      => \$cmd_args->{reset},
39
  'schema:s'   => \$cmd_args->{schema},
39
  'schema:s'   => \$cmd_args->{schema_file},
40
  'table:s'    => \$cmd_args->{table},
40
  'table:s'    => \$cmd_args->{table},
41
  'verbose|v'  => \$cmd_args->{verbose},
41
  'verbose|v'  => \$cmd_args->{verbose},
42
);
42
);
43
$cmd_args->{dry_run} = !$cmd_args->{commit};
43
$cmd_args->{dry_run} = !$cmd_args->{commit};
44
44
45
my $commenter = Koha::Database::Commenter->new({
45
my $commenter = Koha::Database::Commenter->new({
46
    database => delete $cmd_args->{database}, dbh => C4::Context->dbh, schema_file => delete $cmd_args->{schema},
46
    database => delete $cmd_args->{database}, dbh => C4::Context->dbh, schema_file => delete $cmd_args->{schema_file},
47
});
47
});
48
my $messages = $cmd_args->{verbose} || $cmd_args->{dry_run} ? [] : undef;
48
my $messages = $cmd_args->{verbose} || $cmd_args->{dry_run} ? [] : undef;
49
if( $cmd_args->{help} ) {
49
if( $cmd_args->{help} ) {
Lines 94-102 misc/maintenance/sync_db_comments.pl Link Here
94
    Clear all column comments in database.
94
    Clear all column comments in database.
95
    The verbose flag shows all issued ALTER TABLE statements.
95
    The verbose flag shows all issued ALTER TABLE statements.
96
96
97
    misc/maintance/sync_db_comments.pl -reset -commit -database mydb -table items
97
    misc/maintance/sync_db_comments.pl -reset -commit -database mydb -table items -schema newstructure.sql
98
    Only resets comments in items table.
98
    Only resets comments in items table.
99
    Operates on specific database instead of the one from $KOHA_CONF.
99
    Operates on specific database instead of the one from $KOHA_CONF.
100
    Reads the schema from the specified file instead of default one.
100
101
101
    misc/maintance/sync_db_comments.pl -renumber
102
    misc/maintance/sync_db_comments.pl -renumber
102
    Renumbers all comments like Comment_1,2,..
103
    Renumbers all comments like Comment_1,2,..
103
- 

Return to bug 32334