Code Duplication    Length = 20-20 lines in 2 locations

lib/net/nehmer/static/viewer.php 1 location

@@ 82-101 (lines=20) @@
79
     * @param midcom_db_topic $topic The topic which we are bound to. If this is not an object, the code
80
     *     tries to load a new topic instance from the database identified by this parameter.
81
     */
82
    public static function index($dm, $indexer, $topic)
83
    {
84
        if (!is_object($topic))
85
        {
86
            $topic = new midcom_db_topic($topic);
87
        }
88
89
        // Don't index directly, that would lose a reference due to limitations
90
        // of the index() method. Needs fixes there.
91
92
        $nav = new midcom_helper_nav();
93
        $node = $nav->get_node($topic->id);
94
95
        $document = $indexer->new_document($dm);
96
        $document->topic_guid = $topic->guid;
97
        $document->topic_url = $node[MIDCOM_NAV_FULLURL];
98
        $document->read_metadata_from_object($dm->storage->object);
99
        $document->component = $topic->component;
100
        $indexer->index($document);
101
    }
102
103
    /**
104
     * Populates the node toolbar depending on the user's rights.

lib/net/nemein/wiki/viewer.php 1 location

@@ 95-114 (lines=20) @@
92
     * @param midcom_db_topic The topic which we are bound to. If this is not an object, the code
93
     *     tries to load a new topic instance from the database identified by this parameter.
94
     */
95
    public static function index($dm, $indexer, $topic)
96
    {
97
        if (!is_object($topic))
98
        {
99
            $topic = new midcom_db_topic($topic);
100
        }
101
102
        // Don't index directly, that would lose a reference due to limitations
103
        // of the index() method. Needs fixes there.
104
105
        $nav = new midcom_helper_nav();
106
        $node = $nav->get_node($topic->id);
107
108
        $document = $indexer->new_document($dm);
109
        $document->topic_guid = $topic->guid;
110
        $document->topic_url = $node[MIDCOM_NAV_FULLURL];
111
        $document->read_metadata_from_object($dm->storage->object);
112
        $document->component = $topic->component;
113
        $indexer->index($document);
114
    }
115
116
    public static function initialize_index_article($topic)
117
    {