ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
class.ilAssQuestionProcessLockFileStorage.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/FileSystem/classes/class.ilFileSystemStorage.php';
5 
13 {
14  private $subPath;
15 
16  public function __construct($questionId, $userId)
17  {
18  parent::__construct(ilFileSystemStorage::STORAGE_DATA, true, $questionId);
19 
20  $this->initSubPath($userId);
21  }
22 
31  protected function getPathPrefix()
32  {
33  return 'ilAssQuestionProcessLocks';
34  }
35 
45  protected function getPathPostfix()
46  {
47  return 'question';
48  }
49 
50  public function getPath()
51  {
52  return parent::getPath() . '/' . $this->subPath;
53  }
54 
55  public function create()
56  {
57  if(!file_exists($this->getPath()))
58  {
60  }
61  return true;
62  }
63 
64  private function initSubPath($userId)
65  {
66  $userId = (string)$userId;
67 
68  $path = array();
69 
70  for($i = 0, $max = strlen($userId); $i < $max; $i++)
71  {
72  $path[] = substr($userId, $i, 1);
73  }
74 
75  $this->subPath = implode('/', $path);
76 
77  }
78 }
static makeDirParents($a_dir)
Create a new directory and all parent directories.