Skip to content

Commit

Permalink
Merge pull request #879 from biigle/laravel-11
Browse files Browse the repository at this point in the history
Upgrade to Laravel 11
  • Loading branch information
mzur authored Sep 2, 2024
2 parents 2cb3cc7 + 9a89156 commit 20afdfc
Show file tree
Hide file tree
Showing 183 changed files with 2,574 additions and 3,547 deletions.
12 changes: 6 additions & 6 deletions .docker/app.dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# PHP 8.1.13
#FROM php:8.1-fpm-alpine
FROM php@sha256:88407bcb4821e7a9da273d9dad746e1f795e9a6480d9cba5ba502d7836e23718
MAINTAINER Martin Zurowietz <martin@cebitec.uni-bielefeld.de>
LABEL org.opencontainers.image.source https://github.com/biigle/core
# PHP 8.2.21
#FROM php:8.2-fpm-alpine
FROM php@sha256:95c34aeeef07aa9774e0b70d5b70065ab0647ece183ebe007c5f2e6b5db16725
LABEL org.opencontainers.image.authors="Martin Zurowietz <m.zurowietz@uni-bielefeld.de>"
LABEL org.opencontainers.image.source="https://github.com/biigle/core"

RUN ln -s "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
ADD ".docker/all-php.ini" "$PHP_INI_DIR/conf.d/all.ini"
Expand Down Expand Up @@ -37,7 +37,7 @@ RUN apk add --no-cache yaml \
# Unset proxy configuration again.
RUN [ -z "$HTTP_PROXY" ] || pear config-set http_proxy ""

ARG PHPREDIS_VERSION=5.3.7
ARG PHPREDIS_VERSION=6.0.2
RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/${PHPREDIS_VERSION}.tar.gz \
&& tar -xzf /tmp/redis.tar.gz \
&& rm /tmp/redis.tar.gz \
Expand Down
4 changes: 2 additions & 2 deletions .docker/web.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# FROM nginx:1.21-alpine
FROM nginx@sha256:5a0df7fb7c8c03e4158ae9974bfbd6a15da2bdfdeded4fb694367ec812325d31
MAINTAINER Martin Zurowietz <martin@cebitec.uni-bielefeld.de>
LABEL org.opencontainers.image.source https://github.com/biigle/core
LABEL org.opencontainers.image.authors="Martin Zurowietz <m.zurowietz@uni-bielefeld.de>"
LABEL org.opencontainers.image.source="https://github.com/biigle/core"

ADD .docker/vhost.conf /etc/nginx/conf.d/default.conf
ADD .docker/ffdhe2048.txt /etc/nginx/conf.d/ffdhe2048.txt
Expand Down
31 changes: 14 additions & 17 deletions .docker/worker.dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# PHP 8.1.27
# FROM php:8.1
FROM php@sha256:9b5dfb7deef3e48d67b2599e4d3967bb3ece19fd5ba09cb8e7ee10f5facf36e0
MAINTAINER Martin Zurowietz <martin@cebitec.uni-bielefeld.de>
LABEL org.opencontainers.image.source https://github.com/biigle/core
# PHP 8.2.21
# FROM php:8.2
FROM php@sha256:a61daae986bdf9bbeff9a514e3598a4f72bb2e3d01a0b3d0eff960bbfe85acdf
LABEL org.opencontainers.image.authors="Martin Zurowietz <m.zurowietz@uni-bielefeld.de>"
LABEL org.opencontainers.image.source="https://github.com/biigle/core"

RUN LC_ALL=C.UTF-8 apt-get update \
&& apt-get install -y --no-install-recommends \
Expand All @@ -21,16 +21,21 @@ RUN LC_ALL=C.UTF-8 apt-get update \

RUN ln -s "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
ADD ".docker/all-php.ini" "$PHP_INI_DIR/conf.d/all.ini"
# Enable FFI for jcupitt/vips.
# See: https://github.com/libvips/php-vips?tab=readme-ov-file#install
RUN echo "ffi.enable = true" > "$PHP_INI_DIR/conf.d/vips.ini"

