Revision 66c08b64
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/Controller/Admin.pm | ||
---|---|---|
12 | 12 |
use SL::DB::Printer; |
13 | 13 |
use SL::Helper::Flash; |
14 | 14 |
use SL::Locale::String qw(t8); |
15 |
use SL::System::InstallationLock; |
|
15 | 16 |
use SL::User; |
16 | 17 |
|
17 | 18 |
use Rose::Object::MakeMethods::Generic |
18 | 19 |
( |
19 |
'scalar --get_set_init' => [ qw(client user group printer nologin_file_name db_cfg is_locked
|
|
20 |
'scalar --get_set_init' => [ qw(client user group printer db_cfg is_locked |
|
20 | 21 |
all_dateformats all_numberformats all_countrycodes all_stylesheets all_menustyles all_clients all_groups all_users all_rights all_printers) ], |
21 | 22 |
); |
22 | 23 |
|
... | ... | |
355 | 356 |
|
356 | 357 |
sub action_unlock_system { |
357 | 358 |
my ($self) = @_; |
358 |
unlink $self->nologin_file_name; |
|
359 |
|
|
360 |
SL::System::InstallationLock->unlock; |
|
359 | 361 |
flash_later('info', t8('Lockfile removed!')); |
360 | 362 |
$self->redirect_to(action => 'show'); |
361 | 363 |
} |
... | ... | |
363 | 365 |
sub action_lock_system { |
364 | 366 |
my ($self) = @_; |
365 | 367 |
|
366 |
my $fh = IO::File->new($self->nologin_file_name, "w"); |
|
367 |
if (!$fh) { |
|
368 |
$::form->error(t8('Cannot create Lock!')); |
|
369 |
|
|
370 |
} else { |
|
371 |
$fh->close; |
|
372 |
flash_later('info', t8('Lockfile created!')); |
|
373 |
$self->redirect_to(action => 'show'); |
|
374 |
} |
|
368 |
SL::System::InstallationLock->unlock; |
|
369 |
flash_later('info', t8('Lockfile created!')); |
|
370 |
$self->redirect_to(action => 'show'); |
|
375 | 371 |
} |
376 | 372 |
|
377 | 373 |
# |
... | ... | |
379 | 375 |
# |
380 | 376 |
|
381 | 377 |
sub init_db_cfg { $::lx_office_conf{'authentication/database'} } |
382 |
sub init_nologin_file_name { $::lx_office_conf{paths}->{userspath} . '/nologin'; } |
|
383 |
sub init_is_locked { -e $_[0]->nologin_file_name } |
|
378 |
sub init_is_locked { SL::System::InstallationLock->is_locked } |
|
384 | 379 |
sub init_client { SL::DB::Manager::AuthClient->find_by(id => ($::form->{id} || ($::form->{client} || {})->{id})) } |
385 | 380 |
sub init_user { SL::DB::AuthUser ->new(id => ($::form->{id} || ($::form->{user} || {})->{id}))->load } |
386 | 381 |
sub init_group { SL::DB::AuthGroup ->new(id => ($::form->{id} || ($::form->{group} || {})->{id}))->load } |
Auch abrufbar als: Unified diff
Locking in eigenes Modul verschieben