Changeset View
Changeset View
Standalone View
Standalone View
scripts/util/add_macro.php
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
$existing = id(new PhabricatorFileImageMacro())->loadOneWhere( | $existing = id(new PhabricatorFileImageMacro())->loadOneWhere( | ||||
'name = %s', | 'name = %s', | ||||
$name); | $name); | ||||
if ($existing) { | if ($existing) { | ||||
throw new Exception(pht("A macro already exists with the name '%s'!", $name)); | throw new Exception(pht("A macro already exists with the name '%s'!", $name)); | ||||
} | } | ||||
// TODO | |||||
Lint: TODO Comment: This comment has a TODO. | |||||
$file = PhabricatorFile::newFromFileData( | $file = PhabricatorFile::newFromFileData( | ||||
$data, | $data, | ||||
array( | array( | ||||
'name' => basename($path), | 'name' => basename($path), | ||||
'canCDN' => true, | 'canCDN' => true, | ||||
)); | )); | ||||
$macro = id(new PhabricatorFileImageMacro()) | $macro = id(new PhabricatorFileImageMacro()) | ||||
->setFilePHID($file->getPHID()) | ->setFilePHID($file->getPHID()) | ||||
->setName($name) | ->setName($name) | ||||
->save(); | ->save(); | ||||
$id = $file->getID(); | $id = $file->getID(); | ||||
echo pht("Added macro '%s' (%s).", $name, "F{$id}")."\n"; | echo pht("Added macro '%s' (%s).", $name, "F{$id}")."\n"; |
This comment has a TODO.