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
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class BasicPermissionCheck implements DiagnosticPipe
{
public const MAX_ISSUE_REPORTS_PER_TYPE = 5;
public const READ_WRITE_ALL = 07777;
public const WITHOUT_STICKY_BIT = 0777;

/**
* @var int[] IDs of all (POSIX) groups to which the process belongs
Expand Down Expand Up @@ -219,7 +220,8 @@ private function checkDirectoryPermissionsRecursively(string $path, array &$data
// `fileperms` also returns the higher bits of the inode mode.
// Hence, we must AND it with 07777 to only get what we are
// interested in
$actual_perm &= self::READ_WRITE_ALL;
// Edit 2026-01-23: Ignore sticky bit in permission checks
$actual_perm &= self::WITHOUT_STICKY_BIT;
$owning_group_id_or_false = filegroup($path);
if ($owning_group_id_or_false !== false) {
try {
Expand All @@ -236,7 +238,7 @@ private function checkDirectoryPermissionsRecursively(string $path, array &$data
}
/** @var string $owning_group_name */
$owning_group_name = $owning_group_name_or_false === false ? '<unknown>' : $owning_group_name_or_false['name'];
$expected_perm = self::getConfiguredDirectoryPerm();
$expected_perm = self::WITHOUT_STICKY_BIT & self::getConfiguredDirectoryPerm();

if (!in_array($owning_group_id_or_false, $this->groupIDs, true)) {
// @codeCoverageIgnoreStart
Expand Down
28 changes: 14 additions & 14 deletions app/Actions/Diagnostics/Pipes/Checks/DBSupportCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,26 @@ class DBSupportCheck implements DiagnosticPipe
public function handle(array &$data, \Closure $next): array
{
$db_possibilities = [
['mysql', 'pdo_mysql'],
['pgsql', 'pgsql'],
['pgsql', 'pdo_pgsql'],
['sqlite', 'sqlite3'],
'mysql' => ['mysql', 'mysqli', 'pdo_mysql'],
'pgsql' => ['pdo_pgsql', 'pgsql'],
'sqlite' => ['sqlite3'],
];

if (!array_key_exists(config('database.default', 'sqlite'), $db_possibilities)) {
// @codeCoverageIgnoreStart
$data[] = DiagnosticData::error('database type ' . config('database.default', 'sqlite') . ' is not supported by Lychee', self::class);

return $next($data);
}
// @codeCoverageIgnoreEnd

$found = false;
foreach ($db_possibilities as $db_possibility) {
if (config('database.default') === $db_possibility[0]) {
$found = true;
if (!extension_loaded($db_possibility[1])) {
// @codeCoverageIgnoreStart
$data[] = DiagnosticData::error($db_possibility[0] . ' db driver selected and PHP ' . $db_possibility[1] . ' extension not activated', self::class);
// @codeCoverageIgnoreEnd
}
}
foreach ($db_possibilities[config('database.default', 'sqlite')] as $db_possibility) {
$found = $found || extension_loaded($db_possibility);
}
if (!$found) {
// @codeCoverageIgnoreStart
$data[] = DiagnosticData::error('could not find the database solution for ' . config('database.default'), self::class);
$data[] = DiagnosticData::error(config('database.default', 'sqlite') . ' db driver selected and PHP ' . implode(' or ', $db_possibilities[config('database.default', 'sqlite')]) . ' extensions not activated', self::class);
// @codeCoverageIgnoreEnd
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function handle(array &$data, \Closure $next): array
['post_max_size is set to ' . ini_get('post_max_size'), 'recommended is at least 100M']);
}
$max_execution_time = intval(ini_get('max_execution_time'));
if (0 < $max_execution_time && $max_execution_time < 200) {
if (config('queue.default', 'sync') === 'sync' && 0 < $max_execution_time && $max_execution_time < 200) {
// @codeCoverageIgnoreStart
$data[] = DiagnosticData::warn('You may experience problems when uploading a photo of large size or handling many/large albums. Take a look in the FAQ for details.', self::class,
['max_execution_time is set to ' . ini_get('max_execution_time'), 'recommended is at least 200 seconds or 0 (no limit)']);
Expand Down
16 changes: 12 additions & 4 deletions app/Actions/Diagnostics/Pipes/Checks/SmallMediumExistsCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,42 +74,50 @@ public function handle(array &$data, \Closure $next): array
)
->selectSub(
SizeVariant::query()
->join('photos', 'size_variants.photo_id', '=', 'photos.id')
->whereLike('photos.type', 'image/%')
->selectRaw('COUNT(*)')
->where(fn ($q) => $q
->when($sv_helpers->getMaxWidth(SizeVariantType::SMALL) !== 0, fn ($q1) => $q1->where('width', '>', $sv_helpers->getMaxWidth(SizeVariantType::SMALL)))
->when($sv_helpers->getMaxHeight(SizeVariantType::SMALL) !== 0, fn ($q2) => $q2->orWhere('height', '>', $sv_helpers->getMaxHeight(SizeVariantType::SMALL)))
)
->where('type', '=', SizeVariantType::ORIGINAL),
->where('size_variants.type', '=', SizeVariantType::ORIGINAL),
self::MAX_NUM_SMALL
)
->selectSub(
SizeVariant::query()
->join('photos', 'size_variants.photo_id', '=', 'photos.id')
->whereLike('photos.type', 'image/%')
->selectRaw('COUNT(*)')
->where(fn ($q) => $q
->when($sv_helpers->getMaxWidth(SizeVariantType::SMALL2X) !== 0, fn ($q1) => $q1->where('width', '>', $sv_helpers->getMaxWidth(SizeVariantType::SMALL2X)))
->when($sv_helpers->getMaxHeight(SizeVariantType::SMALL2X) !== 0, fn ($q2) => $q2->orWhere('height', '>', $sv_helpers->getMaxHeight(SizeVariantType::SMALL2X)))
)
->where('type', '=', SizeVariantType::ORIGINAL),
->where('size_variants.type', '=', SizeVariantType::ORIGINAL),
self::MAX_NUM_SMALL2X
)
->selectSub(
SizeVariant::query()
->join('photos', 'size_variants.photo_id', '=', 'photos.id')
->whereLike('photos.type', 'image/%')
->selectRaw('COUNT(*)')
->where(fn ($q) => $q
->when($sv_helpers->getMaxWidth(SizeVariantType::MEDIUM) !== 0, fn ($q1) => $q1->where('width', '>', $sv_helpers->getMaxWidth(SizeVariantType::MEDIUM)))
->when($sv_helpers->getMaxHeight(SizeVariantType::MEDIUM) !== 0, fn ($q2) => $q2->orWhere('height', '>', $sv_helpers->getMaxHeight(SizeVariantType::MEDIUM)))
)
->where('type', '=', SizeVariantType::ORIGINAL),
->where('size_variants.type', '=', SizeVariantType::ORIGINAL),
self::MAX_NUM_MEDIUM
)
->selectSub(
SizeVariant::query()
->join('photos', 'size_variants.photo_id', '=', 'photos.id')
->whereLike('photos.type', 'image/%')
->selectRaw('COUNT(*)')
->where(fn ($q) => $q
->when($sv_helpers->getMaxWidth(SizeVariantType::MEDIUM2X) !== 0, fn ($q1) => $q1->where('width', '>', $sv_helpers->getMaxWidth(SizeVariantType::MEDIUM2X)))
->when($sv_helpers->getMaxHeight(SizeVariantType::MEDIUM2X) !== 0, fn ($q2) => $q2->orWhere('height', '>', $sv_helpers->getMaxHeight(SizeVariantType::MEDIUM2X)))
)
->where('type', '=', SizeVariantType::ORIGINAL),
->where('size_variants.type', '=', SizeVariantType::ORIGINAL),
self::MAX_NUM_MEDIUM2X
)
->first();
Expand Down
Loading