Persist specialstate.
This commit is contained in:
parent
87163f5d0f
commit
81a937d90a
2 changed files with 35 additions and 0 deletions
|
|
@ -22,6 +22,17 @@ sub addSpecialState {
|
|||
my $self = shift;
|
||||
my $state = shift || croak 'state is required';
|
||||
my $id = shift;
|
||||
my $db = $self->session->db;
|
||||
|
||||
$db->write( 'delete from users_specialState where userId=? and specialState=?', [
|
||||
$self->getId,
|
||||
$state,
|
||||
] );
|
||||
|
||||
$db->write( 'insert into users_specialState (userId, specialState) values (?,?)', [
|
||||
$self->getId,
|
||||
$state,
|
||||
] );
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -40,7 +51,13 @@ sub removeSpecialState {
|
|||
my $self = shift;
|
||||
my $state = shift || croak 'state is required';
|
||||
my $id = shift;
|
||||
my $db = $self->session->db;
|
||||
|
||||
$db->write( 'delete from users_specialState where userId=? and specialState=?', [
|
||||
$self->getId,
|
||||
$state,
|
||||
] );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ addPluginsToConfigFile( $session );
|
|||
addTemplateColumnToNewsletterCollection( $session );
|
||||
addRecentColumnToNewsletterCollection( $session );
|
||||
renamespaceTemplates( $session );
|
||||
addSpecialStateTable( $session );
|
||||
|
||||
finish($session);
|
||||
|
||||
|
|
@ -255,6 +256,23 @@ sub renamespaceTemplates {
|
|||
print "Done.\n";
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub addSpecialStateTable {
|
||||
my $session = shift;
|
||||
|
||||
print "\tAdding special state table...";
|
||||
|
||||
$session->db->write( <<EOSQL );
|
||||
create table if not exists users_specialState (
|
||||
userId char(22) binary not null,
|
||||
specialState char(30) not null,
|
||||
primary key ( userId, specialState )
|
||||
)
|
||||
EOSQL
|
||||
|
||||
print "Done.\n";
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub start {
|
||||
my $webguiRoot = shift;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue