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

+66 -2
View File
@@ -19,7 +19,6 @@ use Exception;
use InvalidArgumentException;
use IPS\Application;
use IPS\Content;
use IPS\core\FrontNavigation;
use IPS\Data\Store;
use IPS\DateTime;
use IPS\Db;
@@ -135,6 +134,11 @@ class Tag extends Model
*/
protected function get__badge(): ?array
{
if( $this->mergeInProgress() )
{
return [ 0 => 'ipsBadge ipsBadge--intermediary', 1 => null, 2 => Member::loggedIn()->language()->addToStack( 'tag_merge_processing' ) ];
}
$totalItems = array_sum( $this->totals );
$text = Member::loggedIn()->language()->addToStack( 'tag_total_items', true, [ 'pluralize' => [ $totalItems ] ] );
Member::loggedIn()->language()->parseOutputForDisplay( $text );
@@ -145,6 +149,22 @@ class Tag extends Model
];
}
/**
* [Node] Get whether or not this node is enabled
*
* @note Return value NULL indicates the node cannot be enabled/disabled
* @return bool|null
*/
protected function get__enabled(): ?bool
{
if( $this->mergeInProgress() )
{
return null;
}
return parent::get__enabled();
}
/**
* [Node] Get Title
*
@@ -174,6 +194,17 @@ class Tag extends Model
return NULL;
}
/**
* [Node] Get Icon for tree
*
* @note Return the class for the icon (e.g. 'globe', the 'fa fa-' is added automatically so you do not need this here)
* @return mixed
*/
protected function get__icon(): mixed
{
return $this->mergeInProgress() ? 'lock' : null;
}
/**
* @return array
*/
@@ -191,6 +222,33 @@ class Tag extends Model
$this->_data['totals'] = ( is_array( $val ) and count( $val ) ) ? json_encode( $val ) : null;
}
/**
* Is this node currently queued for deleting or moving content OR is it the target of content queued to be moved from another node?
*
* @return bool
*/
public function deleteOrMoveQueued(): bool
{
if( $this->mergeInProgress() )
{
return true;
}
return parent::deleteOrMoveQueued();
}
/**
* Determines if the tag has been flagged for merging.
* We need to flag it because this can take a while if there
* are a lot of items, and we don't want anyone messing with it
*
* @return bool
*/
public function mergeInProgress() : bool
{
return isset( $this->totals['merge'] );
}
/**
* Form
*
@@ -340,6 +398,12 @@ class Tag extends Model
*/
public function recount() : void
{
/* If we're in middle of a merge, do nothing */
if( $this->mergeInProgress() )
{
return;
}
$totals = [];
$this->last_used = null;
foreach( Db::i()->select( 'tag_meta_app, tag_meta_area, count(tag_meta_id) as total, max(tag_added) as tag_added', 'core_tags', [ 'tag_text=?', $this->text ], null, null, [ 'tag_meta_app', 'tag_meta_area' ] ) as $row )
@@ -545,7 +609,7 @@ class Tag extends Model
public function coverPhoto(): mixed
{
$photo = parent::coverPhoto();
$photo->editable = ( Member::loggedIn()->isAdmin() and Member::loggedIn()->hasAcpRestriction( 'core', 'discovery', 'tags_manage' ) );
$photo->editable = Member::loggedIn()->modPermission( 'can_edit_tags' );
$photo->overlay = Theme::i()->getTemplate( 'tags', 'core', 'front' )->coverPhotoOverlay( $this );
return $photo;
}