/**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     parent::update();
     if (count($this->objects) == 1 && isset($this->parameters['data']['showOrder']) && $this->parameters['data']['showOrder'] != reset($this->objects)->showOrder) {
         reset($this->objects)->setShowOrder($this->parameters['data']['showOrder']);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function update()
 {
     //get classes
     $baseClass = $this->className;
     $articleClass = $baseClass::getBaseClass();
     //count attachments
     if (isset($this->parameters['attachmentHandler']) && $this->parameters['attachementHandler'] !== null) {
         $data['attachments'] = count($this->parameters['attachmentHandler']);
     }
     parent::update();
     foreach ($this->objects as $article) {
         $this->objectIDs[] = $article->{$baseClass::getDatabaseTableIndexName()};
     }
     foreach ($this->objects as $news) {
         if (isset($this->parameters['categoryIDs'])) {
             $news->updateCategoryIDs($this->parameters['categoryIDs']);
         }
         // update tags
         $tags = array();
         if (isset($this->parameters['tags'])) {
             $tags = $this->parameters['tags'];
             unset($this->parameters['tags']);
         }
         if (!empty($tags)) {
             $languageID = !isset($this->parameters['data']['languageID']) || $this->parameters['data']['languageID'] === null ? LanguageFactory::getInstance()->getDefaultLanguageID() : $this->parameters['data']['languageID'];
             TagEngine::getInstance()->addObjectTags($articleClass::$objectType, $article->{$baseClass::getDatabaseTableIndexName()}, $tags, $languageID);
         }
     }
 }
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     if (!isset($this->parameters['data']['lastChangeTime'])) {
         $this->parameters['data']['lastChangeTime'] = TIME_NOW;
     }
     parent::update();
 }
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     // check if showOrder needs to be recalculated
     if (count($this->objects) == 1 && isset($this->parameters['data']['parentCategoryID']) && isset($this->parameters['data']['showOrder'])) {
         if ($this->objects[0]->parentCategoryID != $this->parameters['data']['parentCategoryID'] || $this->objects[0]->showOrder != $this->parameters['data']['showOrder']) {
             $this->parameters['data']['showOrder'] = $this->objects[0]->updateShowOrder($this->parameters['data']['parentCategoryID'], $this->parameters['data']['showOrder']);
         }
     }
     parent::update();
     if (isset($this->parameters['data']['parentCategoryID'])) {
         $objectType = null;
         $parentUpdates = array();
         foreach ($this->objects as $category) {
             if ($objectType === null) {
                 $objectType = $category->getObjectType();
             }
             if ($category->parentCategoryID != $this->parameters['data']['parentCategoryID']) {
                 $parentUpdates[$category->categoryID] = array('oldParentCategoryID' => $category->parentCategoryID, 'newParentCategoryID' => $this->parameters['data']['parentCategoryID']);
             }
         }
         if (!empty($parentUpdates)) {
             $objectType->getProcessor()->changedParentCategories($parentUpdates);
         }
     }
 }
Beispiel #5
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     parent::update();
     // read current poll
     $pollEditor = reset($this->objects);
     // get current options
     $optionList = new PollOptionList();
     $optionList->getConditionBuilder()->add("poll_option.pollID = ?", array($pollEditor->pollID));
     $optionList->sqlOrderBy = "poll_option.showOrder ASC";
     $optionList->readObjects();
     $options = $optionList->getObjects();
     $newOptions = $updateOptions = array();
     foreach ($this->parameters['options'] as $showOrder => $option) {
         // check if editing an existing option
         if ($option['optionID']) {
             // check if an update is required
             if ($options[$option['optionID']]->showOrder != $showOrder || $options[$option['optionID']]->optionValue != $option['optionValue']) {
                 $updateOptions[$option['optionID']] = array('optionValue' => $option['optionValue'], 'showOrder' => $showOrder);
             }
             // remove option
             unset($options[$option['optionID']]);
         } else {
             $newOptions[] = array('optionValue' => $option['optionValue'], 'showOrder' => $showOrder);
         }
     }
     if (!empty($newOptions) || !empty($updateOptions) || !empty($options)) {
         WCF::getDB()->beginTransaction();
         // check if new options should be created
         if (!empty($newOptions)) {
             $sql = "INSERT INTO\twcf" . WCF_N . "_poll_option\n\t\t\t\t\t\t\t(pollID, optionValue, showOrder)\n\t\t\t\t\tVALUES\t\t(?, ?, ?)";
             $statement = WCF::getDB()->prepareStatement($sql);
             foreach ($newOptions as $option) {
                 $statement->execute(array($pollEditor->pollID, $option['optionValue'], $option['showOrder']));
             }
         }
         // check if existing options should be updated
         if (!empty($updateOptions)) {
             $sql = "UPDATE\twcf" . WCF_N . "_poll_option\n\t\t\t\t\tSET\toptionValue = ?,\n\t\t\t\t\t\tshowOrder = ?\n\t\t\t\t\tWHERE\toptionID = ?";
             $statement = WCF::getDB()->prepareStatement($sql);
             foreach ($updateOptions as $optionID => $option) {
                 $statement->execute(array($option['optionValue'], $option['showOrder'], $optionID));
             }
         }
         // check if options should be removed
         if (!empty($options)) {
             $sql = "DELETE FROM\twcf" . WCF_N . "_poll_option\n\t\t\t\t\tWHERE\t\toptionID = ?";
             $statement = WCF::getDB()->prepareStatement($sql);
             foreach ($options as $option) {
                 $statement->execute(array($option->optionID));
             }
         }
         // force recalculation of poll stats
         $pollEditor->calculateVotes();
         WCF::getDB()->commitTransaction();
     }
 }
Beispiel #6
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     parent::update();
     foreach ($this->objects as $style) {
         // update variables
         $this->updateVariables($style->getDecoratedObject(), true);
         // handle style preview image
         $this->updateStylePreviewImage($style->getDecoratedObject());
         // reset stylesheet
         StyleHandler::getInstance()->resetStylesheet($style->getDecoratedObject());
     }
 }
Beispiel #7
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     if (empty($this->objects)) {
         $this->readObjects();
     }
     if (count($this->objects) == 1 && !empty($this->parameters['fileLocation'])) {
         $smiley = reset($this->objects);
         $smileyFilename = 'smiley' . $smiley->smileyID . '.' . mb_strtolower(mb_substr($this->parameters['fileLocation'], mb_strrpos($this->parameters['fileLocation'], '.') + 1));
         @rename($this->parameters['fileLocation'], WCF_DIR . 'images/smilies/' . $smileyFilename);
         $this->parameters['data']['smileyPath'] = 'images/smilies/' . $smileyFilename;
     }
     parent::update();
 }
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     parent::update();
     foreach ($this->objects as $template) {
         // rename file
         $templateName = isset($this->parameters['data']['templateName']) ? $this->parameters['data']['templateName'] : $template->templateName;
         $templateGroupID = isset($this->parameters['data']['templateGroupID']) ? $this->parameters['data']['templateGroupID'] : $template->templateGroupID;
         if ($templateName != $template->templateName || $templateGroupID != $template->templateGroupID) {
             $template->rename($templateName, $templateGroupID);
         }
         // update source
         if (isset($this->parameters['source'])) {
             $template->setSource($this->parameters['source']);
         }
     }
 }
Beispiel #9
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     // set default values for last editor
     if (!isset($this->parameters['data']['lastEditorID'])) {
         $this->parameters['data']['lastEditorID'] = WCF::getUser()->userID;
         $this->parameters['data']['lastEditorName'] = WCF::getUser()->username;
     }
     // set default value for last edit time
     if (!isset($this->parameters['data']['lastEditTime'])) {
         $this->parameters['data']['lastEditTime'] = TIME_NOW;
     }
     // perform update
     parent::update();
     $pageIDs = $publishedPageIDs = array();
     foreach ($this->objects as $pageEditor) {
         $pageIDs[] = $pageEditor->pageID;
         // update stylesheets
         if (isset($this->parameters['stylesheetIDs'])) {
             $pageEditor->updateStylesheetIDs($this->parameters['stylesheetIDs']);
         }
         if (!$pageEditor->isPublished) {
             $publishedPageIDs[] = $pageEditor->pageID;
         }
     }
     // delete subscriptions if subscribing isn't allowed anymore
     if (isset($this->parameters['data']['allowSubscribing']) && !$this->parameters['data']['allowSubscribing']) {
         UserObjectWatchHandler::getInstance()->deleteObjects('de.codequake.cms.page', $pageIDs);
     }
     // trigger new publications
     if (isset($this->parameters['data']['isPublished']) && $this->parameters['data']['isPublished'] == 1 && !empty($publishedPageIDs)) {
         $action = new PageAction($publishedPageIDs, 'triggerPublication');
         $action->executeAction();
     }
 }
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     parent::update();
     // set new position if needed
     if (count($this->objects) == 1 && isset($this->parameters['data']['position'])) {
         if ($this->objects[0]->position != $this->parameters['data']['position']) {
             $this->objects[0]->setPosition($this->parameters['data']['position']);
         }
     }
 }
Beispiel #11
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     // serialize content data
     if (isset($this->parameters['data']['contentData']) && is_array($this->parameters['data']['contentData'])) {
         $this->parameters['data']['contentData'] = serialize($this->parameters['data']['contentData']);
     }
     parent::update();
 }
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     if (!isset($this->parameters['participants'])) {
         $this->parameters['participants'] = array();
     }
     if (!isset($this->parameters['invisibleParticipants'])) {
         $this->parameters['invisibleParticipants'] = array();
     }
     // count participants
     if (!empty($this->parameters['participants'])) {
         $this->parameters['data']['participants'] = count($this->parameters['participants']);
     }
     parent::update();
     foreach ($this->objects as $conversation) {
         // partipants
         if (!empty($this->parameters['participants']) || !empty($this->parameters['invisibleParticipants'])) {
             // get current participants
             $participantIDs = $conversation->getParticipantIDs();
             $conversation->updateParticipants(!empty($this->parameters['participants']) ? $this->parameters['participants'] : array(), !empty($this->parameters['invisibleParticipants']) ? $this->parameters['invisibleParticipants'] : array());
             $conversation->updateParticipantSummary();
             // check if new participants have been added
             $newParticipantIDs = array_diff(array_merge($this->parameters['participants'], $this->parameters['invisibleParticipants']), $participantIDs);
             if (!empty($newParticipantIDs)) {
                 // update conversation count
                 UserStorageHandler::getInstance()->reset($newParticipantIDs, 'unreadConversationCount');
                 UserStorageHandler::getInstance()->reset($newParticipantIDs, 'conversationCount');
                 // fire notification event
                 UserNotificationHandler::getInstance()->fireEvent('conversation', 'com.woltlab.wcf.conversation.notification', new ConversationUserNotificationObject($conversation->getDecoratedObject()), $newParticipantIDs);
             }
         }
         // draft status
         if (isset($this->parameters['data']['isDraft'])) {
             if ($conversation->isDraft && !$this->parameters['data']['isDraft']) {
                 // add author
                 $conversation->updateParticipants(array($conversation->userID));
                 // update conversation count
                 UserStorageHandler::getInstance()->reset($conversation->getParticipantIDs(), 'unreadConversationCount');
                 UserStorageHandler::getInstance()->reset($conversation->getParticipantIDs(), 'conversationCount');
             }
         }
     }
 }
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     $showOrder = 0;
     if (isset($this->parameters['data']['showOrder'])) {
         $showOrder = $this->parameters['data']['showOrder'];
         unset($this->parameters['data']['showOrder']);
     }
     parent::update();
     foreach ($this->getObjects() as $object) {
         $object->setShowOrder($showOrder);
         $type = $object->getType();
         $sql = "UPDATE wcf" . WCF_N . "_jcoins_shop_item_parameter SET value = ? WHERE itemID = ? AND parameterID = ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         foreach ($type->getParameters() as $parameter) {
             if (isset($this->parameters['parameters'][$parameter['parameterID']])) {
                 $statement->execute(array($this->parameters['parameters'][$parameter['parameterID']], $object->getObjectID(), $parameter['parameterID']));
             }
         }
     }
 }
 public function update()
 {
     // count attachments
     if (isset($this->parameters['attachmentHandler']) && $this->parameters['attachmentHandler'] !== null) {
         $this->parameters['data']['attachments'] = count($this->parameters['attachmentHandler']);
     }
     parent::update();
     $objectIDs = array();
     foreach ($this->objects as $news) {
         $objectIDs[] = $news->newsID;
     }
     if (!empty($objectIDs)) {
         SearchIndexManager::getInstance()->delete('de.codequake.cms.news', $objectIDs);
     }
     foreach ($this->objects as $news) {
         if (isset($this->parameters['categoryIDs'])) {
             $news->updateCategoryIDs($this->parameters['categoryIDs']);
         }
         // update tags
         $tags = array();
         if (isset($this->parameters['tags'])) {
             $tags = $this->parameters['tags'];
             unset($this->parameters['tags']);
         }
         if (!empty($tags)) {
             $languageID = !isset($this->parameters['data']['languageID']) || $this->parameters['data']['languageID'] === null ? LanguageFactory::getInstance()->getDefaultLanguageID() : $this->parameters['data']['languageID'];
             TagEngine::getInstance()->addObjectTags('de.codequake.cms.news', $news->newsID, $tags, $languageID);
         }
         // update search index
         SearchIndexManager::getInstance()->add('de.codequake.cms.news', $news->newsID, $news->message, $news->subject, $news->time, $news->userID, $news->username, $news->languageID);
     }
 }
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     // count attachments
     if (isset($this->parameters['attachmentHandler']) && $this->parameters['attachmentHandler'] !== null) {
         $this->parameters['data']['attachments'] = count($this->parameters['attachmentHandler']);
         if ($this->parameters['data']['attachments']) {
             $attachments = $this->parameters['attachmentHandler']->getAttachmentList()->getObjects();
             $attachment = reset($attachments);
             $this->parameters['data']['coverID'] = $attachment->attachmentID;
         }
     }
     parent::update();
     // get ids
     $objectIDs = array();
     foreach ($this->objects as $entry) {
         $objectIDs[] = $entry->entryID;
     }
     // delete old search index entries
     if (!empty($objectIDs)) {
         SearchIndexManager::getInstance()->delete('de.incendium.filebase.entry', $objectIDs);
     }
     foreach ($this->objects as $entry) {
         // handle categories
         if (isset($this->parameters['categoryIDs'])) {
             $entry->updateCategoryIDs($this->parameters['categoryIDs']);
         }
         // update tags
         if (!empty($this->parameters['tags'])) {
             // set language id (cannot be zero)
             $languageID = !isset($this->parameters['data']['languageID']) || $this->parameters['data']['languageID'] === null ? LanguageFactory::getInstance()->getDefaultLanguageID() : $this->parameters['data']['languageID'];
             TagEngine::getInstance()->addObjectTags('de.incendium.filebase.entry', $entry->entryID, $this->parameters['tags'], $languageID);
         }
         // create new search index entry
         SearchIndexManager::getInstance()->add('de.incendium.filebase.entry', $entry->entryID, isset($this->parameters['data']['message']) ? $this->parameters['data']['message'] : $entry->message, isset($this->parameters['data']['subject']) ? $this->parameters['data']['subject'] : $entry->subject, $entry->time, $entry->userID, $entry->username, $entry->languageID);
     }
 }
Beispiel #16
0
 /**
  * @see	wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     if (isset($this->parameters['data'])) {
         parent::update();
         if (isset($this->parameters['data']['languageID'])) {
             foreach ($this->objects as $object) {
                 if ($object->userID == WCF::getUser()->userID) {
                     if ($this->parameters['data']['languageID'] != WCF::getUser()->languageID) {
                         WCF::setLanguage($this->parameters['data']['languageID']);
                     }
                     break;
                 }
             }
         }
     } else {
         if (!count($this->objects)) {
             $this->readObjects();
         }
     }
     $groupIDs = isset($this->parameters['groups']) ? $this->parameters['groups'] : array();
     $languageIDs = isset($this->parameters['languageIDs']) ? $this->parameters['languageIDs'] : array();
     $removeGroups = isset($this->parameters['removeGroups']) ? $this->parameters['removeGroups'] : array();
     $userOptions = isset($this->parameters['options']) ? $this->parameters['options'] : array();
     foreach ($this->objects as $userEditor) {
         if (!empty($groupIDs)) {
             $userEditor->addToGroups($groupIDs);
         }
         if (!empty($removeGroups)) {
             $userEditor->removeFromGroups($removeGroups);
         }
         if (!empty($userOptions)) {
             $userEditor->updateUserOptions($userOptions);
         }
         if (!empty($languageIDs)) {
             $userEditor->addToLanguages($languageIDs);
         }
     }
 }
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     // count attachments
     if (isset($this->parameters['attachmentHandler']) && $this->parameters['attachmentHandler'] !== null) {
         $this->parameters['data']['attachments'] = count($this->parameters['attachmentHandler']);
     }
     // update lastVersionTime for edit history
     if (MODULE_EDIT_HISTORY && isset($this->parameters['isEdit']) && isset($this->parameters['data']['text'])) {
         $this->parameters['data']['lastVersionTime'] = TIME_NOW;
     }
     parent::update();
     // get ids
     $objectIDs = array();
     foreach ($this->objects as $entry) {
         $objectIDs[] = $entry->entryID;
     }
     if (!empty($objectIDs)) {
         // delete old search index entries
         SearchIndexManager::getInstance()->delete('de.incendium.cms.news.entry', $objectIDs);
     }
     $publicationEntryIDs = array();
     foreach ($this->objects as $entry) {
         // handle the news categories
         if (isset($this->parameters['categoryIDs'])) {
             $entry->updateCategoryIDs($this->parameters['categoryIDs']);
         }
         // update tags
         if (!empty($this->parameters['tags'])) {
             // set language id (cannot be zero)
             $languageID = !isset($this->parameters['data']['languageID']) || $this->parameters['data']['languageID'] === null ? LanguageFactory::getInstance()->getDefaultLanguageID() : $this->parameters['data']['languageID'];
             TagEngine::getInstance()->addObjectTags('de.incendium.cms.news.entry', $entry->entryID, $this->parameters['tags'], $languageID);
         }
         // create new search index entry
         SearchIndexManager::getInstance()->add('de.incendium.cms.news.entry', $entry->entryID, isset($this->parameters['data']['message']) ? $this->parameters['data']['message'] : $entry->message, isset($this->parameters['data']['subject']) ? $this->parameters['data']['subject'] : $entry->subject, $entry->time, $entry->userID, $entry->username, $entry->languageID);
         // handle publication
         if (!$entry->isPublished && !empty($this->parameters['data']['isPublished'])) {
             $publicationEntryIDs[] = $entry->entryID;
         }
         // edit
         if (isset($this->parameters['isEdit']) && isset($this->parameters['data']['message'])) {
             $historySavingEntry = new HistorySavingEntry($entry->getDecoratedObject());
             EditHistoryManager::getInstance()->add('de.incendium.cms.news.entry', $entry->entryID, $entry->message, $historySavingEntry->getTime(), $historySavingEntry->getUserID(), $historySavingEntry->getUsername(), isset($this->parameters['editReason']) ? $this->parameters['editReason'] : '', WCF::getUser()->userID);
         }
         NewsEntryModificationLogHandler::getInstance()->edit($entry->getDecoratedObject(), isset($this->parameters['reason']) ? $this->parameters['reason'] : '');
         // update embedded objects
         if (isset($this->parameters['data']['message'])) {
             if ($entry->hasEmbeddedObjects != MessageEmbeddedObjectManager::getInstance()->registerObjects('de.incendium.cms.news.entry', $entry->entryID, $this->parameters['data']['message'])) {
                 $entry->update(array('hasEmbeddedObjects' => $entry->hasEmbeddedObjects ? 0 : 1));
             }
         }
         // trigger publication
         if (!empty($publicationEntryIDs)) {
             $action = new EntryAction($publicationEntryIDs, 'triggerPublication');
             $action->executeAction();
         }
     }
 }
 /**
  * Marks the given statements as trashed.
  */
 public function trashAll()
 {
     $this->parameters['data']['isTrashed'] = 1;
     parent::update();
 }
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     parent::update();
     PageMenuItemEditor::updateLandingPage();
 }
