setData($data); $blob->save(); return $blob->getID(); } /** * Load a stored blob from MySQL. * @task impl */ public function readFile($handle) { return $this->loadFromMySQLFileStorage($handle)->getData(); } /** * Delete a blob from MySQL. * @task impl */ public function deleteFile($handle) { $this->loadFromMySQLFileStorage($handle)->delete(); } /* -( Internals )---------------------------------------------------------- */ /** * Load the Lisk object that stores the file data for a handle. * * @param string File data handle. * @return PhabricatorFileStorageBlob Data DAO. * @task internal */ private function loadFromMySQLFileStorage($handle) { $blob = id(new PhabricatorFileStorageBlob())->load($handle); if (!$blob) { throw new Exception("Unable to load MySQL blob file '{$handle}'!"); } return $blob; } }