Skip to content
Permalink
Browse files

add nuts codes for Bulgaria, Kroatia, Romania and Turkey, and

recalculate cache locations for Bulgaria, Kroatia, Romania and Turkey
  • Loading branch information...
following5 committed Sep 6, 2017
1 parent b43359f commit 03cdf53135474529f9a59fc7a8b0d1a39c6c929d
Showing with 309 additions and 0 deletions.
  1. +43 −0 bin/dbsv-update.php
  2. +243 −0 sql/static-data/nuts_codes.sql
  3. +8 −0 sql/stored-proc/maintain-161.inc.php
  4. +15 −0 sql/stored-proc/maintain-162.inc.php
@@ -1175,6 +1175,49 @@ function dbv_160()
);
}
function dbv_161()
{
global $opt;
// add nuts codes for Bulgaria, Kroatia, Romania and Turkey
system(
'cat ' . __DIR__. '/../sql/static-data/nuts_codes.sql |' .
' mysql -h' . $opt['db']['servername'] . ' -u' . $opt['db']['username'] .
' --password=' . $opt['db']['password'] . ' ' . $opt['db']['placeholder']['db']
);
// recalculate cache locations for these countries
// temporarily get rid of the update trigger so that we can change last_modified
update_triggers();
sql(
"UPDATE `cache_location`
SET `last_modified` = '2000-01-01 00:00:00'
WHERE `code1` IN ('BG', 'HR', 'RO', 'TR')"
);
// update the cache locations while trigger is disabled, so that the
// modification dates of caches will not be touched
function checkJob($cacheLocation) // called from cache_location.class.php
{
$cacheLocation->run();
}
include __DIR__ . '/../htdocs/util2/cron/modules/cache_location.class.php';
sql("UPDATE `cache_location` SET `last_modified`=NOW() WHERE `code1` IN ('BG', 'HR', 'RO', 'TR')");
}
function dbv_162()
{
// reinstall the cache locations update trigger
//
// (dbupdate.php will also do this, but we keep dbsv-update.php self-sustaining here
// so that it can be run independently; also the trigger may be needed in future
// DB mutations.)
update_triggers();
}
// When adding new mutations, take care that they behave well if run multiple
// times. This improves robustness of database versioning.
//
@@ -117,6 +117,45 @@ INSERT INTO `nuts_codes` (`code`, `name`) VALUES
('BEZZ', 'Extra-Regio'),
('BEZZZ', 'Extra-Regio'),
('BG', 'Bulgarien'),
('BG3','Северна и Югоизточна България'),
('BG4','Югозападна и Южна Централна България'),
('BGZ','Extra-Regio'),
('BG31','Северозападен'),
('BG32','Северен централен'),
('BG33','Североизточен'),
('BG34','Югоизточен'),
('BG41','Югозападен'),
('BG42','Южен централен'),
('BGZZ','Extra-Regio'),
('BG311','Видин'),
('BG312','Монтана'),
('BG313','Враца'),
('BG314','Плевен'),
('BG315','Ловеч'),
('BG321','Велико Търново'),
('BG322','Габрово'),
('BG323','Русе'),
('BG324','Разград'),
('BG325','Силистра'),
('BG331','Варна'),
('BG332','Добрич'),
('BG333','Шумен'),
('BG334','Търговище'),
('BG341','Бургас'),
('BG342','Сливен'),
('BG343','Ямбол'),
('BG344','Стара Загора'),
('BG411','София (столица)'),
('BG412','София'),
('BG413','Благоевград'),
('BG414','Перник'),
('BG415','Кюстендил'),
('BG421','Пловдив'),
('BG422','Хасково'),
('BG423','Пазарджик'),
('BG424','Смолян'),
('BG425','Кърджали'),
('BGZZZ','Extra-Regio'),
('CH', 'Schweiz'),
('CH01', 'Région lémanique'),
('CH011', 'Vaud'),
@@ -1063,6 +1102,33 @@ INSERT INTO `nuts_codes` (`code`, `name`) VALUES
('GRZZ', 'Extra-Regio'),
('GRZZZ', 'Extra-Regio'),
('HR', 'Kroatien'),
('HR0','Hrvatska'),
('HRZ','Extra-Regio'),
('HR03','Jadranska Hrvatska'),
('HR04','Kontinentalna Hrvatska'),
('HRZZ','Extra-Regio NUTS 2'),
('HR031','Primorsko-goranska županija'),
('HR032','Ličko-senjska županija'),
('HR033','Zadarska županija'),
('HR034','Šibensko-kninska županija'),
('HR035','Splitsko-dalmatinska županija'),
('HR036','Istarska županija'),
('HR037','Dubrovačko-neretvanska županija'),
('HR041','Grad Zagreb'),
('HR042','Zagrebačka županija'),
('HR043','Krapinsko-zagorska županija'),
('HR044','Varaždinska županija'),
('HR045','Koprivničko-križevačka županija'),
('HR046','Međimurska županija'),
('HR047','Bjelovarsko-bilogorska županija'),
('HR048','Virovitičko-podravska županija'),
('HR049','Požeško-slavonska županija'),
('HR04A','Brodsko-posavska županija'),
('HR04B','Osječko-baranjska županija'),
('HR04C','Vukovarsko-srijemska županija'),
('HR04D','Karlovačka županija'),
('HR04E','Sisačko-moslavačka županija'),
('HRZZZ','Extra-Regio'),
('HU', 'Ungarn'),
('HU1', 'közép-magyarország'),
('HU10', 'Közép-Magyarország'),
@@ -1499,6 +1565,63 @@ INSERT INTO `nuts_codes` (`code`, `name`) VALUES
('PTZZ', 'Extra-Regio'),
('PTZZZ', 'Extra-Regio'),
('RO', 'Rumänien'),
('RO1','Macroregiunea Unu'),
('RO2','Macroregiunea Doi'),
('RO3','Macroregiunea Trei'),
('RO4','Macroregiunea Patru'),
('ROZ','Extra-Regio'),
('RO11','Nord-Vest'),
('RO12','Centru'),
('RO21','Nord-Est'),
('RO22','Sud-Est'),
('RO31','Sud - Muntenia'),
('RO32','Bucureşti - Ilfov'),
('RO41','Sud-Vest Oltenia'),
('RO42','Vest'),
('ROZZ','Extra-Regio NUTS 2'),
('RO111','Bihor'),
('RO112','Bistriţa-Năsăud'),
('RO113','Cluj'),
('RO114','Maramureş'),
('RO115','Satu Mare'),
('RO116','Sălaj'),
('RO121','Alba'),
('RO122','Braşov'),
('RO123','Covasna'),
('RO124','Harghita'),
('RO125','Mureş'),
('RO126','Sibiu'),
('RO211','Bacău'),
('RO212','Botoşani'),
('RO213','Iaşi'),
('RO214','Neamţ'),
('RO215','Suceava'),
('RO216','Vaslui'),
('RO221','Brăila'),
('RO222','Buzău'),
('RO223','Constanţa'),
('RO224','Galaţi'),
('RO225','Tulcea'),
('RO226','Vrancea'),
('RO311','Argeş'),
('RO312','Călăraşi'),
('RO313','Dâmboviţa'),
('RO314','Giurgiu'),
('RO315','Ialomiţa'),
('RO316','Prahova'),
('RO317','Teleorman'),
('RO321','Bucureşti'),
('RO322','Ilfov'),
('RO411','Dolj'),
('RO412','Gorj'),
('RO413','Mehedinţi'),
('RO414','Olt'),
('RO415','Vâlcea'),
('RO421','Arad'),
('RO422','Caraş-Severin'),
('RO423','Hunedoara'),
('RO424','Timiş'),
('ROZZZ','Extra-Regio'),
('SE', 'Schweden'),
('SE1', 'östra sverige'),
('SE11', 'Stockholm'),
@@ -1572,6 +1695,126 @@ INSERT INTO `nuts_codes` (`code`, `name`) VALUES
('SKZZ', 'Extra-Regio'),
('SKZZZ', 'Extra-Regio'),
('TR', 'Türkei'),
('TR1', 'İstanbul'),
('TR2', 'Batı Marmara'),
('TE3', 'Ege'),
('TR4', 'Doğu Marmara'),
('TR5', 'Batı Anadolu'),
('TR6', 'Akdeniz'),
('TR7', 'Orta Anadolu'),
('TR8', 'Batı Karadeniz'),
('TR9', 'Doğu Karadeniz'),
('TRA', 'Kuzeydoğu Anadolu'),
('TRB', 'Ortadoğu Anadolu'),
('TRC', 'Güneydoğu Anadolu'),
('TRZ', 'Extra-Regio'),
('TR10', 'İstanbul'),
('TR21', 'Tekirdağ'),
('TR22', 'Balıkesir'),
('TR31', 'İzmir'),
('TR32', 'Aydın'),
('TR33', 'Manisa'),
('TR41', 'Bursa'),
('TR42', 'Kocaeli'),
('TR51', 'Ankara'),
('TR52', 'Konya'),
('TR61', 'Antalya'),
('TR62', 'Adana'),
('TR63', 'Hatay'),
('TR71', 'Kırıkkale'),
('TR72', 'Kayseri'),
('TR81', 'Zonguldak'),
('TR82', 'Kastamonu'),
('TR83', 'Samsun'),
('TR90', 'Trabzon'),
('TRA1', 'Erzurum'),
('TRA2', 'Ağrı'),
('TRB1', 'Malatya'),
('TRB2', 'Van'),
('TRC1', 'Gaziantep'),
('TRC2', 'Şanlıurfa'),
('TRC3', 'Mardin'),
('TR100', 'İstanbul'),
('TR211', 'Tekirdağ'),
('TR212', 'Edirne'),
('TR213', 'Kırklareli'),
('TR221', 'Balıkesir'),
('TR222', 'Canakkale'),
('TR310', 'İzmir'),
('TR321', 'Aydın'),
('TR322', 'Denizli'),
('TR323', 'Muğla'),
('TR331', 'Manisa'),
('TR332', 'Afyon '),
('TR333', 'Kütahya'),
('TR334', 'Uşak'),
('TR411', 'Bursa'),
('TR412', 'Eskişehir'),
('TR413', 'Bilecik'),
('TR421', 'Kocaeli'),
('TR422', 'Sakarya'),
('TR423', 'Düzce'),
('TR424', 'Bolu'),
('TR425', 'Yalova'),
('TR510', 'Ankara'),
('TR521', 'Konya'),
('TR522', 'Karaman'),
('TR611', 'Antalya'),
('TR612', 'Isparta'),
('TR613', 'Burdur'),
('TR621', 'Adana'),
('TR622', 'İcel'),
('TR631', 'Hatay'),
('TR632', 'Kahramanmaraş'),
('TR633', 'Osmaniye'),
('TR711', 'Kırıkkale'),
('TR712', 'Aksaray'),
('TR713', 'Niğde'),
('TR714', 'Nevşehir'),
('TR715', 'Kırşehir'),
('TR721', 'Kayseri'),
('TR722', 'Sivas'),
('TR723', 'Yozgat'),
('TR811', 'Zonguldak'),
('TR812', 'Karabük'),
('TR813', 'Bartın'),
('TR821', 'Kastamonu'),
('TR822', 'Çankırı'),
('TR823', 'Sinop'),
('TR831', 'Samsun'),
('TR832', 'Tokat'),
('TR833', 'Çorum'),
('TR834', 'Amasya'),
('TR901', 'Trabzon'),
('TR902', 'Ordu'),
('TR903', 'Giresun'),
('TR904', 'Rize'),
('TR905', 'Artvin'),
('TR906', 'Gümüşhane'),
('TRA11', 'Erzurum'),
('TRA12', 'Erzincan'),
('TRA13', 'Bayburt'),
('TRA21', 'Ağrı'),
('TRA22', 'Kars'),
('TRA23', 'Iğdır'),
('TRA24', 'Ardahan'),
('TRB11', 'Malatya'),
('TRB12', 'Elazığ'),
('TRB13', 'Bingöl'),
('TRB14', 'Tunceli'),
('TRB21', 'Van'),
('TRB22', 'Muş'),
('TRB23', 'Bitlis'),
('TRB24', 'Hakkari'),
('TRC11', 'Gaziantep'),
('TRC12', 'Adıyaman'),
('TRC13', 'Kilis'),
('TRC21', 'Şanlıurfa'),
('TRC22', 'Diyarbakır'),
('TRC31', 'Mardin'),
('TRC32', 'Batman'),
('TRC33', 'Şırnak'),
('TRC34', 'Siirt'),
('UK', 'Großbritannien'),
('UKC', 'north east (england)'),
('UKC1', 'Tees Valley and Durham'),
@@ -0,0 +1,8 @@
<?php
/***************************************************************************
* for license information see LICENSE.md
***************************************************************************/
// temporarily get rid of update trigger so that we can change last_modified
sql_dropTrigger('cacheLocationBeforeUpdate');
@@ -0,0 +1,15 @@
<?php
/***************************************************************************
* for license information see LICENSE.md
***************************************************************************/
// reinstall the cache location update trigger
sql_dropTrigger('cacheLocationBeforeUpdate');
sql(
'CREATE TRIGGER `cacheLocationBeforeUpdate` BEFORE UPDATE ON `cache_location`
FOR EACH ROW BEGIN
SET NEW.`last_modified`=NOW();
UPDATE `caches` SET `meta_last_modified`=NOW() WHERE `caches`.`cache_id`=NEW.`cache_id`;
END;'
);

0 comments on commit 03cdf53

Please sign in to comment.
You can’t perform that action at this time.