Differential D16721 Diff 40272 src/applications/calendar/import/PhabricatorCalendarICSImportEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/calendar/import/PhabricatorCalendarICSImportEngine.php
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | if (!$file) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Unable to load file ("%s") for import.', | 'Unable to load file ("%s") for import.', | ||||
$file_phid)); | $file_phid)); | ||||
} | } | ||||
$data = $file->loadFileData(); | $data = $file->loadFileData(); | ||||
$parser = id(new PhutilICSParser()); | $parser = new PhutilICSParser(); | ||||
try { | |||||
$document = $parser->parseICSData($data); | $document = $parser->parseICSData($data); | ||||
} catch (PhutilICSParserException $ex) { | |||||
// TODO: In theory, it would be nice to store these in a fully abstract | |||||
// form so they can be translated at display time. As-is, we'll store the | |||||
// error messages in whatever language we were using when the parser | |||||
// failure occurred. | |||||
$import->newLogMessage( | |||||
PhabricatorCalendarImportICSLogType::LOGTYPE, | |||||
array( | |||||
'ics.code' => $ex->getParserFailureCode(), | |||||
'ics.message' => $ex->getMessage(), | |||||
)); | |||||
$document = null; | |||||
} | |||||
return $this->importEventDocument($viewer, $import, $document); | return $this->importEventDocument($viewer, $import, $document); | ||||
} | } | ||||
public function canDisable( | public function canDisable( | ||||
PhabricatorUser $viewer, | PhabricatorUser $viewer, | ||||
PhabricatorCalendarImport $import) { | PhabricatorCalendarImport $import) { | ||||
Show All 14 Lines |