[BUGFIX] indexed_search: in some cases indexing does not work 01/32601/2
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:39:17 +0000 (14:39 +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/32601
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/indexed_search/Classes/Indexer.php

index 0623160..50c4ec9 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'],