Revize 2262
Přidáno uživatelem Ondřej Fibich před téměř 11 roky(ů)
freenetis/branches/1.1/application/controllers/scheduler.php | ||
---|---|---|
try
|
||
{
|
||
// first day in month (per month)
|
||
if (date('m', $this->t) == '01' && Settings::get('ulogd_enabled') == '1')
|
||
if (date('d', $this->t) == '01' && Settings::get('ulogd_enabled') == '1')
|
||
{
|
||
$this->members_traffic_partitions_montly();
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
self::log_error('members_traffic_partitions_daily', $e);
|
||
self::log_error('members_traffic_partitions_monthly', $e);
|
||
}
|
||
|
||
try
|
freenetis/branches/1.1/application/models/members_traffic.php | ||
---|---|---|
{
|
||
// get all old partitions
|
||
$partitions = $this->db->query("
|
||
SELECT partition_name FROM
|
||
(
|
||
SELECT DISTINCT CONCAT('p_', DATE_FORMAT(date, '%Y_%m_%d')) AS partition_name
|
||
FROM members_traffics_daily
|
||
WHERE DATE_SUB(NOW(), INTERVAL 2 MONTH) > date
|
||
) p GROUP BY partition_name
|
||
");
|
||
SELECT DISTINCT PARTITION_NAME AS partition_name
|
||
FROM INFORMATION_SCHEMA.PARTITIONS
|
||
WHERE TABLE_NAME = 'members_traffics_daily' AND
|
||
TABLE_SCHEMA = ? AND
|
||
PARTITION_NAME <> 'p_first' AND
|
||
STR_TO_DATE(PARTITION_NAME, 'p_%Y_%m_%d') <
|
||
DATE_SUB(NOW(), INTERVAL 2 MONTH)
|
||
ORDER BY PARTITION_NAME
|
||
", Config::get('db_name'));
|
||
|
||
foreach ($partitions as $partition)
|
||
{
|
||
... | ... | |
{
|
||
// get all old partitions
|
||
$partitions = $this->db->query("
|
||
SELECT partition_name FROM
|
||
(
|
||
SELECT DISTINCT CONCAT('p_', DATE_FORMAT(date, '%Y_%m_01')) AS partition_name
|
||
FROM members_traffics_monthly
|
||
WHERE DATE_SUB(NOW(), INTERVAL 2 YEAR) > date
|
||
) p GROUP BY partition_name
|
||
");
|
||
SELECT DISTINCT PARTITION_NAME AS partition_name
|
||
FROM INFORMATION_SCHEMA.PARTITIONS
|
||
WHERE TABLE_NAME = 'members_traffics_monthly' AND
|
||
TABLE_SCHEMA = ? AND
|
||
PARTITION_NAME <> 'p_first' AND
|
||
STR_TO_DATE(PARTITION_NAME, 'p_%Y_%m_%d') <
|
||
DATE_SUB(NOW(), INTERVAL 2 YEAR)
|
||
ORDER BY PARTITION_NAME
|
||
", Config::get('db_name'));
|
||
|
||
foreach ($partitions as $partition)
|
||
{
|
Také k dispozici: Unified diff
Opravy:
- closes #842: members_traffic_partitions_daily DROP selhani CRONu
- opravena copy past chyba u mazani/vytvareni mesicnych partitions pro traffic