Version 5.0.6

This commit is contained in:
Neo committed 2025-12-19 18:55:49 -08:00
1 parent a3a4a9ccbd
commit b89858b2ff
1214 files changed
+92828 -14859

No files matched your search

+53 -29
View File
@@ -12,9 +12,11 @@ namespace IPS\Content;
/* To prevent PHP errors (extending class does not exist) revealing path */
use DateInvalidOperationException;
use Exception;
use IPS\Application;
use IPS\Content\Search\SearchContent;
use IPS\Platform\Bridge;
use RuntimeException;
use BadMethodCallException;
use OutOfRangeException;
@@ -129,11 +131,12 @@ trait Hideable
$column = static::$databaseColumnMap[ 'hidden' ] ?? static::$databaseColumnMap[ 'approved' ];
$this->$column = -2;
$this->save();
$item = ( $this instanceof Comment ) ? $this->item() : $this;
if ( $this instanceof Comment )
{
$item = $this->item();
/* Update last comment stuff */
$item->resyncLastComment();
@@ -164,7 +167,21 @@ trait Hideable
$item->container()->save();
}
}
catch( \BadMethodCallException ){}
catch( BadMethodCallException ){}
}
else
{
/* If this is an item, just update the container counts */
try
{
$containerColumn = ( $originalState === 1 ) ? '_unapprovedItems' : '_items';
if( $item->container()->$containerColumn !== null )
{
$item->container()->$containerColumn = ( $item->container()->$containerColumn > 0 ) ? ( $item->container()->$containerColumn - 1 ) : 0;
$item->container()->save();
}
}
catch( BadMethodCallException ){}
}
if ( IPS::classUsesTrait( $this, 'IPS\Content\Taggable' ) )
@@ -395,15 +412,9 @@ trait Hideable
$firstColumn = $commentClass::$databaseColumnMap['hidden'];
$firstComment->$firstColumn = 2;
}
Index::i()->index( $firstComment );
}
Index::i()->index( ( static::$firstCommentRequired AND $firstComment ) ? $firstComment : $this );
Index::i()->indexSingleItem( $this );
}
else
{
/* Either this is a comment / review, or the item doesn't support comments or reviews, so we can just reindex it now. */
Index::i()->index( $this );
}
}
}
@@ -454,6 +465,12 @@ trait Hideable
if( SearchContent::isSearchable( $this ) )
{
Index::i()->index( $this );
if ( $this instanceof Item )
{
/* Now re-index all the reviews and comments */
Index::i()->indexSingleItem( $this );
}
}
/* Clear the item stats */
@@ -609,12 +626,6 @@ trait Hideable
Db::i()->update( 'core_tags_perms', array( 'tag_perm_visible' => 1 ), array( 'tag_perm_aai_lookup=?', $this->tagAAIKey() ) );
}
/* Update search index */
if( SearchContent::isSearchable( $this ) )
{
Index::i()->index( $this );
}
/* Update report center stuff */
if ( IPS::classUsesTrait( $this, 'IPS\Content\Reportable' ) )
{
@@ -714,18 +725,24 @@ trait Hideable
$column = $className::$databaseColumnMap['hidden'];
$firstComment->$column = 0;
}
Index::i()->index( $firstComment );
}
Index::i()->index( ( static::$firstCommentRequired AND $firstComment ) ? $firstComment : $this );
Index::i()->indexSingleItem( $this );
}
else
{
/* Either this is a comment / review, or the item doesn't support comments or reviews, so we can just reindex it now. */
Index::i()->index( $this );
}
}
}
/* Update search index */
if( SearchContent::isSearchable( $this ) )
{
Index::i()->index( $this );
if ( $this instanceof Item )
{
/* Now re-index all the reviews and comments */
Index::i()->indexSingleItem( $this );
}
}
}
/**
@@ -919,14 +936,21 @@ trait Hideable
$notification->recipients->attach( $member );
$notification->send();
}
/**
* Send Unapproved Notification
*
* @return void
* @return void
* @throws DateInvalidOperationException
*/
public function sendUnapprovedNotification(): void
{
/* Check the bridge */
if ( ! Bridge::i()->sendUnapprovedNotification( $this ) )
{
return;
}
$moderators = array( 'g' => array(), 'm' => array() );
foreach(Db::i()->select( '*', 'core_moderators' ) AS $mod )
{
@@ -940,7 +964,7 @@ trait Hideable
else
{
$perms = json_decode( $mod['perms'], TRUE );
foreach ( array( 'canView' => 'can_view_hidden_', 'canApprove' => 'can_unhide_' ) as $varKey => $modPermKey )
{
if ( isset( $perms[ $modPermKey . 'content' ] ) AND $perms[ $modPermKey . 'content' ] )
@@ -948,7 +972,7 @@ trait Hideable
$$varKey = TRUE;
}
else
{
{
try
{
$container = ( $this instanceof Comment ) ? $this->item()->container() : $this->container();