Beispiel #20
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     if (isset($this->parameters['data'])) {
         parent::update();
         if (isset($this->parameters['data']['languageID'])) {
             foreach ($this->objects as $object) {
                 if ($object->userID == WCF::getUser()->userID) {
                     if ($this->parameters['data']['languageID'] != WCF::getUser()->languageID) {
                         WCF::setLanguage($this->parameters['data']['languageID']);
                     }
                     break;
                 }
             }
         }
     } else {
         if (empty($this->objects)) {
             $this->readObjects();
         }
     }
     $groupIDs = isset($this->parameters['groups']) ? $this->parameters['groups'] : array();
     $languageIDs = isset($this->parameters['languageIDs']) ? $this->parameters['languageIDs'] : array();
     $removeGroups = isset($this->parameters['removeGroups']) ? $this->parameters['removeGroups'] : array();
     $userOptions = isset($this->parameters['options']) ? $this->parameters['options'] : array();
     if (!empty($groupIDs)) {
         $action = new UserAction($this->objects, 'addToGroups', array('groups' => $groupIDs, 'addDefaultGroups' => false));
         $action->executeAction();
     }
     if (!empty($removeGroups)) {
         $action = new UserAction($this->objects, 'removeFromGroups', array('groups' => $removeGroups));
         $action->executeAction();
     }
     foreach ($this->objects as $userEditor) {
         if (!empty($userOptions)) {
             $userEditor->updateUserOptions($userOptions);
         }
         if (!empty($languageIDs)) {
             $userEditor->addToLanguages($languageIDs);
         }
     }
     // handle user rename
     if (count($this->objects) == 1 && !empty($this->parameters['data']['username'])) {
         if ($this->objects[0]->username != $this->parameters['data']['username']) {
             $userID = $this->objects[0]->userID;
             $username = $this->parameters['data']['username'];
             WCF::getDB()->beginTransaction();
             // update comments
             $sql = "UPDATE\twcf" . WCF_N . "_comment\n\t\t\t\t\tSET\tusername = ?\n\t\t\t\t\tWHERE\tuserID = ?";
             $statement = WCF::getDB()->prepareStatement($sql);
             $statement->execute(array($username, $userID));
             $sql = "UPDATE\twcf" . WCF_N . "_comment_response\n\t\t\t\t\tSET\tusername = ?\n\t\t\t\t\tWHERE\tuserID = ?";
             $statement = WCF::getDB()->prepareStatement($sql);
             $statement->execute(array($username, $userID));
             // modification log
             $sql = "UPDATE\twcf" . WCF_N . "_modification_log\n\t\t\t\t\tSET\tusername = ?\n\t\t\t\t\tWHERE\tuserID = ?";
             $statement = WCF::getDB()->prepareStatement($sql);
             $statement->execute(array($username, $userID));
             WCF::getDB()->commitTransaction();
             // fire event to handle other database tables
             EventHandler::getInstance()->fireAction($this, 'rename');
         }
     }
 }
