mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
#1150: Spurious message "A restore is running..." - FIXED !
SVN:trunk[3864]
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// Copyright (C) 2013-2015 Combodo SARL
|
||||
// Copyright (C) 2013-2016 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,7 +19,7 @@
|
||||
/**
|
||||
* Backup from an interactive session
|
||||
*
|
||||
* @copyright Copyright (C) 2013-215 Combodo SARL
|
||||
* @copyright Copyright (C) 2013-2016 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
@@ -77,9 +77,8 @@ try
|
||||
|
||||
$sEnvironment = utils::ReadParam('environment', 'production', false, 'raw_data');
|
||||
$oRestoreMutex = new iTopMutex('restore.'.$sEnvironment);
|
||||
if ($oRestoreMutex->TryLock())
|
||||
if (!$oRestoreMutex->IsLocked())
|
||||
{
|
||||
$oRestoreMutex->Unlock();
|
||||
$sFile = utils::ReadParam('file', '', false, 'raw_data');
|
||||
$sToken = str_replace(' ', '', (string)microtime());
|
||||
$sTokenFile = APPROOT.'/data/restore.'.$sToken.'.tok';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// Copyright (C) 2014-2015 Combodo SARL
|
||||
// Copyright (C) 2014-2016 Combodo SARL
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@@ -28,24 +28,8 @@ class BackupHandler extends ModuleHandlerAPI
|
||||
{
|
||||
try
|
||||
{
|
||||
$oBackupMutex = new iTopMutex('backup.'.utils::GetCurrentEnvironment());
|
||||
if ($oBackupMutex->TryLock())
|
||||
{
|
||||
$oBackupMutex->Unlock();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not needed: the DB dump is done in a single transaction
|
||||
//MetaModel::GetConfig()->Set('access_mode', ACCESS_READONLY, 'itop-backup');
|
||||
//MetaModel::GetConfig()->Set('access_message', ' - '.dict::S('bkp-backup-running'), 'itop-backup');
|
||||
}
|
||||
|
||||
$oRestoreMutex = new iTopMutex('restore.'.utils::GetCurrentEnvironment());
|
||||
if ($oRestoreMutex->TryLock())
|
||||
{
|
||||
$oRestoreMutex->Unlock();
|
||||
}
|
||||
else
|
||||
if ($oRestoreMutex->IsLocked())
|
||||
{
|
||||
IssueLog::Info(__class__.'::'.__function__.' A user is trying to use iTop while a restore is running. The requested page is in read-only mode.');
|
||||
MetaModel::GetConfig()->Set('access_mode', ACCESS_READONLY, 'itop-backup');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// Copyright (C) 2014 Combodo SARL
|
||||
// Copyright (C) 2016 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -20,7 +20,7 @@
|
||||
/**
|
||||
* Monitor the backup
|
||||
*
|
||||
* @copyright Copyright (C) 2013 Combodo SARL
|
||||
* @copyright Copyright (C) 2016 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
@@ -169,14 +169,13 @@ try
|
||||
}
|
||||
|
||||
$oRestoreMutex = new iTopMutex('restore.'.utils::GetCurrentEnvironment());
|
||||
if ($oRestoreMutex->TryLock())
|
||||
if ($oRestoreMutex->IsLocked())
|
||||
{
|
||||
$oRestoreMutex->Unlock();
|
||||
$sDisableRestore = '';
|
||||
$sDisableRestore = 'disabled="disabled"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sDisableRestore = 'disabled="disabled"';
|
||||
$sDisableRestore = '';
|
||||
}
|
||||
|
||||
// 1st table: list the backups made in the background
|
||||
@@ -271,20 +270,12 @@ try
|
||||
// Ongoing operation ?
|
||||
//
|
||||
$oBackupMutex = new iTopMutex('backup.'.utils::GetCurrentEnvironment());
|
||||
if ($oBackupMutex->TryLock())
|
||||
{
|
||||
$oBackupMutex->Unlock();
|
||||
}
|
||||
else
|
||||
if ($oBackupMutex->IsLocked())
|
||||
{
|
||||
$oP->p(Dict::S('bkp-backup-running'));
|
||||
}
|
||||
$oRestoreMutex = new iTopMutex('restore.'.utils::GetCurrentEnvironment());
|
||||
if ($oRestoreMutex->TryLock())
|
||||
{
|
||||
$oRestoreMutex->Unlock();
|
||||
}
|
||||
else
|
||||
if ($oRestoreMutex->IsLocked())
|
||||
{
|
||||
$oP->p(Dict::S('bkp-restore-running'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user