Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- Updated core asset I/O to resolve Craft filesystem definitions and configured storage targets through Laravel filesystem disks.
- Updated elevated session prompts to use the modern control panel frontend while preserving the legacy JavaScript APIs.
- Login attempts are now rate limited.
- Added `Illuminate\Contracts\Translation\HasLocalePreference` support to user elements, allowing Laravel notifications to use users’ Language preferences. ([#19228](https://github.com/craftcms/cms/pull/19228))
Expand Down
8 changes: 4 additions & 4 deletions resources/css/cp.css
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ Form controls
overflow: clip;
}

/**
Select
*/
.cp-form-control--select {
.selectize-dropdown.cp-form-control {
position: absolute;
min-height: 0;
overflow: visible;
}
4 changes: 2 additions & 2 deletions resources/js/pages/settings/filesystems/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}

const props = defineProps<{
filesystems: Array<FileSystemData>;
filesystems: {data: Array<FileSystemData>};
readOnly: boolean;
}>();

Expand Down Expand Up @@ -85,7 +85,7 @@
]);
const table = useVueTable<FileSystemData>({
get data() {
return props.filesystems;
return props.filesystems.data;
},
get columns() {
return columns.value;
Expand Down
11 changes: 4 additions & 7 deletions src/Asset/AssetIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ public function getIndexListOnVolume(Volume $volume, string $directory = ''): Ge
return;
}

$fsSubpath = $volume->getSubpath();

try {
foreach ($fileList as $listing) {
if (! $listing instanceof StorageAttributes) {
Expand All @@ -92,7 +90,7 @@ public function getIndexListOnVolume(Volume $volume, string $directory = ''): Ge
'fileSize' => ! $listing->isDir() && method_exists($listing, 'fileSize') ? $listing->fileSize() : null,
]);

$path = $listing->getAdjustedUri($fsSubpath);
$path = $listing->getUri();
$segments = preg_split('/\\\\|\//', $path);
$lastSegmentIndex = count($segments) - 1;

Expand Down Expand Up @@ -211,7 +209,6 @@ public function createIndexingSession(
public function storeIndexList(Generator $indexList, int $sessionId, Volume $volume): int
{
$values = [];
$fsSubpath = $volume->getSubpath();
$now = now();

/** @var FsListing $volumeListing */
Expand All @@ -226,7 +223,7 @@ public function storeIndexList(Generator $indexList, int $sessionId, Volume $vol
$values[] = [
'volumeId' => $volume->id,
'sessionId' => $sessionId,
'uri' => $volumeListing->getAdjustedUri($fsSubpath),
'uri' => $volumeListing->getUri(),
'size' => $volumeListing->getFileSize(),
'timestamp' => $timestamp,
'isDir' => $volumeListing->getIsDir(),
Expand Down Expand Up @@ -513,7 +510,7 @@ public function indexFileByListing(
$indexEntry = new AssetIndexEntry([
'volumeId' => $volume->id,
'sessionId' => $sessionId,
'uri' => $listing->getAdjustedUri($volume->getSubpath()),
'uri' => $listing->getUri(),
'size' => $listing->getFileSize(),
'timestamp' => $listing->getDateModified(),
'isDir' => $listing->getIsDir(),
Expand Down Expand Up @@ -541,7 +538,7 @@ public function indexFolderByListing(
$indexEntry = new AssetIndexEntry([
'volumeId' => $volume->id,
'sessionId' => $sessionId,
'uri' => $listing->getAdjustedUri($volume->getSubpath()),
'uri' => $listing->getUri(),
'size' => $listing->getFileSize(),
'timestamp' => $listing->getDateModified(),
'isDir' => $listing->getIsDir(),
Expand Down
21 changes: 6 additions & 15 deletions src/Asset/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
use CraftCms\Cms\Element\Elements;
use CraftCms\Cms\Element\Queries\AssetQuery;
use CraftCms\Cms\Filesystem\Contracts\FsInterface;
use CraftCms\Cms\Filesystem\Filesystems as FilesystemsService;
use CraftCms\Cms\Filesystem\Filesystems\Temp;
use CraftCms\Cms\Image\Data\ImageTransform;
use CraftCms\Cms\Image\FallbackTransformer;
use CraftCms\Cms\Image\ImageHelper;
use CraftCms\Cms\Support\Env;
use CraftCms\Cms\Support\Facades\Filesystems;
use CraftCms\Cms\Support\Facades\Path;
use CraftCms\Cms\Support\File;
use CraftCms\Cms\Support\Str;
use CraftCms\Cms\Support\Typecast;
Expand All @@ -40,7 +40,6 @@
use Illuminate\Container\Attributes\Singleton;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use InvalidArgumentException;
use RuntimeException;
use Throwable;
Expand Down Expand Up @@ -184,7 +183,7 @@ public function getImagePreviewUrl(Asset $asset, int $maxWidth, int $maxHeight):

if (
! $isWebSafe ||
! $asset->getVolume()->getFs()->hasUrls ||
! $asset->getVolume()->sourceHasUrls() ||
$originalWidth > $width ||
$originalHeight > $height
) {
Expand Down Expand Up @@ -309,7 +308,9 @@ public function getTempAssetUploadFs(): FsInterface
$handle = Env::parse(Cms::config()->tempAssetUploadFs);

if (! $handle) {
return new Temp;
return new Temp([
'handle' => 'disk:'.FilesystemsService::TEMP_ASSET_DISK,
]);
}

return Filesystems::resolve($handle)
Expand All @@ -323,17 +324,7 @@ public function getTempAssetUploadDisk(): FilesystemAdapter
{
$handle = Env::parse(Cms::config()->tempAssetUploadFs);

if (! $handle) {
return Storage::build([ // @phpstan-ignore return.type
'driver' => 'local',
'root' => Path::tempAssetUploads(),
]);
}

return Storage::disk(
Filesystems::resolveDiskName($handle)
?? throw new RuntimeException("The tempAssetUploadFs config setting is set to an invalid filesystem value: $handle")
);
return Filesystems::disk($handle ?: 'disk:'.FilesystemsService::TEMP_ASSET_DISK);
}

public function createTempAssetQuery(): AssetQuery
Expand Down
4 changes: 2 additions & 2 deletions src/Asset/AssetsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ public static function revUrl(string $url, Asset $asset, ?DateTimeInterface $dat
$baseUrls = Collection::make();
$volume = $asset->getVolume();

if ($volume->getFs()->hasUrls) {
if ($volume->sourceHasUrls()) {
$baseUrls->push(self::diskBaseUrl($volume->sourceDisk()));
}

if ($volume->getTransformFs()->hasUrls) {
if ($volume->transformHasUrls()) {
$baseUrls->push(self::diskBaseUrl($volume->transformDisk()));
}

Expand Down
3 changes: 1 addition & 2 deletions src/Asset/Commands/Concerns/IndexesAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ private function processVolume(
$this->components->twoColumnDetail("Indexing assets in <fg=cyan>{$volume->name}</>");

$fileList = AssetIndexer::getIndexListOnVolume($volume, $path);
$fsSubpath = $volume->getSubpath();

/** @var Collection<MissingAssetException|MissingVolumeFolderException> $missingRecords */
$missingRecords = Collection::make();
Expand All @@ -153,7 +152,7 @@ private function processVolume(
/** @var FsListing $item */
foreach ($fileList as $index => $item) {
$count = $index + 1;
$description = "#{$count}: <fg=cyan>{$item->getAdjustedUri($fsSubpath)}".($item->getIsDir() ? '/' : '').'</>';
$description = "#{$count}: <fg=cyan>{$item->getUri()}".($item->getIsDir() ? '/' : '').'</>';

if ($count < $startAt) {
$this->components->twoColumnDetail($description, '<fg=yellow;options=bold>SKIPPED</>');
Expand Down
Loading