Code:
sub install {
# -------------------------------------------------------------------
#
my ($mgr, $tar) = @_;
my $c = $DB->creator('EditorDetails');
my $error = '';
my $message = '';
$mgr->install_menu ( 'EditorMonitor', [ ['About', 'admin.cgi?do=plugin&plugin=EditorMonitor&func=about'] ] );
$mgr->install_menu ( 'EditorMonitor', [ ['Editors Online', 'admin.cgi?do=plugin&plugin=EditorMonitor&func=whoson'] ] );
$mgr->install_menu ( 'EditorMonitor', [ ['Repair Table', 'admin.cgi?do=plugin&plugin=EditorMonitor&func=repair'] ] );
$mgr->install_menu ( 'EditorMonitor', [ ['Statistics', 'admin.cgi?do=plugin&plugin=EditorMonitor&func=statistics'] ] );
$mgr->install_menu ( 'EditorMonitor', [ ['Table Editor', 'admin.cgi?do=plugin&plugin=EditorMonitor&func=tableeditor'] ] );
$c->cols (
Username => { pos => 1, type => 'CHAR', size => '50', not_null => 1 },
Email => { pos => 2, type => 'CHAR', size => '75', not_null => 0 },
Bio => { pos => 3, type => 'CHAR', size => '255', not_null => 0 },
Webpage => { pos => 4, type => 'CHAR', size => '255', not_null => 0 },
MyAddress => { pos => 5, type => 'CHAR', size => '75', not_null => 0},
Editor_Status => { pos => 6, type => 'CHAR', size => '75' , not_null => 1, default => 'None' },
Editor_Since => { pos => 7, type => 'DATE' },
Validations => { pos => 8, type => 'INT', not_null => 1, unsigned => 1, default => 0 },
Clicks => { pos => 9, type => 'INT', not_null => 1, unsigned => 1, default => 0 },
Last_Login => { pos => 10, type => 'DATE' },
Total_Logins => { pos => 11, type => 'INT', not_null => 1, unsigned => 1, default => 0 },
EditorNotes => { pos => 12, type => 'CHAR', size => '255', not_null => 0 },
TS => { pos => 13, type => 'TIMESTAMP' }
);
if (! $c->create()) {
$GT::SQL::errcode ||= '';
$GT::SQL::errcode eq 'TBLEXISTS' ? ($message .= "Could not create table EditorDetails (table already
exists)\n") :
($error .= "Could not create table
EditorDetails: $GT::SQL::error)");
$c->set_defaults();
$c->save_schema();
};
return "The plugin has been successfully installed!";
}