Beispiel #21
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     parent::update();
     foreach ($this->objects as $fileEditor) {
         // update categories
         if (isset($this->parameters['categoryIDs'])) {
             $fileEditor->updateCategoryIDs($this->parameters['categoryIDs']);
         }
     }
 }
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::update()
  */
 public function update()
 {
     // count attachments
     if (isset($this->parameters['attachmentHandler']) && $this->parameters['attachmentHandler'] !== null) {
         $this->parameters['data']['attachments'] = count($this->parameters['attachmentHandler']);
     }
     parent::update();
     // update search index / embedded objects
     if (isset($this->parameters['data']) && isset($this->parameters['data']['message'])) {
         foreach ($this->objects as $message) {
             $conversation = $message->getConversation();
             SearchIndexManager::getInstance()->update('com.woltlab.wcf.conversation.message', $message->messageID, $this->parameters['data']['message'], $conversation->firstMessageID == $message->messageID ? $conversation->subject : '', $message->time, $message->userID, $message->username);
             if ($message->hasEmbeddedObjects != MessageEmbeddedObjectManager::getInstance()->registerObjects('com.woltlab.wcf.conversation.message', $message->messageID, $this->parameters['data']['message'])) {
                 $message->update(array('hasEmbeddedObjects' => $message->hasEmbeddedObjects ? 0 : 1));
             }
         }
     }
 }
    /**
     * @see	\wcf\data\AbstractDatabaseObjectAction::update()
     */
    public function update()
    {
        // count attachments
        if (isset($this->parameters['attachmentHandler']) && $this->parameters['attachmentHandler'] !== null) {
            $this->parameters['data']['attachments'] = count($this->parameters['attachmentHandler']);
        }
        parent::update();
        // get ids
        $objectIDs = array();
        foreach ($this->objects as $news) {
            $objectIDs[] = $news->newsID;
        }
        if (!empty($objectIDs)) {
            // delete old search index entries
            SearchIndexManager::getInstance()->delete('de.voolia.news.entry', $objectIDs);
            // delete old sources if needed
            if (isset($this->parameters['sources'])) {
                $conditions = new PreparedStatementConditionBuilder();
                $conditions->add('newsID IN (?)', array($objectIDs));
                $sql = 'DELETE FROM	news' . WCF_N . '_news_source
					' . $conditions;
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute($conditions->getParameters());
            }
        }
        foreach ($this->objects as $news) {
            // handle the news categories
            if (isset($this->parameters['categoryIDs'])) {
                $news->updateCategoryIDs($this->parameters['categoryIDs']);
            }
            // update the news tags
            if (isset($this->parameters['tags']) && !empty($this->parameters['tags'])) {
                // set language id (cannot be zero)
                $languageID = !isset($this->parameters['data']['languageID']) || $this->parameters['data']['languageID'] === null ? LanguageFactory::getInstance()->getDefaultLanguageID() : $this->parameters['data']['languageID'];
                TagEngine::getInstance()->addObjectTags('de.voolia.news.entry', $news->newsID, $this->parameters['tags'], $languageID);
            }
            // update the news sources
            if (isset($this->parameters['sources'])) {
                $this->addSources($news->newsID, $this->parameters['sources']);
            }
            // create new search index entry
            SearchIndexManager::getInstance()->add('de.voolia.news.entry', $news->newsID, isset($this->parameters['data']['text']) ? $this->parameters['data']['text'] : $news->text, isset($this->parameters['data']['subject']) ? $this->parameters['data']['subject'] : $news->subject, $news->time, $news->userID, $news->username, $news->languageID);
        }
        // reset the user storage data
        UserStorageHandler::getInstance()->resetAll('newsUnreadEntries');
        // reset the news cache
        NewsEditor::resetNewsStatsCache();
    }