Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
- “New entry” buttons now only offer the entry types and sections that `CraftCms\Cms\Entry\Events\EntryTypesResolving` listeners leave available for the site, instead of ones that then fail with a 400 error. ([#20322](https://github.com/craftcms/cms/issues/20322))

### Assets
- Removed the `maxCachedCloudImageSize` config setting and asset indexing’s “Cache remote images” option, including the `--cacheRemoteImages` CLI option. Remote image sources are no longer resized or retained between requests; transforms and image editing download originals as needed and delete the local copies afterward. Sites that opted into source caching may see more downloads, bandwidth use, and image-processing work.
- Assets in more than one site can be compared between sites from the Sites panel, on the Compare screen, where field values can be copied from one site to the other. ([#20384](https://github.com/craftcms/cms/pull/20384))
- Added background uploads in the Assets index, which continue during control panel navigation, with persistent progress, retry, cancellation, and filename-conflict controls.
- Images uploaded from the Assets index that look like copies of images that are already uploaded, even resized or recompressed, now wait within their upload notification, which shows the existing images’ chips and offers to cancel the upload, keep both, or replace the existing image’s file, like filename conflicts. ([#20113](https://github.com/craftcms/cms/pull/20113))
Expand Down Expand Up @@ -339,7 +340,7 @@

### System
- Removed the bundled Composer executable. Package installation, updates, and removal now require Composer 2.2.0 or later in the server’s `PATH`, and are disabled when it’s unavailable.
- Craft no longer changes its behavior based on the `CRAFT_EPHEMERAL` environment variable. Temporary files now follow Laravel’s storage path, and automatic project config YAML writes, asset publishing, and the Asset Indexes utility’s “Cache remote images” option no longer depend on it. `craft\helpers\App::isEphemeral()` is deprecated. ([#20547](https://github.com/craftcms/cms/pull/20547))
- Craft no longer changes its behavior based on the `CRAFT_EPHEMERAL` environment variable. Temporary files now follow Laravel’s storage path, and automatic project config YAML writes and asset publishing no longer depend on it. `craft\helpers\App::isEphemeral()` is deprecated. ([#20547](https://github.com/craftcms/cms/pull/20547))
- The database table prefix is now set with the `DB_PREFIX` environment variable. When `craftcms/yii2-adapter` is installed, Craft 5’s `CRAFT_DB_TABLE_PREFIX` and `DB_TABLE_PREFIX` environment variables are still applied, with a trailing underscore. ([#20192](https://github.com/craftcms/cms/pull/20192))
- Replaced `pixelandtonic/imagine` with `intervention/image` for image manipulation.
- Image assets now store color data sampled from their file when it’s uploaded, replaced, or indexed, including the image’s dominant color, a grid of the average colors of its regions, its main colors and how much of the image each covers, and how light its regions are. Control panel uploads sample it in the browser. ([#19740](https://github.com/craftcms/cms/pull/19740), [#19750](https://github.com/craftcms/cms/pull/19750), [#20103](https://github.com/craftcms/cms/pull/20103))
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
- Added `CraftCms\Cms\Element\Queries\Events\ElementQueryPreparing` and `ElementQueryPrepared`, which are dispatched each time an element query is prepared to run, before and after its params are applied, so modules can scope every query of an element type, including its counts and pagination. ([#20705](https://github.com/craftcms/cms/issues/20705), [#20722](https://github.com/craftcms/cms/pull/20722))
- `craft\elements\db\ElementQuery::EVENT_BEFORE_PREPARE` and `EVENT_AFTER_PREPARE` handlers are called again when the Yii adapter is installed. ([#20705](https://github.com/craftcms/cms/issues/20705), [#20722](https://github.com/craftcms/cms/pull/20722))
- Removed the bundled Composer executable. Package installation, updates, and removal now require Composer 2.2.0 or later in the server’s `PATH`, and are disabled when it’s unavailable.
- Craft no longer changes its behavior based on the `CRAFT_EPHEMERAL` environment variable. Temporary files now follow Laravel’s storage path, and automatic project config YAML writes, legacy asset publishing, and the Asset Indexes utility’s “Cache remote images” option no longer depend on it. `app()->isEphemeral()` and `craft\helpers\App::isEphemeral()` are deprecated, and only available with the Yii adapter. ([#20547](https://github.com/craftcms/cms/pull/20547))
- Craft no longer changes its behavior based on the `CRAFT_EPHEMERAL` environment variable. Temporary files now follow Laravel’s storage path, and automatic project config YAML writes and legacy asset publishing no longer depend on it. `app()->isEphemeral()` and `craft\helpers\App::isEphemeral()` are deprecated, and only available with the Yii adapter. ([#20547](https://github.com/craftcms/cms/pull/20547))
- Removed the `maxCachedCloudImageSize` config setting and asset indexing’s “Cache remote images” option, including the `--cacheRemoteImages` CLI option. Remote image sources are no longer resized or retained between requests; transforms and image editing download originals as needed and delete the local copies afterward. Sites that opted into source caching may see more downloads, bandwidth use, and image-processing work.
- Craft now supports Laravel Octane, on Swoole and RoadRunner. Requests served by the same worker no longer share state such as live preview drafts, control panel assets, translated element type names, view namespaces, or routes from the project config, and project config changes made by other workers or commands are picked up by the next request. ([#20641](https://github.com/craftcms/cms/pull/20641))
- Ask AI is now available in element editor slideouts, Live Preview, and the editor in release previews, from their details rail, and works with the element open there. Its conversation, including an unsent message or a reply on its way, moves with it as they open and close, and it stays open or closed as it was left. ([#20718](https://github.com/craftcms/cms/pull/20718))
- Pressing <kbd>Command</kbd>/<kbd>Ctrl</kbd> + <kbd>I</kbd> again, straight after it moved focus to Ask AI’s message box, now closes Ask AI and returns focus to where it was. Once you type or move the cursor in the message box, the keys italicize text as usual. ([#20718](https://github.com/craftcms/cms/pull/20718))
Expand Down
4 changes: 1 addition & 3 deletions packages/craftcms-ui/src/services/AssetIndexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ export interface IndexingResponse {
export interface StartIndexingParams {
/** Volume IDs to index */
volumes: (string | number)[];
/** Whether to cache remote images locally */
cacheImages?: boolean;
/** Whether to list empty folders */
listEmptyFolders?: boolean;
/** Whether to sample missing image colors and queue images for AI tasks, even if their files haven't changed */
Expand Down Expand Up @@ -149,7 +147,7 @@ interface QueuedTask {
* indexer.on('error', ({ message }) => console.error(message));
* indexer.on('complete', () => console.log('All done'));
*
* await indexer.startIndexing({ volumes: [1, 2, 3], cacheImages: true });
* await indexer.startIndexing({ volumes: [1, 2, 3] });
* ```
*
* @example Resuming existing sessions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

const form = reactive({
volumes: ['*', ...props.volumeOptions.map((v) => v.value)],
cacheImages: false,
listEmptyFolders: false,
analyzeImages: false,
});
Expand All @@ -48,17 +47,6 @@

<h2 class="cp-h4 mb-2 mt-6">{{ t('Options') }}</h2>
<div class="grid gap-3">
<craft-switch
name="cacheImages"
:label="t('Cache remote images')"
.checked="form.cacheImages"
@change="form.cacheImages = ($event.target as HTMLInputElement).checked"
>
<div slot="help-text">
{{ t('Download copies of remote images to the local filesystem.') }}
</div>
</craft-switch>

<craft-switch
name="listEmptyFolders"
:label="t('List empty folders')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ function closeReview() {
* });
*
* function handleSubmit() {
* startIndexing({ volumes: [1, 2], cacheImages: true });
* startIndexing({ volumes: [1, 2] });
* }
* </script>
*
Expand Down
42 changes: 12 additions & 30 deletions src/Asset/AssetIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
use CraftCms\Cms\Element\Elements;
use CraftCms\Cms\Filesystem\Data\FsListing;
use CraftCms\Cms\Image\ImageHelper;
use CraftCms\Cms\Image\ImageTransformHelper;
use CraftCms\Cms\Support\Facades\Images;
use CraftCms\Cms\Support\File;
use CraftCms\Cms\Support\Json;
Expand Down Expand Up @@ -142,7 +141,6 @@ public function getIndexingSessionById(int $sessionId): ?AssetIndexingSession
/** @param array<int|string> $volumes */
public function startIndexingSession(
array $volumes,
bool $cacheRemoteImages = true,
bool $listEmptyFolders = false,
bool $analyzeImages = false,
): AssetIndexingSession {
Expand All @@ -154,7 +152,7 @@ public function startIndexingSession(
}
}

$session = $this->createIndexingSession($volumeList, $cacheRemoteImages, listEmptyFolders: $listEmptyFolders, analyzeImages: $analyzeImages);
$session = $this->createIndexingSession($volumeList, listEmptyFolders: $listEmptyFolders, analyzeImages: $analyzeImages);
$total = 0;

/** @var Volume $volume */
Expand All @@ -181,7 +179,6 @@ public function stopIndexingSession(AssetIndexingSession $session): void
/** @param Volume[] $volumeList */
public function createIndexingSession(
array $volumeList,
bool $cacheRemoteImages = true,
bool $isCli = false,
bool $listEmptyFolders = false,
bool $analyzeImages = false,
Expand All @@ -196,7 +193,6 @@ public function createIndexingSession(
'totalEntries' => 0,
'indexedVolumes' => Json::encode($indexedVolumes),
'processedEntries' => 0,
'cacheRemoteImages' => $cacheRemoteImages,
'listEmptyFolders' => $listEmptyFolders,
'analyzeImages' => $analyzeImages,
'actionRequired' => false,
Expand Down Expand Up @@ -290,7 +286,7 @@ public function processIndexSession(AssetIndexingSession $indexingSession): Asse
if ($indexEntry->isDir) {
$recordId = $this->indexFolderByEntry($indexEntry)->id;
} else {
$recordId = $this->indexFileByEntry($indexEntry, $indexingSession->cacheRemoteImages, analyzeImages: $indexingSession->analyzeImages)->id;
$recordId = $this->indexFileByEntry($indexEntry, analyzeImages: $indexingSession->analyzeImages)->id;
}

$indexEntry->transitionTo(AssetIndexStatus::Indexed, $recordId);
Expand Down Expand Up @@ -492,7 +488,6 @@ public function indexFile(
Volume $volume,
string $path,
int $sessionId,
bool $cacheImages = false,
bool $createIfMissing = true,
bool $analyzeImages = false,
): Asset {
Expand All @@ -509,7 +504,7 @@ public function indexFile(
'fileSize' => $volume->sourceDisk()->size($path),
]);

return $this->indexFileByListing($volume, $listing, $sessionId, $cacheImages, $createIfMissing, $analyzeImages);
return $this->indexFileByListing($volume, $listing, $sessionId, $createIfMissing, $analyzeImages);
}

/**
Expand All @@ -522,7 +517,6 @@ public function indexFileByListing(
Volume $volume,
FsListing $listing,
int $sessionId,
bool $cacheImages = false,
bool $createIfMissing = true,
bool $analyzeImages = false,
): Asset {
Expand All @@ -537,7 +531,7 @@ public function indexFileByListing(

return $this->indexByListing(
$indexEntry,
fn () => $this->indexFileByEntry($indexEntry, $cacheImages, $createIfMissing, $analyzeImages),
fn () => $this->indexFileByEntry($indexEntry, $createIfMissing, $analyzeImages),
);
}

Expand Down Expand Up @@ -607,7 +601,6 @@ private function indexByListing(AssetIndexData $indexEntry, Closure $index): Ass
*/
public function indexFileByEntry(
AssetIndexData $indexEntry,
bool $cacheImages = false,
bool $createIfMissing = true,
bool $analyzeImages = false,
): Asset {
Expand Down Expand Up @@ -706,17 +699,15 @@ public function indexFileByEntry(
$dimensions = ImageHelper::imageSize($transformSourcePath);
$localPath = $transformSourcePath;
} else {
if (! $cacheImages) {
try {
$stream = $asset->getStream();

if (is_resource($stream)) {
$dimensions = ImageHelper::imageSizeByStream($stream);
fclose($stream);
}
} catch (VolumeException $e) {
Log::info($e->getMessage());
try {
$stream = $asset->getStream();

if (is_resource($stream)) {
$dimensions = ImageHelper::imageSizeByStream($stream);
fclose($stream);
}
} catch (VolumeException $e) {
Log::info($e->getMessage());
}

// A remote image is downloaded when its dimensions couldn't be read from a stream, or
Expand Down Expand Up @@ -754,14 +745,6 @@ public function indexFileByEntry(
if ($isNew || $fileChanged || $analyzeImages) {
$this->imageAnalyzer->queue($asset);
}

$shouldCache = ! $isLocalFs && $cacheImages && Cms::config()->maxCachedCloudImageSize > 0;

if ($shouldCache && $tempPath) {
$targetPath = $asset->getImageTransformSourcePath();
ImageTransformHelper::storeLocalSource($tempPath, $targetPath);
File::delete($tempPath);
}
} else {
// Like colors, preview text that's been read already, even with nothing to show, isn't read again
// unless the file has changed
Expand All @@ -787,7 +770,6 @@ public function indexFileByEntry(
} catch (Throwable $exception) {
Log::info($exception->getMessage());
} finally {
// Unless it was moved into place as the cached transform source
if ($tempPath !== null && file_exists($tempPath)) {
File::delete($tempPath);
}
Expand Down
8 changes: 2 additions & 6 deletions src/Asset/Commands/Concerns/IndexesAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

trait IndexesAssets
{
private bool $cacheRemoteImages;

private bool $deleteEmptyFolders;

private bool $deleteMissingAssets;
Expand All @@ -46,7 +44,6 @@ private function parseBooleanOption(string|int|bool $value): bool
/** @param list<Volume> $volumes */
protected function indexAssets(array $volumes, string $path = '', int $startAt = 0): void
{
$this->cacheRemoteImages = $this->parseBooleanOption($this->option('cacheRemoteImages'));
$this->deleteEmptyFolders = $this->parseBooleanOption($this->option('deleteEmptyFolders'));
$this->deleteMissingAssets = $this->parseBooleanOption($this->option('deleteMissingAssets'));
$this->createMissingAssets = $this->parseBooleanOption($this->option('createMissingAssets'));
Expand All @@ -56,7 +53,6 @@ protected function indexAssets(array $volumes, string $path = '', int $startAt =

$session = AssetIndexer::createIndexingSession(
volumeList: $volumes,
cacheRemoteImages: $this->cacheRemoteImages,
isCli: true,
listEmptyFolders: $this->deleteEmptyFolders,
analyzeImages: $this->analyzeImages,
Expand Down Expand Up @@ -163,7 +159,7 @@ private function processVolume(
try {
$item->getIsDir()
? AssetIndexer::indexFolderByListing($volume, $item, $session->id, $this->createMissingAssets)
: AssetIndexer::indexFileByListing($volume, $item, $session->id, $this->cacheRemoteImages, $this->createMissingAssets, $this->analyzeImages);
: AssetIndexer::indexFileByListing($volume, $item, $session->id, $this->createMissingAssets, $this->analyzeImages);
} catch (MissingAssetException|MissingVolumeFolderException $e) {
$missingRecords->add($e);

Expand Down Expand Up @@ -287,7 +283,7 @@ function () use ($e, $assetId) {
'dateUpdated' => Query::prepareDateForDb(now()),
]);

AssetIndexer::indexFileByEntry($e->indexEntry, $this->cacheRemoteImages, false, $this->analyzeImages);
AssetIndexer::indexFileByEntry($e->indexEntry, false, $this->analyzeImages);
}
);
}
Expand Down
1 change: 0 additions & 1 deletion src/Asset/Commands/IndexAllAssetsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class IndexAllAssetsCommand extends Command
{--createMissingAssets=true : Auto-create new asset records when missing.}
{--deleteMissingAssets=false : Delete all the asset records that have their files missing.}
{--deleteEmptyFolders=false : Delete empty folders.}
{--cacheRemoteImages=false : Cache remote-stored images in the process.}
{--analyzeImages=false : Sample missing image colors and metadata, and queue images for AI tasks.}
';

Expand Down
1 change: 0 additions & 1 deletion src/Asset/Commands/IndexOneAssetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class IndexOneAssetCommand extends Command implements PromptsForMissingInput
{--createMissingAssets=true : Auto-create new asset records when missing.}
{--deleteMissingAssets=false : Delete all the asset records that have their files missing.}
{--deleteEmptyFolders=false : Delete empty folders.}
{--cacheRemoteImages=false : Cache remote-stored images in the process.}
{--analyzeImages=false : Sample missing image colors and metadata, and queue images for AI tasks.}
';

Expand Down
1 change: 0 additions & 1 deletion src/Asset/Models/AssetIndexingSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ protected function casts(): array
return [
'totalEntries' => 'int',
'processedEntries' => 'int',
'cacheRemoteImages' => 'bool',
'listEmptyFolders' => 'bool',
'analyzeImages' => 'bool',
'isCli' => 'bool',
Expand Down
2 changes: 1 addition & 1 deletion src/Cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

public const string VERSION = '6.0.0-beta.1';

public const string SCHEMA_VERSION = '6.0.0.40';
public const string SCHEMA_VERSION = '6.0.0.41';

public const string MIN_VERSION_REQUIRED = '5.9.0';

Expand Down
34 changes: 0 additions & 34 deletions src/Config/GeneralConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -1858,22 +1858,6 @@ class GeneralConfig extends BaseConfig
*/
public mixed $logoutPath = 'logout';

/**
* @var int The maximum dimension size to use when caching images from external sources to use in transforms. Set to `0` to never cache them. Defaults to `0` as of 5.9.0. Earlier versions default to `2000`.
*
* ::: code
* ```php Static Config
* ->maxCachedCloudImageSize(0)
* ```
* ```shell Environment Override
* CRAFT_MAX_CACHED_CLOUD_IMAGE_SIZE=0
* ```
* :::
*
* @group Image Handling
*/
public int $maxCachedCloudImageSize = 0;

/**
* @var int The maximum allowed GraphQL queries that can be executed in a single batched request. Set to `0` to allow any number of queries.
*
Expand Down Expand Up @@ -5180,24 +5164,6 @@ public function logoutPath(mixed $value): self
return $this;
}

/**
* The maximum dimension size to use when caching images from external sources to use in transforms. Set to `0` to never cache them.
*
* ```php
* ->maxCachedCloudImageSize(0)
* ```
*
* @group Image Handling
*
* @see $maxCachedCloudImageSize
*/
public function maxCachedCloudImageSize(int $value): self
{
$this->maxCachedCloudImageSize = $value;

return $this;
}

/**
* The maximum allowed GraphQL queries that can be executed in a single batched request. Set to `0` to allow any number of queries.
*
Expand Down
Loading
Loading