ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
zoneinfo_generator.php
Go to the documentation of this file.
1 <?php
2  exit;
3 
4  define('ZONEINFO', '/usr/share/zoneinfo');
5  define('TZ_CONVERT', 'tz_convert');
6  define('READLINK', 'readlink');
7 
8  chdir('../../..');
9 
10  include_once('include/inc.header.php');
11  include_once('Services/Calendar/classes/class.ilCalendarUtil.php');
12 
13  foreach (ilCalendarUtil::_getShortTimeZoneList() as $tz_name => $tmp) {
14  $name_underscore = str_replace('/', '_', $tz_name);
15 
16  if (is_link(ZONEINFO . '/' . $tz_name)) {
17  $name = exec(READLINK . ' -f ' . ZONEINFO . '/' . $tz_name);
18  } else {
19  $name = ZONEINFO . '/' . $tz_name;
20  }
21 
22  exec(TZ_CONVERT . ' -o Services/Calendar/zoneinfo/' . $name_underscore . '.tmp' . ' ' . $name);
23 
24  $reader = fopen('Services/Calendar/zoneinfo/' . $name_underscore . '.tmp', 'r');
25  $writer = fopen('Services/Calendar/zoneinfo/' . $name_underscore . '.ics', 'w');
26 
27  $counter = 0;
28  while ($line = fgets($reader)) {
29  if (++$counter < 4) {
30  continue;
31  }
32  if ($counter == 5) {
33  fputs($writer, 'TZID:' . $tz_name . "\n");
34  } else {
35  if (substr($line, 0, 13) === 'END:VCALENDAR') {
36  break;
37  }
38  fputs($writer, $line);
39  }
40  }
41 
42  fclose($reader);
43  fclose($writer);
44  unlink('Services/Calendar/zoneinfo/' . $name_underscore . '.tmp');
45 
46  #echo $name_underscore.' <br />';
47  }
const ZONEINFO
static _getShortTimeZoneList()
get short timezone list
const READLINK
$counter
if($format !==null) $name
Definition: metadata.php:146
const TZ_CONVERT