public function save()
 {
     $result = parent::save();
     if ($this->subprojectsNeedUpdate) {
         // If we've changed the project PHIDs for this task, update the link
         // table.
         PhabricatorProjectSubproject::updateProjectSubproject($this);
         $this->subprojectsNeedUpdate = false;
     }
     return $result;
 }
Esempio n. 2
0
 public function save()
 {
     if (!$this->getMailKey()) {
         $this->setMailKey(Filesystem::readRandomCharacters(20));
     }
     $this->openTransaction();
     $result = parent::save();
     $this->updateDatasourceTokens();
     $this->saveTransaction();
     return $result;
 }
 public function save()
 {
     if (!$this->getMailKey()) {
         $this->setMailKey(Filesystem::readRandomCharacters(20));
     }
     if (!strlen($this->getPHID())) {
         $this->setPHID($this->generatePHID());
     }
     if (!strlen($this->getProjectPathKey())) {
         $hash = PhabricatorHash::digestForIndex($this->getPHID());
         $hash = substr($hash, 0, 4);
         $this->setProjectPathKey($hash);
     }
     $path = array();
     $depth = 0;
     if ($this->parentProjectPHID) {
         $parent = $this->getParentProject();
         $path[] = $parent->getProjectPath();
         $depth = $parent->getProjectDepth() + 1;
     }
     $path[] = $this->getProjectPathKey();
     $path = implode('', $path);
     $limit = self::getProjectDepthLimit();
     if ($depth >= $limit) {
         throw new Exception(pht('Project depth is too great.'));
     }
     $this->setProjectPath($path);
     $this->setProjectDepth($depth);
     $this->openTransaction();
     $result = parent::save();
     $this->updateDatasourceTokens();
     $this->saveTransaction();
     return $result;
 }
Esempio n. 4
0
 public function save()
 {
     $this->openTransaction();
     $result = parent::save();
     $this->updateDatasourceTokens();
     $this->saveTransaction();
     return $result;
 }