コード例 #1
0
ファイル: EditEntity.php プロジェクト: TU-Berlin/WikidataMath
 /**
  * Returns whether the present edit would, per default,
  * lead to the user watching the page.
  *
  * This uses the user's watchdefault and watchcreations settings
  * and considers whether the entity is already watched by the user.
  *
  * @note Keep in sync with logic in EditPage!
  *
  * @return bool
  */
 private function getWatchDefault()
 {
     // User wants to watch all edits or all creations.
     if ($this->user->getOption('watchdefault') || $this->user->getOption('watchcreations') && $this->isNew()) {
         return true;
     }
     // keep current state
     return !$this->isNew() && $this->entityStore->isWatching($this->user, $this->newEntity->getId());
 }
コード例 #2
0
 /**
  * Save the new version of the given item.
  *
  * @param Item $item
  * @param User $user
  *
  * @return bool
  */
 private function saveChanges(Item $item, User $user)
 {
     $summary = $this->getSummary();
     $itemId = $item->getId();
     $summaryString = $this->summaryFormatter->formatSummary($summary);
     $editEntity = $this->editEntityFactory->newEditEntity($user, $item, true);
     $status = $editEntity->attemptSave($summaryString, EDIT_UPDATE, false, $this->entityStore->isWatching($user, $itemId));
     if (!$status->isOK()) {
         wfDebugLog('UpdateRepo', __FUNCTION__ . ': attemptSave for ' . $itemId->getSerialization() . ' failed: ' . $status->getMessage()->text());
     }
     return $status->isOK();
 }