function wikiPageUpdated() { $event_manager =& $this->_getEventManager(); $item_factory =& $this->_getItemFactory(); $wiki_page_name = $this->request->get('wiki_page'); $group_id = $this->request->get('group_id'); $documents = $item_factory->getWikiPageReferencers($wiki_page_name, $group_id); $item_dao =& new Docman_ItemDao(CodendiDataAccess::instance()); $user = $this->request->get('user'); $diff_link = $this->request->get('diff_link'); $version = $this->request->get('version'); foreach ($documents as $document) { $wiki_page = new WikiPage($group_id, $wiki_page_name); $wiki_metadata = $wiki_page->getMetadata(); // Update the item's update date attribute. $item_dao->updateById($document->getId(), null, null, null, null, null, $update_date = time(), null, null, null, null, null, null); $event_manager->processEvent('plugin_docman_event_wikipage_update', array('group_id' => $group_id, 'item' => $document, 'user' => $user, 'url' => $diff_link, 'wiki_page' => $wiki_page_name, 'old_value' => $version, 'new_value' => $version + 1)); } $event_manager->processEvent('send_notifications', array()); }
/** * @param Docman_Item $item * @throws FullTextSearchDocmanIndexFileTooBigException */ private function indexNonexistantDocument(Docman_Item $item) { $item_factory = $this->getDocmanItemFactory($item); $item_type = $item_factory->getItemTypeForItem($item); switch ($item_type) { case PLUGIN_DOCMAN_ITEM_TYPE_EMPTY: $this->indexNewEmptyDocument($item); break; case PLUGIN_DOCMAN_ITEM_TYPE_FOLDER: $this->indexNewDocmanFolder($item); break; case PLUGIN_DOCMAN_ITEM_TYPE_WIKI: $wiki_page = new WikiPage($item->getGroupId(), $item->getPagename()); $this->indexNewWikiDocument($item, $wiki_page->getMetadata()); break; case PLUGIN_DOCMAN_ITEM_TYPE_LINK: $this->indexNewLinkDocument($item); break; case PLUGIN_DOCMAN_ITEM_TYPE_EMBEDDEDFILE: case PLUGIN_DOCMAN_ITEM_TYPE_FILE: $this->indexNewDocument($item, $item->getCurrentVersion()); break; default: $this->logger->debug("unrecognized item type, can't index it"); break; } }
public function getIndexedWikiPageData(WikiPage $wiki_page) { $wiki_page_metadata = $wiki_page->getMetadata(); return array('id' => $wiki_page->getId(), 'group_id' => $wiki_page->getGid(), 'page_name' => $wiki_page->getPagename(), 'last_modified_date' => date('c', $wiki_page_metadata[self::PHPWIKI_METADATA_LAST_MODIFIED_DATE]), 'last_author' => $wiki_page_metadata[self::PHPWIKI_METADATA_AUTHOR_ID], 'last_summary' => isset($wiki_page_metadata[self::PHPWIKI_METADATA_SUMMARY]) ? $wiki_page_metadata[self::PHPWIKI_METADATA_SUMMARY] : '', 'content' => isset($wiki_page_metadata[self::PHPWIKI_METADATA_CONTENT]) ? $wiki_page_metadata[self::PHPWIKI_METADATA_CONTENT] : '', 'permissions' => $this->getCurrentPermissions($wiki_page)); }