Version 4.7.13

This commit is contained in:
Neo committed 2025-12-19 16:14:56 -08:00
1 parent fd22d99e69
commit 7124a02564
954 files changed
+29277 -59308

No files matched your search

+1 -1
View File
@@ -396,7 +396,7 @@ class _Query extends \IPS\Content\Search\Query
{
$classes = array_merge( $object->classes, $classes );
if ( ! $object->similarContent )
if ( empty( $object->similarContent ) )
{
foreach( $object->classes as $class )
{
+6
View File
@@ -249,6 +249,12 @@ abstract class _Index extends \IPS\Patterns\Singleton
$isLastComment = 1;
}
/* If this comment is hidden, don't actually mark as the last comment as that will cause this item to be hidden in search if we are getting only the last comment. */
if ( $isLastComment AND $object->hidden() )
{
$isLastComment = 0;
}
/* If we are re-indexing the first post of an item, which is triggered by a comment being added to a $itemClass::$firstCommentRequired,
then ensure that the isLastComment flag is not added as we index the comment first, which means the index_is_last_comment is incorrectly reset to 0 for the comment itself */
if ( $isForItem and $isLastComment )
+29 -6
View File
@@ -588,16 +588,39 @@ class _Index extends \IPS\Content\Search\Index
public function resetLastComment( $classes, $indexItemId, $ignoreId = NULL )
{
\IPS\Db::i()->update( 'core_search_index', array( 'index_is_last_comment' => 0 ), array( \IPS\Db::i()->in( 'index_class', $classes ) . ' AND index_item_id=? AND index_is_last_comment=1', $indexItemId ) );
try
{
$latest = \IPS\Db::i()->select( 'index_object_id, index_date_updated, index_class', 'core_search_index', array( \IPS\Db::i()->in( 'index_class', $classes ) . ' AND index_item_id=? and index_hidden=0', $indexItemId ), 'index_date_created DESC', array( 0, 1 ) )->first();
\IPS\Db::i()->update( 'core_search_index', array( 'index_is_last_comment' => 1 ), array( 'index_class=? AND index_object_id=?', $latest['index_class'], $latest['index_object_id'] ) );
/* Now reset the item index with the latest comment time */
\IPS\Db::i()->update( 'core_search_index', array( 'index_date_updated' => $latest['index_date_updated'], 'index_date_commented' => $latest['index_date_commented'] ), array( \IPS\Db::i()->in( 'index_class', $classes ) . ' AND index_item_id=? AND index_object_id=?', $indexItemId, $indexItemId ) );
}
catch( \Exception $ex ) { }
catch( \Exception )
{
/* Didn't find a latest? Was it because the entire thing is hidden? */
try
{
$index = \IPS\Db::i()->select( 'index_id, index_item_index_id, index_hidden', 'core_search_index', array( \IPS\Db::i()->in( 'index_class', $classes ) . ' AND index_item_id=?', $indexItemId ), 'index_date_created DESC', array( 0, 1 ) )->first();
/* Is the root item hidden? */
if ( $index['index_id'] == $index['index_item_index_id'] and in_array( $index['index_hidden'], [ -1, 2 ] ) )
{
$latest = \IPS\Db::i()->select( 'index_object_id, index_date_updated, index_class, index_date_commented', 'core_search_index', array( \IPS\Db::i()->in( 'index_class', $classes ) . ' AND index_item_id=? and index_hidden=?', $indexItemId, $index['index_hidden'] ), 'index_date_created DESC', array( 0, 1 ) )->first();
}
else
{
/* No, so we can't find a latest item that is hidden, so skip this */
return FALSE;
}
}
catch( \Exception )
{
return FALSE;
}
}
\IPS\Db::i()->update( 'core_search_index', array( 'index_is_last_comment' => 1 ), array( 'index_class=? AND index_object_id=?', $latest['index_class'], $latest['index_object_id'] ) );
/* Now reset the item index with the latest comment time */
\IPS\Db::i()->update( 'core_search_index', array( 'index_date_updated' => $latest['index_date_updated'], 'index_date_commented' => $latest['index_date_commented'] ), array( \IPS\Db::i()->in( 'index_class', $classes ) . ' AND index_item_id=? AND index_object_id=?', $indexItemId, $indexItemId ) );
}
/**
+6 -3
View File
@@ -922,7 +922,7 @@ class _Query extends \IPS\Content\Search\Query
/* Now, if we have 501 results, then we have to assume there are more, so the join is required */
if ( \count( $tagIds ) == 501 )
{
$tagWhere = array( $itemsOnlyTagSearch . 'index_item_index_id IN ( ? )', \IPS\Db::i()->select( 'index_id', 'core_search_index_tags', array( \IPS\Db::i()->in( 'index_tag', $tags ) ) ) );
$tagWhere = array( $itemsOnlyTagSearch . 'index_item_index_id IN (' . \IPS\Db::i()->select( 'index_id', 'core_search_index_tags', array( \IPS\Db::i()->in( 'index_tag', $tags ) ) ) . ')' );
}
else
{
@@ -1031,7 +1031,7 @@ class _Query extends \IPS\Content\Search\Query
$where[] = $clause;
}
}
/* Return */
return $where;
}
@@ -1101,7 +1101,7 @@ class _Query extends \IPS\Content\Search\Query
search which is actually very efficient as MySQL performs a search on the FT index first to narrow down the results */
if ( static::termIsPhrase( $term ) )
{
$term = str_replace( array( "'", '"' ), '', $term );
$term = str_replace( array( "'", '"', '?' ), '', $term );
foreach ( static::termAsWordsArray( $term ) as $word )
{
@@ -1161,6 +1161,9 @@ class _Query extends \IPS\Content\Search\Query
/* Trailing + or -s are not allowed */
$word = rtrim( $word, '+-' );
/* ? are not allowed either */
$word = str_replace( '?', '', $word );
/* These rules only apply if we're not in a quoted phrase... */
if ( !static::termIsPhrase( $word ) )