RUN LC_ALL=C.UTF-8 apt-get update \
&& apt-get install -y --no-install-recommends \
libxml2-dev \
libzip-dev \
libpq-dev \
libffi-dev \
&& apt-get install -y --no-install-recommends \
libxml2 \
libzip4 \
postgresql-client \
libffi8 \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/bin/pgsql \
&& docker-php-ext-install -j$(nproc) \
exif \
Expand All @@ -40,10 +45,12 @@ RUN LC_ALL=C.UTF-8 apt-get update \
pgsql \
soap \
zip \
ffi \
&& apt-get purge -y \
libxml2-dev \
libzip-dev \
libpq-dev \
libffi-dev \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*
Expand All @@ -64,26 +71,16 @@ RUN LC_ALL=C.UTF-8 apt-get update \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*

ARG PHPREDIS_VERSION=5.3.7
ARG PHPREDIS_VERSION=6.0.2
RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/${PHPREDIS_VERSION}.tar.gz \
&& tar -xzf /tmp/redis.tar.gz \
&& rm /tmp/redis.tar.gz \
&& mkdir -p /usr/src/php/ext \
&& mv phpredis-${PHPREDIS_VERSION} /usr/src/php/ext/redis \
&& docker-php-ext-install -j$(nproc) redis

# ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}"

RUN LC_ALL=C.UTF-8 apt-get update \
&& apt-get install -y --no-install-recommends \
libvips-dev \
&& apt-get install -y --no-install-recommends \
libvips42 \
&& pecl install vips \
&& docker-php-ext-enable vips \
&& apt-get purge -y \
libvips-dev \
&& apt-get -y autoremove \
&& apt-get install -y --no-install-recommends libvips42 \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*

Expand Down
30 changes: 23 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ APP_DEBUG=true
APP_URL="http://localhost:8000"
APP_TIMEZONE="Europe/Berlin"

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database

BCRYPT_ROUNDS=12

LOG_CHANNEL=single
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

Expand Down Expand Up @@ -40,23 +50,29 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
#HTTP_PROXY=host:port

# normally you don't have to edit these
CACHE_DRIVER="file"
FILESYSTEM_DISK=local
SESSION_DRIVER="file"
SESSION_LIFETIME=120
SESSION_SECURE_COOKIE=false
QUEUE_CONNECTION="database"
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=file
CACHE_PREFIX=

MEMCACHED_HOST=127.0.0.1

REDIS_CLIENT=phpredis
REDIS_HOST="127.0.0.1"
REDIS_PASSWORD=null
REDIS_PORT=6379

# see config/mail.php for what drivers are available
# default is the PHP mail function which doesn't require any credentials
MAIL_MAILER="log"
MAIL_HOST="smtp.mailtrap.io"
MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'

- uses: actions/checkout@v1
with:
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Set testing key
run: echo "APP_KEY=base64:STZFA4bQKDjE2mlpRPmsJ/okG0eCh4RHd9BghtZeYmQ=" >> .env

- name: Run Psalm
- name: Run Linter
run: composer lint

cs-php:
Expand All @@ -61,7 +61,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
tools: cs2pr

- uses: actions/checkout@v1
Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
->ignoreVCS(true);

