Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/calendar/import/PhabricatorCalendarICSImportEngine.php
12256 views
1
<?php
2
3
abstract class PhabricatorCalendarICSImportEngine
4
extends PhabricatorCalendarImportEngine {
5
6
final protected function importICSData(
7
PhabricatorUser $viewer,
8
PhabricatorCalendarImport $import,
9
$data) {
10
11
$parser = new PhutilICSParser();
12
13
try {
14
$document = $parser->parseICSData($data);
15
} catch (PhutilICSParserException $ex) {
16
// TODO: In theory, it would be nice to store these in a fully abstract
17
// form so they can be translated at display time. As-is, we'll store the
18
// error messages in whatever language we were using when the parser
19
// failure occurred.
20
21
$import->newLogMessage(
22
PhabricatorCalendarImportICSLogType::LOGTYPE,
23
array(
24
'ics.code' => $ex->getParserFailureCode(),
25
'ics.message' => $ex->getMessage(),
26
));
27
28
$document = null;
29
}
30
31
foreach ($parser->getWarnings() as $warning) {
32
$import->newLogMessage(
33
PhabricatorCalendarImportICSWarningLogType::LOGTYPE,
34
array(
35
'ics.warning.code' => $warning['code'],
36
'ics.warning.line' => $warning['line'],
37
'ics.warning.text' => $warning['text'],
38
'ics.warning.message' => $warning['message'],
39
));
40
}
41
42
return $this->importEventDocument($viewer, $import, $document);
43
}
44
45
}
46
47