|
Lines 19-25
Link Here
|
| 19 |
# |
19 |
# |
| 20 |
|
20 |
|
| 21 |
use Modern::Perl; |
21 |
use Modern::Perl; |
| 22 |
use Getopt::Long; |
22 |
use Getopt::Long qw(:config no_ignore_case); |
| 23 |
|
23 |
|
| 24 |
use C4::Context; |
24 |
use C4::Context; |
| 25 |
|
25 |
|
|
Lines 29-50
my $verbose = 0;
Link Here
|
| 29 |
my $help = 0; |
29 |
my $help = 0; |
| 30 |
my $apply = 0; |
30 |
my $apply = 0; |
| 31 |
my $remove = ''; |
31 |
my $remove = ''; |
|
|
32 |
my $dryRun = 0; |
| 32 |
my $insert = ''; |
33 |
my $insert = ''; |
| 33 |
my $list = 0; |
34 |
my $list = 0; |
| 34 |
my $pending = 0; |
35 |
my $pending = 0; |
| 35 |
my $directory = ''; |
36 |
my $directory = ''; |
| 36 |
my $git = ''; |
37 |
my $git = ''; |
|
|
38 |
my $single = ''; |
| 37 |
|
39 |
|
| 38 |
GetOptions( |
40 |
GetOptions( |
| 39 |
'v|verbose:i' => \$verbose, |
41 |
'v|verbose:i' => \$verbose, |
| 40 |
'h|help' => \$help, |
42 |
'h|help' => \$help, |
| 41 |
'a|apply' => \$apply, |
43 |
'a|apply' => \$apply, |
|
|
44 |
'D|dry-run' => \$dryRun, |
| 42 |
'd|directory:s' => \$directory, |
45 |
'd|directory:s' => \$directory, |
| 43 |
'r|remove:s' => \$remove, |
46 |
'r|remove:s' => \$remove, |
| 44 |
'i|insert:s' => \$insert, |
47 |
'i|insert:s' => \$insert, |
| 45 |
'l|list' => \$list, |
48 |
'l|list' => \$list, |
| 46 |
'p|pending' => \$pending, |
49 |
'p|pending' => \$pending, |
| 47 |
'g|git:s' => \$git, |
50 |
'g|git:s' => \$git, |
|
|
51 |
's|single:s' => \$single, |
| 48 |
); |
52 |
); |
| 49 |
|
53 |
|
| 50 |
my $usage = << 'ENDUSAGE'; |
54 |
my $usage = << 'ENDUSAGE'; |
|
Lines 58-78
applied.
Link Here
|
| 58 |
Also acts as a gateway to CRUD the koha.database_updates-table. |
62 |
Also acts as a gateway to CRUD the koha.database_updates-table. |
| 59 |
|
63 |
|
| 60 |
-v --verbose Integer, 1 is not so verbose, 3 is maximally verbose. |
64 |
-v --verbose Integer, 1 is not so verbose, 3 is maximally verbose. |
|
|
65 |
|
| 66 |
-D --dry-run Flag, Run the script but don't execute any atomicupdates. |
| 67 |
You should use --verbose 3 to see what is happening. |
| 68 |
|
| 61 |
-h --help Flag, This nice help! |
69 |
-h --help Flag, This nice help! |
|
|
70 |
|
| 62 |
-a --apply Flag, Apply all the pending atomicupdates from the |
71 |
-a --apply Flag, Apply all the pending atomicupdates from the |
| 63 |
atomicupdates-directory. |
72 |
atomicupdates-directory. |
|
|
73 |
|
| 64 |
-d --directory Path, From which directory to look for atomicupdate-scripts. |
74 |
-d --directory Path, From which directory to look for atomicupdate-scripts. |
| 65 |
Defaults to '$KOHA_PATH/installer/data/mysql/atomicupdate/' |
75 |
Defaults to '$KOHA_PATH/installer/data/mysql/atomicupdate/' |
|
|
76 |
|
| 77 |
-s --single Path, execute a single atomicupdate-script. |
| 78 |
eg. atomicupdate/Bug01243-SingleFeature.pl |
| 79 |
|
| 66 |
-r --remove String, Remove the upgrade entry from koha.database_updates |
80 |
-r --remove String, Remove the upgrade entry from koha.database_updates |
| 67 |
eg. --remove "Bug71337" |
81 |
eg. --remove "Bug71337" |
|
|
82 |
|
| 68 |
-i --insert Path, Add an upgrade log entry for the given atomicupdate-file. |
83 |
-i --insert Path, Add an upgrade log entry for the given atomicupdate-file. |
| 69 |
Useful to revert an accidental --remove -operation or for |
84 |
Useful to revert an accidental --remove -operation or for |
| 70 |
testing. |
85 |
testing. Does not execute the update script, simply adds |
|
|
86 |
the log entry. |
| 71 |
eg. -i installer/data/mysql/atomicupdate/Bug5453-Example.pl |
87 |
eg. -i installer/data/mysql/atomicupdate/Bug5453-Example.pl |
|
|
88 |
|
| 72 |
-l --list Flag, List all entries in the koha.database_updates-table. |
89 |
-l --list Flag, List all entries in the koha.database_updates-table. |
| 73 |
This typically means all applied atomicupdates. |
90 |
This typically means all applied atomicupdates. |
|
|
91 |
|
| 74 |
-p --pending Flag, List all pending atomicupdates from the |
92 |
-p --pending Flag, List all pending atomicupdates from the |
| 75 |
atomicupdates-directory. |
93 |
atomicupdates-directory. |
|
|
94 |
|
| 76 |
-g --git Path, Build the update order from the Git repository given, |
95 |
-g --git Path, Build the update order from the Git repository given, |
| 77 |
or default to the Git repository in $KOHA_PATH. |
96 |
or default to the Git repository in $KOHA_PATH. |
| 78 |
Eg. --git 1, to build with default values, or |
97 |
Eg. --git 1, to build with default values, or |
|
Lines 126-132
if ( $help ) {
Link Here
|
| 126 |
|
145 |
|
| 127 |
my $atomicupdater = Koha::AtomicUpdater->new({verbose => $verbose, |
146 |
my $atomicupdater = Koha::AtomicUpdater->new({verbose => $verbose, |
| 128 |
scriptDir => $directory, |
147 |
scriptDir => $directory, |
| 129 |
gitRepo => (length($git) == 1) ? '' : $git}); |
148 |
gitRepo => (length($git) == 1) ? '' : $git, |
|
|
149 |
dryRun => $dryRun,} |
| 150 |
,); |
| 130 |
|
151 |
|
| 131 |
if ($git) { |
152 |
if ($git) { |
| 132 |
$atomicupdater->buildUpdateOrderFromGit(10000); |
153 |
$atomicupdater->buildUpdateOrderFromGit(10000); |