1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/castopod_ynh.git synced 2024-09-03 18:16:14 +02:00

Version 1.6.5 take 2 (#109)

* Fix install and upgrade behaviour.

* Properly seed database.

* Fixup $data_dir permissions.

* Serve contents of media directory.

* Fully replace sources during upgrade.

* Fixed typo.

* Run more migrations.

* More escaping?

* Fix paths.

* Fix usage of mv

* Update install

* Update install

* Update upgrade

* Update v1.5.2.sql

* Update v1.6.1.sql

* Update upgrade

* Allow login with credentials from old versions.

* Rename a file as it should be named

* Update paths in patch.
This commit is contained in:
Mateusz 2023-10-31 20:38:00 +01:00 committed by GitHub
parent 48d0094b80
commit b6634f3a3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 70 additions and 3 deletions

View file

@ -24,3 +24,8 @@ location __PATH__/ {
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}
location ^~ /media/ {
alias __DATA_DIR__/media/;
more_set_headers "Access-Control-Allow-Origin: *";
}

14
conf/sql/v1.5.2.sql Normal file
View file

@ -0,0 +1,14 @@
-- change Twitter to X
INSERT IGNORE INTO `cp_platforms` (`slug`, `type`, `label`, `home_url`, `submit_url`) VALUES
('x', 'social', 'X', 'https://x.com/', 'https://x.com/i/flow/signup');
UPDATE `cp_podcasts_platforms`
SET `platform_slug` = 'x'
WHERE `platform_slug` = 'twitter';
DELETE FROM `cp_platforms` WHERE `slug` = 'twitter';
-- add buymeacoffee and kofi as funding platforms
INSERT IGNORE INTO `cp_platforms` (`slug`, `type`, `label`, `home_url`, `submit_url`) VALUES
('buymeacoffee', 'funding', 'Buy Me a Coffee', 'https://www.buymeacoffee.com/', 'https://www.buymeacoffee.com/signup'),
('kofi', 'funding', 'Ko-fi', 'https://ko-fi.com/', 'https://ko-fi.com/account/register');

2
conf/sql/v1.6.1.sql Normal file
View file

@ -0,0 +1,2 @@
INSERT IGNORE INTO `cp_platforms` (`slug`, `type`, `label`, `home_url`, `submit_url`) VALUES
('tiktok', 'social', 'Tiktok', 'https://www.tiktok.com/', 'https://www.tiktok.com/signup');

View file

@ -69,13 +69,21 @@ ynh_add_config --template=".env.example" --destination="$install_dir/.env"
chmod 600 $install_dir/.env
chown $app:www-data "$install_dir/.env"
mkdir -p $data_dir/media
cp -rf $install_dir/public/media/* $data_dir/media
chmod -R 750 $data_dir
chgrp -R www-data $data_dir
ynh_secure_remove --file="$install_dir/public/media"
#=================================================
# RUN MIGRATIONS
#=================================================
ynh_script_progression --message="Configuring $app database..." --weight=1
pushd $install_dir
ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark migrate --all
ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark castopod:database-update
ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark db:seed AppSeeder
popd
#=================================================

View file

@ -38,6 +38,24 @@ if [ -z "${fpm_usage:-}" ]; then
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
fi
#=================================================
# MOVE DATA TO __DATA_DIR__
#=================================================
if ynh_compare_current_package_version --comparison le --version "1.1.2~ynh2"; then
ynh_script_progression --message="Moving data..." --weight=3
mkdir -p $data_dir/media
cp -rf $install_dir/public/media/* $data_dir/media
chmod -R 750 $data_dir
chgrp -R www-data $data_dir
ynh_secure_remove --file="$install_dir/public/media"
ynh_script_progression --message="Fixing migrations..." --weight=1
# this will fail is `cp-install` was not run on prev version - just ignore, DB schema is (re)generated later.
ynh_mysql_execute_as_root --database=$db_name --sql="UPDATE cp_migrations SET class='Media\\\\Database\\\\Migrations\\\\AddMedia', namespace='Media' where class='App\\\\Database\\\\Migrations\\\\AddMedia'" || true
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -47,7 +65,7 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep=".env public/media"
ynh_setup_source --dest_dir="$install_dir" --full_replace=1
fi
chmod -R o-rwx "$install_dir"
@ -85,9 +103,17 @@ chown $app:www-data "$install_dir/.env"
ynh_script_progression --message="Configuring $app database..." --weight=1
pushd $install_dir
ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark migrate --all
ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark cache:clear
ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark castopod:database-update
popd
if ynh_compare_current_package_version --comparison le --version "1.6.5~ynh1"; then
# cf https://code.castopod.org/adaures/castopod/-/releases/v1.5.2
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.5.2.sql"
# cf https://code.castopod.org/adaures/castopod/-/releases/v1.6.1
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "../conf/sql/v1.6.1.sql"
fi
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -0,0 +1,12 @@
diff -ruN castopod.old/vendor/codeigniter4/shield/src/Config/Auth.php castopod/vendor/codeigniter4/shield/src/Config/Auth.php
--- castopod.old/vendor.old/codeigniter4/shield/src/Config/Auth.php 2023-10-31 13:05:34
+++ castopod/vendor/codeigniter4/shield/src/Config/Auth.php 2023-10-31 12:57:04
@@ -375,7 +375,7 @@
*
* @deprecated This is only for backward compatibility.
*/
- public bool $supportOldDangerousPassword = false;
+ public bool $supportOldDangerousPassword = true;
/**
* ////////////////////////////////////////////////////////////////////