|
Lines 2-8
Link Here
|
| 2 |
# **************************** |
2 |
# **************************** |
| 3 |
package MySQLaccess; |
3 |
package MySQLaccess; |
| 4 |
#use strict; |
4 |
#use strict; |
| 5 |
use POSIX qw(tmpnam); |
5 |
use File::Temp qw(tempfile tmpnam); |
| 6 |
use Fcntl; |
6 |
use Fcntl; |
| 7 |
|
7 |
|
| 8 |
BEGIN { |
8 |
BEGIN { |
|
Lines 32-38
Link Here
|
| 32 |
$ACCESS_U_BCK = 'user_backup'; |
32 |
$ACCESS_U_BCK = 'user_backup'; |
| 33 |
$ACCESS_D_BCK = 'db_backup'; |
33 |
$ACCESS_D_BCK = 'db_backup'; |
| 34 |
$DIFF = '/usr/bin/diff'; |
34 |
$DIFF = '/usr/bin/diff'; |
| 35 |
$TMP_PATH = '/tmp'; #path to writable tmp-directory |
|
|
| 36 |
$MYSQLDUMP = '@bindir@/mysqldump'; |
35 |
$MYSQLDUMP = '@bindir@/mysqldump'; |
| 37 |
#path to mysqldump executable |
36 |
#path to mysqldump executable |
| 38 |
|
37 |
|
|
Lines 431-437
Link Here
|
| 431 |
# no caching on STDOUT |
430 |
# no caching on STDOUT |
| 432 |
$|=1; |
431 |
$|=1; |
| 433 |
|
432 |
|
| 434 |
$MYSQL_CNF = POSIX::tmpnam(); |
433 |
$$MYSQL_CNF = tmpnam(); |
| 435 |
%MYSQL_CNF = (client => { }, |
434 |
%MYSQL_CNF = (client => { }, |
| 436 |
mysql => { }, |
435 |
mysql => { }, |
| 437 |
mysqldump => { }, |
436 |
mysqldump => { }, |
|
Lines 576-583
Link Here
|
| 576 |
push(@MySQLaccess::Grant::Error,'not_found_mysql') if !(-x $MYSQL); |
575 |
push(@MySQLaccess::Grant::Error,'not_found_mysql') if !(-x $MYSQL); |
| 577 |
push(@MySQLaccess::Grant::Error,'not_found_diff') if !(-x $DIFF); |
576 |
push(@MySQLaccess::Grant::Error,'not_found_diff') if !(-x $DIFF); |
| 578 |
push(@MySQLaccess::Grant::Error,'not_found_mysqldump') if !(-x $MYSQLDUMP); |
577 |
push(@MySQLaccess::Grant::Error,'not_found_mysqldump') if !(-x $MYSQLDUMP); |
| 579 |
push(@MySQLaccess::Grant::Error,'not_found_tmp') if !(-d $TMP_PATH); |
|
|
| 580 |
push(@MySQLaccess::Grant::Error,'write_err_tmp') if !(-w $TMP_PATH); |
| 581 |
if (@MySQLaccess::Grant::Error) { |
578 |
if (@MySQLaccess::Grant::Error) { |
| 582 |
MySQLaccess::Report::Print_Error_Messages() ; |
579 |
MySQLaccess::Report::Print_Error_Messages() ; |
| 583 |
exit 0; |
580 |
exit 0; |
|
Lines 1776-1792
Link Here
|
| 1776 |
@before = sort(@before); |
1773 |
@before = sort(@before); |
| 1777 |
@after = sort(@after); |
1774 |
@after = sort(@after); |
| 1778 |
|
1775 |
|
| 1779 |
$before = "$MySQLaccess::TMP_PATH/$MySQLaccess::script.before.$$"; |
1776 |
($hb, $before) = tempfile("$MySQLaccess::script.XXXXXX") or |
| 1780 |
$after = "$MySQLaccess::TMP_PATH/$MySQLaccess::script.after.$$"; |
1777 |
push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!"); |
| 1781 |
#$after = "/tmp/t0"; |
1778 |
($ha, $after) = tempfile("$MySQLaccess::script.XXXXXX") or |
| 1782 |
open(BEFORE,"> $before") || |
1779 |
push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!"); |
| 1783 |
push(@MySQLaccess::Report::Errors,"Can't open temporary file $before for writing"); |
1780 |
|
| 1784 |
open(AFTER,"> $after") || |
1781 |
print $hb join("\n",@before); |
| 1785 |
push(@MySQLaccess::Report::Errors,"Can't open temporary file $after for writing"); |
1782 |
print $ha join("\n",@after); |
| 1786 |
print BEFORE join("\n",@before); |
1783 |
close $hb; |
| 1787 |
print AFTER join("\n",@after); |
1784 |
close $ha; |
| 1788 |
close(BEFORE); |
|
|
| 1789 |
close(AFTER); |
| 1790 |
|
1785 |
|
| 1791 |
# ---------------------------------- |
1786 |
# ---------------------------------- |
| 1792 |
# compute difference |
1787 |
# compute difference |
|
Lines 1799-1806
Link Here
|
| 1799 |
|
1794 |
|
| 1800 |
# ---------------------------------- |
1795 |
# ---------------------------------- |
| 1801 |
# cleanup temp. files |
1796 |
# cleanup temp. files |
| 1802 |
unlink(BEFORE); |
1797 |
unlink($before); |
| 1803 |
unlink(AFTER); |
1798 |
unlink($after); |
| 1804 |
|
1799 |
|
| 1805 |
return \@diffs; |
1800 |
return \@diffs; |
| 1806 |
} |
1801 |
} |
|
Lines 2315-2328
Link Here
|
| 2315 |
=> "The diff program <$MySQLaccess::DIFF> could not be found.\n" |
2310 |
=> "The diff program <$MySQLaccess::DIFF> could not be found.\n" |
| 2316 |
."+ Check your path, or\n" |
2311 |
."+ Check your path, or\n" |
| 2317 |
."+ edit the source of this script to point \$DIFF to the diff program.\n" |
2312 |
."+ edit the source of this script to point \$DIFF to the diff program.\n" |
| 2318 |
,'not_found_tmp' |
|
|
| 2319 |
=> "The temporary directory <$MySQLaccess::TMP_PATH> could not be found.\n" |
| 2320 |
."+ create this directory (writeable!), or\n" |
| 2321 |
."+ edit the source of this script to point \$TMP_PATH to the right directory.\n" |
| 2322 |
,'write_err_tmp' |
| 2323 |
=> "The temporary directory <$MySQLaccess::TMP_PATH> is not writable.\n" |
| 2324 |
."+ make this directory writeable!, or\n" |
| 2325 |
."+ edit the source of this script to point \$TMP_PATH to another directory.\n" |
| 2326 |
,'Unrecognized_option' |
2313 |
,'Unrecognized_option' |
| 2327 |
=> "Sorry,\n" |
2314 |
=> "Sorry,\n" |
| 2328 |
."You are using an old version of the mysql-program,\n" |
2315 |
."You are using an old version of the mysql-program,\n" |