diff --git a/README.md b/README.md index d8f1ab45b..1c371579e 100644 --- a/README.md +++ b/README.md @@ -56,12 +56,12 @@ install script that the web service process has write permissions to. ### Option 2: Environment Variables Instead of using the `includes/settings.php` file for your settings, you can use environment -variables instead. +variables instead. This is primarily targeted towards those running WebCalendar in containers (docker, AWS Fargate, etc) -where it's easier to pass in environment settings than to write to a config file on a container. +where it's easier to pass in environment settings than to write to a config file on a container. You can do this with the docker-compose file if you are using docker. If you want to do this with a standard Web Server, -you can set the evironment variables within your web server's configuration. +you can set the evironment variables within your web server's configuration. Depending on your web server, there may be more than one way to do this. You could do this in your `php.ini` file, but those env vars would be available to all PHP apps on the server. A better solution would be to setup a `.htaccess` file in your @@ -93,19 +93,6 @@ and MariaDb running that is setup with the `docker-compose` command. - Start the containers: `docker-compose -f docker/docker-compose-php8.yml up` -- In order to grant the proper permissions inside of MariaDb, you - will need to run a few MySQL commands. First shell into the mariadb - container: `docker-compose -f docker/docker-compose-php8.yml exec db /bin/sh` -- Start up the db client: `/bin/mariadb -p` (the password will be - "Webcalendar.1" as specified in the `docker-compose-php8.yml' file. You - can change it to make your dev environment more secure (before you - build the containers in step above). -- Run the following db commands: - ``` - GRANT ALL PRIVILEGES ON *.* TO webcalendar_php8@localhost IDENTIFIED BY 'Webcalendar.1' WITH GRANT OPTION; - FLUSH PRIVILEGES; - QUIT - ``` - Start up your web browser and go to: [http://localhost:8080/](http://localhost:8080/). - Follow the guided web-based setup and choose "mysqli" as the database @@ -125,19 +112,6 @@ files in the container. `docker-compose -f docker/docker-compose-php8-dev.yml build` - Start the containers with `docker-compose -f docker/docker-compose-php8-dev.yml up` -- In order to grant the proper permissions inside of MariaDb, you - will need to run a few MySQL commands. First shell into the mariadb - container: `docker-compose -f docker/docker-compose-php8-dev.yml exec db /bin/sh` -- Start up the db client: `/bin/mariadb -p` (the password will be - "Webcalendar.1" as specified in the `docker-compose-php8-dev.yml' file. You - can change it to make your dev environment more secure (before you - build the containers in step above). -- Run the following db commands: - ``` - GRANT ALL PRIVILEGES ON *.* TO webcalendar_php8@localhost IDENTIFIED BY 'Webcalendar.1' WITH GRANT OPTION; - FLUSH PRIVILEGES; - QUIT - ``` - Start up your web browser and go to: [http://localhost:8080/](http://localhost:8080/). - Follow the guided web-based setup and choose "mysqli" as the database diff --git a/category_handler.php b/category_handler.php index 4d030ad29..e296f3703 100644 --- a/category_handler.php +++ b/category_handler.php @@ -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(); diff --git a/docker/docker-compose-php8-dev.yml b/docker/docker-compose-php8-dev.yml index 9586cf590..50a679834 100644 --- a/docker/docker-compose-php8-dev.yml +++ b/docker/docker-compose-php8-dev.yml @@ -1,21 +1,7 @@ -# Run docker-compose from the top-level WebCalendar directory and not from this "docker" subdirectory. -# The first time you run this, you will need to grant permission -# for the webcalendar user to access mariadb (after you have run -# 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-mariadb /bin/sh -# Start the mariadb client: -# /bin/mariadb -p -# (enter the MYSQL_ROOT_PASSWORD below) -# Execute the following three db commands: -# GRANT ALL PRIVILEGES ON *.* TO webcalendar@localhost IDENTIFIED BY 'Webcalendar.1' WITH GRANT OPTION; -# FLUSH PRIVILEGES; -# QUIT -# +# Run docker compose from the top-level WebCalendar directory and not from this "docker" subdirectory. # 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-mariadb /bin/sh +# docker compose -f docker/docker-compose-php8-dev.yml exec webcalendar-php8-mariadb /bin/sh version: '3.1' @@ -27,6 +13,17 @@ services: volumes: - mysql-data:/var/lib/mysql - /etc/localtime:/etc/localtime:ro + # install sql at start + # To test the installer's built-in installer, comment this out +# - type: bind +# source: ../install/sql/tables-mysql.sql +# target: /docker-entrypoint-initdb.d/tables-mysql.sql + # Set mariadb access policy + # NOTE: The specified SQL needs to match the password specified + # in the ENV vars listed below. + - type: bind + source: ../install/sql/permissions-mysql.sql + target: /docker-entrypoint-initdb.d/permissions-mysql.sql environment: - MYSQL_ROOT_PASSWORD=Webcalendar.1 - MYSQL_PASSWORD=Webcalendar.1 @@ -84,7 +81,7 @@ services: - WEBCALENDAR_MODE=dev # To access the pgsql command line: - # docker-compose -f docker/docker-compose-php8-dev.yml exec db-pgsql /bin/bash + # 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: diff --git a/docker/docker-compose-php8.yml b/docker/docker-compose-php8.yml index dcb92487d..6919ecf4c 100644 --- a/docker/docker-compose-php8.yml +++ b/docker/docker-compose-php8.yml @@ -1,21 +1,7 @@ -# Run docker-compose from the top-level WebCalendar directory and not from this "docker" subdirectory. -# The first time you run this, you will need to grant permission -# for the webcalendar user to access mariadb (after you have run -# docker-compose up). You only need to do this once. -# -# Start a shell on the mariadb container: -# docker-compose -f docker/docker-compose-php8.yml exec db /bin/sh -# Start the mariadb client: -# /bin/mariadb -p -# (enter the MYSQL_ROOT_PASSWORD below) -# Execute the following three db commands: -# GRANT ALL PRIVILEGES ON *.* TO webcalendar@localhost IDENTIFIED BY 'Webcalendar.1' WITH GRANT OPTION; -# FLUSH PRIVILEGES; -# QUIT -# +# Run docker compose from the top-level WebCalendar directory and not from this "docker" subdirectory. # If you need shell access on the webserver container running WebCalendar, you can use # the following command: -# docker-compose -f docker/docker-compose-php8.yml exec webcalendar-php8 /bin/sh +# docker compose -f docker/docker-compose-php8.yml exec webcalendar-php8 /bin/sh version: '3.1' @@ -27,6 +13,17 @@ services: volumes: - mysql-data:/var/lib/mysql - /etc/localtime:/etc/localtime:ro + # install sql at start + # To test the installer's built-in installer, comment this out + - type: bind + source: ../install/sql/tables-mysql.sql + target: /docker-entrypoint-initdb.d/tables-mysql.sql + # Set mariadb access policy + # NOTE: The specified SQL needs to match the password specified + # in the ENV vars listed below. + - type: bind + source: ../install/sql/permissions-mysql.sql + target: /docker-entrypoint-initdb.d/permissions-mysql.sql environment: - MYSQL_ROOT_PASSWORD=Webcalendar.1 - MYSQL_PASSWORD=Webcalendar.1 diff --git a/docs/WebCalendar-UserManual.html b/docs/WebCalendar-UserManual.html index ea2c6c0d5..3cb38f8e9 100644 --- a/docs/WebCalendar-UserManual.html +++ b/docs/WebCalendar-UserManual.html @@ -7,7 +7,7 @@

WebCalendar User Manual

-

WebCalendar Version: 1.9.9

+

WebCalendar Version: 1.9.12

Table of Contents