return (new PhpCsFixer\Config())
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRules([
'@PSR2' => true,
'ordered_imports' => true,
Expand Down
21 changes: 13 additions & 8 deletions app/Annotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
/**
* An image annotation is a region of an image that can be labeled by the users.
* It consists of one or many points and has a specific shape.
*
* @property int $id
* @property array $points
* @property string $created_at
* @property int $shape_id
*/
abstract class Annotation extends Model implements AnnotationContract
{
Expand All @@ -19,7 +24,7 @@ abstract class Annotation extends Model implements AnnotationContract
/**
* The attributes excluded from the model's JSON form.
*
* @var array
* @var array<int, string>
*/
protected $hidden = [
'pivot',
Expand All @@ -28,7 +33,7 @@ abstract class Annotation extends Model implements AnnotationContract
/**
* The attributes that should be casted to native types.
*
* @var array
* @var array<string, string>
*/
protected $casts = [
'points' => 'array',
Expand All @@ -40,7 +45,7 @@ abstract class Annotation extends Model implements AnnotationContract
* @param \Illuminate\Database\Query\Builder $query
* @param User $user The user to whom the restrictions should apply ('own' user)
*
* @return \Illuminate\Database\Eloquent\Builder
* @return \Illuminate\Database\Query\Builder
*/
public function scopeVisibleFor($query, User $user)
{
Expand Down Expand Up @@ -73,7 +78,7 @@ public function scopeVisibleFor($query, User $user)
* @param \Illuminate\Database\Query\Builder $query
* @param Label $label
*
* @return \Illuminate\Database\Eloquent\Builder
* @return \Illuminate\Database\Query\Builder
*/
public function scopeWithLabel($query, Label $label)
{
Expand All @@ -93,7 +98,7 @@ public function scopeWithLabel($query, Label $label)
* @param \Illuminate\Database\Query\Builder $query
* @param AnnotationSession $session
* @param User $user The user to whom the restrictions should apply ('own' user)
* @return \Illuminate\Database\Eloquent\Builder
* @return \Illuminate\Database\Query\Builder
*/
public function scopeAllowedBySession($query, AnnotationSession $session, User $user)
{
Expand Down Expand Up @@ -153,14 +158,14 @@ public function scopeAllowedBySession($query, AnnotationSession $session, User $
/**
* The file, this annotation belongs to.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<covariant VolumeFile, covariant Annotation>
*/
abstract public function file();

/**
* The labels, this annotation got assigned by the users.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
* @return \Illuminate\Database\Eloquent\Relations\HasMany<covariant AnnotationLabel>
*/
abstract public function labels();

Expand All @@ -174,7 +179,7 @@ abstract public function getFileIdAttribute();
/**
* The shape of this annotation.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<Shape, Annotation>
*/
public function shape()
{
Expand Down
16 changes: 11 additions & 5 deletions app/AnnotationLabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

/**
* @property int $id
* @property int $annotation_id
* @property int $user_id
* @property int $label_id
*/
abstract class AnnotationLabel extends Model
{
use HasFactory;

/**
* The attributes that are mass assignable.
*
* @var array
* @var array<int, string>
*/
protected $fillable = [
'label_id',
Expand All @@ -23,7 +29,7 @@ abstract class AnnotationLabel extends Model
/**
* The attributes that should be casted to native types.
*
* @var array
* @var array<string, string>
*/
protected $casts = [
'user_id' => 'int',
Expand All @@ -33,14 +39,14 @@ abstract class AnnotationLabel extends Model
/**
* The annotation, this annotation label belongs to.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<covariant Annotation, covariant AnnotationLabel>
*/
abstract public function annotation();

/**
* The label, this annotation label belongs to.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<Label, covariant AnnotationLabel>
*/
public function label()
{
Expand All @@ -50,7 +56,7 @@ public function label()
/**
* The user who created this annotation label.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<User, covariant AnnotationLabel>
*/
public function user()
{
Expand Down
12 changes: 6 additions & 6 deletions app/AnnotationSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AnnotationSession extends Model
/**
* The attributes that should be casted to native types.
*
* @var array
* @var array<string, string>
*/
protected $casts = [
'starts_at' => 'datetime',
Expand All @@ -31,7 +31,7 @@ class AnnotationSession extends Model
/**
* The accessors to append to the model's array form.
*
* @var array
* @var array<int, string>
*/
protected $appends = [
'starts_at_iso8601',
Expand All @@ -41,7 +41,7 @@ class AnnotationSession extends Model
/**
* The volume, this annotation session belongs to.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<Volume, AnnotationSession>
*/
public function volume()
{
Expand All @@ -51,7 +51,7 @@ public function volume()
/**
* The users, this annotation session is restricted to.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<User>
*/
public function users()
{
Expand All @@ -65,7 +65,7 @@ public function users()
* @param VolumeFile $file The file to get the annotations from
* @param User $user The user to whom the restrictions should apply ('own' user)
*
* @return \Illuminate\Support\Collection
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getVolumeFileAnnotations(VolumeFile $file, User $user)
{
Expand Down Expand Up @@ -113,7 +113,7 @@ public function getVolumeFileAnnotations(VolumeFile $file, User $user)
*
* This is **not** an Eloquent relation!
*
* @return \Illuminate\Database\Eloquent\Builder
* @return \Illuminate\Database\Eloquent\Builder<ImageAnnotation>|\Illuminate\Database\Eloquent\Builder<VideoAnnotation>
*/
public function annotations()
{
Expand Down
Loading

0 comments on commit 20afdfc

Please sign in to comment.