/usr/bin/wiki-toolkit-setupdb is in libwiki-toolkit-perl 0.85-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | #!/usr/bin/perl -w
use strict;
use Getopt::Long;
my ($dbtype, $dbname, $dbuser, $dbpass, $dbhost, $help, $preclear);
GetOptions( "type=s" => \$dbtype,
"name=s" => \$dbname,
"user=s" => \$dbuser,
"pass=s" => \$dbpass,
"host=s" => \$dbhost,
"help" => \$help,
"force-preclear" => \$preclear
);
unless (defined($dbtype)) {
print "You must supply a database type with the --type option.\n";
print "Further help can be found by typing 'perldoc $0'\n";
exit 1;
}
unless (defined($dbname)) {
print "You must supply a database name with the --name option.\n";
print "Further help can be found by typing 'perldoc $0'\n";
exit 1;
}
if ($help) {
print "Help can be found by typing 'perldoc $0'\n";
exit 0;
}
my %setup_modules = ( postgres => "Wiki::Toolkit::Setup::Pg",
mysql => "Wiki::Toolkit::Setup::MySQL",
sqlite => "Wiki::Toolkit::Setup::SQLite"
);
unless ( defined($setup_modules{$dbtype}) ) {
print "dbtype must be one of 'postgres', 'mysql', and 'sqlite'\n";
print "further help can be found by typing 'perldoc $0'\n";
exit 1;
}
my $class = $setup_modules{$dbtype};
eval "require $class";
if ( $@ ) {
print "Couldn't 'use' $class: $@\n";
exit 1;
}
if ($preclear) {
no strict 'refs';
&{$class."::cleardb"}($dbname, $dbuser, $dbpass, $dbhost);
}
{
no strict 'refs';
&{$class."::setup"}($dbname, $dbuser, $dbpass, $dbhost);
}
=head1 NAME
wiki-toolkit-setupdb - Set up a database storage backend for Wiki::Toolkit.
=head1 SYNOPSIS
# Set up or update the storage backend, leaving any existing data
# intact. Useful for upgrading from old versions of Wiki::Toolkit to
# newer ones with more backend features.
wiki-toolkit-setupdb --type postgres
--name mywiki \
--user wiki \
--pass wiki \
--host 'db.example.com'
# Clear out any existing data and set up a fresh backend from scratch.
wiki-toolkit-setupdb --type postgres
--name mywiki \
--user wiki \
--pass wiki \
--force-preclear
=head1 DESCRIPTION
Takes three mandatory arguments:
=over 4
=item type
The database type. Should be one of 'postgres', 'mysql' and 'sqlite'.
=item name
The database name.
=item user
The user that connects to the database. It must have permission
to create and drop tables in the database.
=back
two optional arguments:
=over 4
=item pass
The user's database password.
=item host
The hostname of the machine the database server is running on (omit
for local databases).
=back
and one optional flag:
=over 4
=item force-preclear
By default, this script will leave any existing data alone. To force
that to be cleared out first, pass the C<--force-preclear> flag.
=back
=head1 AUTHOR
Kake Pugh (kake@earth.li).
=head1 COPYRIGHT
Copyright (C) 2002-2003 Kake Pugh. All Rights Reserved.
Copyright (C) 2006 the Wiki::Toolkit team. All Rights Reserved.
This code is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=head1 SEE ALSO
L<Wiki::Toolkit>
=cut
1;
|