Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1981

Přidáno uživatelem Ondřej Fibich před více než 11 roky(ů)

Opravy:
- chybne zmenene mazani zarizeni (uvedeno do puvodniho stavu)

Zobrazit rozdíly:

freenetis/branches/1.1/application/controllers/devices.php
$device = new Device_Model($device_id);
if ($device->id == 0)
if (!$device->id)
{
Controller::error(RECORD);
}
......
Controller::error(ACCESS);
}
self::delete_device($device_id);
$linkback = Path::instance()->previous();
if (url::slice(url_lang::uri($linkback), 1, 1) == 'show')
{
$linkback = 'devices/show_all';
}
// delete
try
{
self::delete_device($device_id);
status::success('Device has been successfully deleted.');
}
catch (Exception $e)
{
Log::add_exception($e);
status::error(__($e->getMessage()), $e);
}
$this->redirect($linkback);
}
/**
......
*
* @author Ondrej Fibich, Jan Dubina
* @param integer $device_id
* @return boolean Done?
*/
public static function delete_device($device_id)
{
......
$transaction_attempt_counter = 0;
$max_attempts = max(1, abs(Settings::get('db_trans_deadlock_repeats_count')));
$timeout = abs(Settings::get('db_trans_deadlock_repeats_timeout'));
/**
* @TODO repair
*/
// try to delete
/*while (TRUE)
{*/
while (TRUE)
{
try // try to make DB transction
{
$device->transaction_start();
......
}
$device->transaction_commit();
return TRUE; // done
}
catch (Exception $e) // failed => rollback and wait 100ms before next attempt
{
......
throw $e;
}
//usleep($timeout);
usleep($timeout);
}
/*}*/
}
return FALSE;
}
/**

Také k dispozici: Unified diff