Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1645

Přidáno uživatelem David Raška před asi 12 roky(ů)

Opravy:
- oprava databazoveho deadlocku

Upravy:
- Pridana indikace stavu CRONu

Zobrazit rozdíly:

freenetis/branches/testing/application/i18n/cs_CZ/texts.php
'creating of own records' => 'Vytváření vlastních záznamů',
'credit' => 'Kredit',
'credit subaccounts' => 'Kreditní podúčty',
'cron state' => 'Stav CRONu',
'csv file template' => 'Šablona CSV souboru',
'csv file templates' => 'Šablony CSV souborů',
'currency' => 'Měna',
freenetis/branches/testing/application/models/message.php
*/
public function activate_unallowed_connecting_place_message($user_id)
{
// preparation
$message = ORM::factory('message')->where(array
(
'type' => self::UNALLOWED_CONNECTING_PLACE_MESSAGE
))->find();
$mm = new Message_Model();
// message do not exists
if (!$message || !$message->id)
try
{
throw new Exception('Debtor message not founded');
$mm->transaction_start();
// preparation
$message = $mm->where(array
(
'type' => self::UNALLOWED_CONNECTING_PLACE_MESSAGE
))->find();
// message do not exists
if (!$message || !$message->id)
{
throw new Exception('Debtor message not founded');
}
// deletes old redirections
Database::instance()->delete('messages_ip_addresses', array
(
'message_id' => $message->id
));
// find IP addresses with interrupted membership
$ip_model = new Ip_address_Model();
$ips = $ip_model->get_ip_addresses_with_unallowed_connecting_place();
// activate
$result = self::activate_redirection($message, $ips, $user_id);
$mm->transaction_commit();
return $result;
}
// deletes old redirections
Database::instance()->delete('messages_ip_addresses', array
(
'message_id' => $message->id
));
// find IP addresses with interrupted membership
$ip_model = new Ip_address_Model();
$ips = $ip_model->get_ip_addresses_with_unallowed_connecting_place();
// activate
return self::activate_redirection($message, $ips, $user_id);
catch (Exception $e)
{
$mm->transaction_rollback();
Log::add_exception($e);
return 0;
}
}
/**
freenetis/branches/testing/application/controllers/scheduler.php
// send notification from monitoring
self::monitoring_notification();
// set state of module (last activation time)
Settings::set('cron_state', date('Y-m-d H:i:s'));
}
/**
......
) < time())
{
ORM::factory('message')
->activate_unallowed_connecting_place_message(1);
->activate_unallowed_connecting_place_message(User_Model::MAIN_USER);
}
}
freenetis/branches/testing/application/controllers/allowed_subnets.php
// finds all allowed subnet of member
$allowed_subnet_model = new Allowed_subnet_Model();
$allowed_subnets = $allowed_subnet_model->where('member_id', $member->id)
->where('member_id', $member->id)
->orderby(array('enabled' => 'desc', 'last_update' => 'desc'))
->find_all();
try
{
$allowed_subnet_model->transaction_start();
$allowed_subnets = $allowed_subnet_model->where('member_id', $member->id)
->where('member_id', $member->id)
->orderby(array('enabled' => 'desc', 'last_update' => 'desc'))
->find_all();
$arr_subnets = array();
$arr_subnets = array();
// to_enabled have the hightest priority
foreach ($allowed_subnets as $allowed_subnet)
{
if (in_array($allowed_subnet->subnet_id, $to_remove))
// to_enabled have the hightest priority
foreach ($allowed_subnets as $allowed_subnet)
{
$allowed_subnet->delete();
continue;
}
if (in_array($allowed_subnet->subnet_id, $to_remove))
{
$allowed_subnet->delete();
continue;
}
if (!in_array($allowed_subnet->subnet_id, $to_enable) &&
!in_array($allowed_subnet->subnet_id, $to_disable))
{
$arr_subnets[] = $allowed_subnet->subnet_id;
if (!in_array($allowed_subnet->subnet_id, $to_enable) &&
!in_array($allowed_subnet->subnet_id, $to_disable))
{
$arr_subnets[] = $allowed_subnet->subnet_id;
}
}
}
$arr_subnets = arr::merge($to_enable, $arr_subnets, $to_disable);
$arr_subnets = arr::merge($to_enable, $arr_subnets, $to_disable);
// maximum count of allowed subnets (0 = unlimited)
$max_enabled = ($member->allowed_subnets_count->count) ?
$member->allowed_subnets_count->count : count($arr_subnets);
// maximum count of allowed subnets (0 = unlimited)
$max_enabled = ($member->allowed_subnets_count->count) ?
$member->allowed_subnets_count->count : count($arr_subnets);
$enabled = 0;
foreach ($arr_subnets as $subnet)
{
if (!$subnet)
continue;
if ($aid = $allowed_subnet_model->exists($member->id, $subnet))
$enabled = 0;
foreach ($arr_subnets as $subnet)
{
$allowed_subnet_model->where('id', $aid)->find();
}
else
{
$allowed_subnet_model->clear();
$allowed_subnet_model->member_id = $member->id;
$allowed_subnet_model->subnet_id = $subnet;
}
if (!$subnet)
continue;
$allowed_subnet_model->enabled = ($enabled < $max_enabled);
if ($aid = $allowed_subnet_model->exists($member->id, $subnet))
{
$allowed_subnet_model->where('id', $aid)->find();
}
else
{
$allowed_subnet_model->clear();
$allowed_subnet_model->member_id = $member->id;
$allowed_subnet_model->subnet_id = $subnet;
}
$enabled++;
$allowed_subnet_model->enabled = ($enabled < $max_enabled);
$allowed_subnet_model->save();
$enabled++;
$allowed_subnet_model->save();
}
$allowed_subnet_model->transaction_commit();
}
catch (Exception $e)
{
$allowed_subnet_model->transaction_rollback();
Log::add_exception($e);
}
}
}
freenetis/branches/testing/application/controllers/settings.php
}
$data[__('DB schema revision')] = Settings::get('db_schema_version');
$data[__('CRON state')] = module_state::get_state('cron');
$data[__('Redirection state')] = module_state::get_state('redirection');
$data[__('QoS state')] = module_state::get_state('qos');
$data[__('Monitoring state')] = module_state::get_state('monitoring');

Také k dispozici: Unified diff