Changeset View
Changeset View
Standalone View
Standalone View
scripts/symbols/import_repository_symbols.php
Context not available. | |||||
$input = file_get_contents('php://stdin'); | $input = file_get_contents('php://stdin'); | ||||
$input = trim($input); | $input = trim($input); | ||||
$input = explode("\n", $input); | $input = @explode("\n", $input); | ||||
function commit_symbols( | function commit_symbols( | ||||
Context not available. | |||||
} | } | ||||
function check_string_value($value, $field_name, $line_no, $max_length) { | function check_string_value($value, $field_name, $line_no, $max_length) { | ||||
if (strlen($value) > $max_length) { | if (@strlen($value) > $max_length) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
"%s '%s' defined on line #%d is too long, ". | "%s '%s' defined on line #%d is too long, ". | ||||
Context not available. | |||||
try { | try { | ||||
$line_no = $key + 1; | $line_no = $key + 1; | ||||
$matches = null; | $matches = null; | ||||
$ok = preg_match( | $ok = @preg_match( | ||||
'/^((?P<context>[^ ]+)? )?(?P<name>[^ ]+) (?P<type>[^ ]+) '. | '/^((?P<context>[^ ]+)? )?(?P<name>[^ ]+) (?P<type>[^ ]+) '. | ||||
'(?P<lang>[^ ]+) (?P<line>\d+) (?P<path>.*)$/', | '(?P<lang>[^ ]+) (?P<line>\d+) (?P<path>.*)$/', | ||||
$line, | $line, | ||||
Context not available. | |||||
check_string_value($lang, pht('Symbol language'), $line_no, 32); | check_string_value($lang, pht('Symbol language'), $line_no, 32); | ||||
check_string_value($path, pht('Path'), $line_no, 512); | check_string_value($path, pht('Path'), $line_no, 512); | ||||
if (!strlen($path) || $path[0] != '/') { | if (!@strlen($path) || $path[0] != '/') { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
"Path '%s' defined on line #%d is invalid. Paths should begin with ". | "Path '%s' defined on line #%d is invalid. Paths should begin with ". | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0