[BUGFIX] indexed_search: in some cases indexing does not work 55/32355/4
authorSamir Rachidi <sr@plusb.de>
Mon, 25 Aug 2014 15:59:09 +0000 (17:59 +0200)
committerMarkus Klein <klein.t3@reelworx.at>
Fri, 5 Sep 2014 12:38:53 +0000 (14:38 +0200)
In some cases $pObj->register['SYS_LASTCHANGED'] is NULL and therefore
a MySQL error occurs during indexing a page. So, in these cases,
we need to set the 'mtime' value by getting it from the page and we
always want to prevent a NULL-value getting inserted into the DB.

Resolves: #61135
Releases: 6.1, 6.2, 6.3
Change-Id: Idb78af3aa23350db4bd43f58638541e6b3ad3ae3
Reviewed-on: http://review.typo3.org/32355
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/indexed_search/Classes/Indexer.php

index 36cbfe0..6937995 100644 (file)
@@ -279,7 +279,7 @@ class Indexer {
                                                        // Alternative title for indexing
                                                        $this->conf['metaCharset'] = $pObj->metaCharset;
                                                        // Character set of content (will be converted to utf-8 during indexing)
-                                                       $this->conf['mtime'] = $pObj->register['SYS_LASTCHANGED'];
+                                                       $this->conf['mtime'] = isset($pObj->register['SYS_LASTCHANGED']) ? $pObj->register['SYS_LASTCHANGED'] : $pObj->page['SYS_LASTCHANGED'];
                                                        // Most recent modification time (seconds) of the content on the page. Used to evaluate whether it should be re-indexed.
                                                        // Configuration of behavior:
                                                        $this->conf['index_externals'] = $pObj->config['config']['index_externals'];
@@ -1442,7 +1442,7 @@ class Indexer {
                        // TYPO3 page
                        'item_title' => $this->contentParts['title'],
                        'item_description' => $this->bodyDescription($this->contentParts),
-                       'item_mtime' => $this->conf['mtime'],
+                       'item_mtime' => (int) $this->conf['mtime'],
                        'item_size' => strlen($this->conf['content']),
                        'tstamp' => $GLOBALS['EXEC_TIME'],
                        'crdate' => $GLOBALS['EXEC_TIME'],