Skip to content

Commit

Permalink
Merge branch 'craigk5n:master' into xact
Browse files Browse the repository at this point in the history
  • Loading branch information
bbannon authored Jan 24, 2024
2 parents b7f7817 + 0e4c04e commit d5e2caf
Show file tree
Hide file tree
Showing 19 changed files with 345 additions and 143 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
Expand Down
2 changes: 1 addition & 1 deletion category_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function updateIconBlob($catId, $iconData, $iconMimeType) {
if (!dbi_execute(
'DELETE FROM webcal_entry_categories
WHERE cat_id = ? AND ( cat_owner = ?'
. ($is_admin ? ' OR cat_owner = "" )' : ' )'),
. ($is_admin ? ' OR cat_owner = '' )' : ' )'),
[$id, $login]
)) {
$error = db_error();
Expand Down
76 changes: 39 additions & 37 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions docker/Dockerfile-php8-dev
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ LABEL vendor="k5n.us"
# Install mysqli extension
RUN docker-php-ext-install mysqli

# Install PosgreSQL extension and dependencies
RUN apt-get update && apt-get install -y libpq-dev \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-install pgsql pdo_pgsql

# Install GD extension and its dependencies
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
Expand Down
55 changes: 47 additions & 8 deletions docker/docker-compose-php8-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# docker-compose up). You only need to do this once.
#
# Start a shell on the mariadb container:
# docker-compose -f docker/docker-compose-php8-dev.yml exec db /bin/sh
# docker-compose -f docker/docker-compose-php8-dev.yml exec db-mariadb /bin/sh
# Start the mariadb client:
# /bin/mariadb -p
# (enter the MYSQL_ROOT_PASSWORD below)
Expand All @@ -15,15 +15,15 @@
#
# If you need shell access on the webserver container running WebCalendar, you can use
# the following command:
# docker-compose -f docker/docker-compose-php8-dev.yml exec webcalendar-php8 /bin/sh
# docker-compose -f docker/docker-compose-php8-dev.yml exec webcalendar-php8-mariadb /bin/sh

version: '3.1'

services:

db:
db-mariadb:
image: mariadb
container_name: webcalendar-db
container_name: webcalendar-maria-db
volumes:
- mysql-data:/var/lib/mysql
- /etc/localtime:/etc/localtime:ro
Expand All @@ -34,12 +34,12 @@ services:
- MYSQL_USER=webcalendar
restart: unless-stopped

webcalendar-php8:
webcalendar-php8-mariadb:
build:
context: ../
dockerfile: docker/Dockerfile-php8-dev
depends_on:
- db
- db-mariadb
ports:
- 8080:80
volumes:
Expand All @@ -56,10 +56,49 @@ services:
- WEBCALENDAR_DB_DATABASE=webcalendar_php8
- WEBCALENDAR_DB_LOGIN=webcalendar
- WEBCALENDAR_DB_PASSWORD=Webcalendar.1
- WEBCALENDAR_DB_HOST=db
- WEBCALENDAR_DB_HOST=db-mariadb
- WEBCALENDAR_DB_PERSISTENT=true
- WEBCALENDAR_USER_INC=user.php
- WEBCALENDAR_MODE=dev

webcalendar-php8-pgsql:
build:
context: ../
dockerfile: docker/Dockerfile-php8-dev
depends_on:
- db-pgsql
ports:
- 8081:80
volumes:
- ..:/var/www/html/
environment:
- WEBCALENDAR_USE_ENV=true
- WEBCALENDAR_INSTALL_PASSWORD=da1437a2c74ee0b35eed71e27d00c618
- WEBCALENDAR_DB_TYPE=postgresql
- WEBCALENDAR_DB_DATABASE=webcalendar_php81
- WEBCALENDAR_DB_LOGIN=webcalendar
- WEBCALENDAR_DB_PASSWORD=Webcalendar.1 # Change this
- WEBCALENDAR_DB_HOST=db-pgsql
- WEBCALENDAR_DB_PERSISTENT=true
- WEBCALENDAR_USER_INC=user.php
- WEBCALENDAR_MODE=dev

# To access the pgsql command line:
# docker-compose -f docker/docker-compose-php8-dev.yml exec db-pgsql /bin/bash
# Before the webcalendar db is created:
# psql -h localhost -p 5432 -U webcalendar -W -d postgres
db-pgsql:
image: postgres
container_name: webcalendar-db-pgsql
volumes:
- pgsql-data:/var/lib/postgresql/data
- /etc/localtime:/etc/localtime:ro
environment:
- POSTGRES_DB=webcalendar_php81
- POSTGRES_USER=webcalendar
- POSTGRES_PASSWORD=Webcalendar.1 # Change this
restart: unless-stopped

volumes:
mysql-data:
mysql-data: # MySQL/Maria data volume for persistence
pgsql-data: # PostgreSQL data volume for persistence
2 changes: 1 addition & 1 deletion edit_entry_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ function sort_byday( $a, $b ) {
$cat_owner = ( ( ! empty( $user ) && strlen( $user ) )
&& ( $is_assistant || $is_admin ) ? $user : $login );
dbi_execute( 'DELETE FROM webcal_entry_categories WHERE cal_id = ?
AND ( cat_owner = ? OR cat_owner = "" )', [$id, $cat_owner] );
AND ( cat_owner = ? OR cat_owner = ? )', [$id, $cat_owner, ''] );

if( ! empty( $cat_id ) ) {
$categories = explode( ',', $cat_id );
Expand Down
Loading

0 comments on commit d5e2caf

Please sign in to comment.