示例#1
0
 /**
  * @param $fid
  * @return InputFile
  */
 public function decrFileRefCountById($fid)
 {
     /** @var static $row */
     $row = $this->model->ofId($fid);
     $row->refCount--;
     $fileInfo = InputFile::initWithFileMeta($row);
     if ($row->refCount == 0) {
         $this->model->deleteById($row->id);
     } else {
         $this->model->updateOne($row->id, ['refCount' => $row->refCount]);
     }
     return $fileInfo;
 }
示例#2
0
 /**
  * Get chunk content
  * @param $chunkId string chunk Id
  * @return string|null
  */
 public function get($chunkId)
 {
     $row = $this->model->ofId($chunkId);
     return $row ? $row['content'] : null;
 }
示例#3
0
 /**
  * Get node meta
  * @param $nodeId int Node Id
  * @return mixed
  */
 public function get($nodeId)
 {
     return $this->model->ofId($nodeId);
 }