Skip to content

Commit

Permalink
Added CKEditor support to cli commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Roel van Hintum committed Sep 9, 2024
1 parent 4089bdf commit a9a17c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 4.1.1 - 2024-09-09

### Changed

- Added CKEditor support to cli commands

## 4.1.0 - 2024-09-09

### Changed
Expand Down
10 changes: 8 additions & 2 deletions src/console/controllers/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,24 @@ private function getUnusedAssets(?string $volume = null)
$volumeModel = Craft::$app->getVolumes()->getVolumeByHandle($volume);
}

$subQuery = (new Query())
$subQueryRelations = (new Query())
->select('id')
->from(['relations' => Table::RELATIONS])
->where('relations.targetId=assets.id')
->orWhere('relations.sourceId=assets.id');

$subQueryContent = (new Query())
->select('elementId as id')
->from(Table::ELEMENTS_SITES)
->where("`content` LIKE CONCAT('%asset:', assets.id, ':%')");

$query = (new Query())
->select(['assets.id', 'assets.filename'])
->from(['assets' => Table::ASSETS])
->innerJoin(['elements' => Table::ELEMENTS], '[[elements.id]] = [[assets.id]]')
->where(['elements.dateDeleted' => null])
->andWhere(['not exists', $subQuery]);
->andWhere(['not exists', $subQueryRelations])
->andWhere(['not exists', $subQueryContent]);

if (isset($volumeModel)) {
$query->where(['volumeId' => $volumeModel->id]);
Expand Down

0 comments on commit a9a17c2

Please sign in to comment.