mirror of
https://github.com/YunoHost-Apps/castopod_ynh.git
synced 2024-09-03 18:16:14 +02:00
commit
48dde51700
10 changed files with 132 additions and 12 deletions
|
@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
|
||||
Hosting platform made for podcasters
|
||||
|
||||
**Shipped version:** 1.0.0-57~ynh2
|
||||
**Shipped version:** 1.0.0-59~ynh1
|
||||
|
||||
**Demo:** https://podcast.podlibre.org/@podlibre_fr
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
|||
|
||||
Plateforme d'hébergement conçue pour les podcasteurs
|
||||
|
||||
**Version incluse :** 1.0.0-57~ynh2
|
||||
**Version incluse :** 1.0.0-59~ynh1
|
||||
|
||||
**Démo :** https://podcast.podlibre.org/@podlibre_fr
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
setup_public=1
|
||||
upgrade=1
|
||||
#1.0.0 alpha.41
|
||||
upgrade=1 from_commit=a43b9e3d66163252d1ea83a2924179ec777056f3
|
||||
upgrade=1 from_commit=63d63028833538443fcfbd0ea2cf0523582fcc24
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
change_url=1
|
||||
|
@ -22,6 +22,6 @@
|
|||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=a43b9e3d66163252d1ea83a2924179ec777056f3
|
||||
name=Merge pull request #24 from YunoHost-Apps/testing
|
||||
; commit=63d63028833538443fcfbd0ea2cf0523582fcc24
|
||||
name=Merge pull request #27 from YunoHost-Apps/testing
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://code.podlibre.org/podlibre/castopod-host/uploads/5efeda3a8aeaa60f8c0b62ba7d1683c7/castopod-host-1.0.0-alpha.57.zip
|
||||
SOURCE_SUM=392d14816d505020708102fb0bb9a3fc77c6f65c0412e5175b3c97b6a44970e5
|
||||
SOURCE_URL=https://code.podlibre.org/podlibre/castopod-host/uploads/ccf11a6321faa946f7411358ec3d379e/castopod-host-.zip
|
||||
SOURCE_SUM=726a8db5a14e07c8403e214c745e89b10868dc0becbb6f422b294b860f2e9813
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
109
conf/upgrade.sql
Normal file
109
conf/upgrade.sql
Normal file
|
@ -0,0 +1,109 @@
|
|||
SET AUTOCOMMIT = 0;
|
||||
START TRANSACTION;
|
||||
|
||||
/* Set category parent_id to be nullable + remove "uncategorized" value */
|
||||
ALTER TABLE `cp_categories` CHANGE `parent_id` `parent_id` INT(10) UNSIGNED NULL DEFAULT NULL;
|
||||
UPDATE `cp_categories` SET parent_id = null WHERE parent_id = 0;
|
||||
DELETE FROM `cp_categories` WHERE id = 0;
|
||||
|
||||
/* rename `location_osmid` to `location_osm` */
|
||||
ALTER TABLE `cp_podcasts` CHANGE `location_osmid` `location_osm` VARCHAR(12) NULL DEFAULT NULL;
|
||||
ALTER TABLE `cp_episodes` CHANGE `location_osmid` `location_osm` VARCHAR(12) NULL DEFAULT NULL;
|
||||
|
||||
/* use more precise DECIMAL type for duration and start time */
|
||||
ALTER TABLE `cp_episodes` CHANGE `audio_file_duration` `audio_file_duration` DECIMAL(8,3) UNSIGNED NOT NULL COMMENT 'Playtime in seconds';
|
||||
ALTER TABLE `cp_soundbites` CHANGE `start_time` `start_time` DECIMAL(8,3) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `cp_soundbites` CHANGE `duration` `duration` DECIMAL(7,3) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `cp_analytics_podcasts` CHANGE `duration` `duration` DECIMAL(15,3) UNSIGNED NOT NULL;
|
||||
|
||||
/* add pages html content in database */
|
||||
ALTER TABLE `cp_pages` CHANGE `content` `content_markdown` TEXT NOT NULL;
|
||||
ALTER TABLE `cp_pages` ADD `content_html` TEXT NOT NULL AFTER `content_markdown`;
|
||||
|
||||
/* Longitude and latitude precision with DECIMAL */
|
||||
ALTER TABLE `cp_soundbites` CHANGE `latitude` `latitude` DECIMAL(8,6) NULL DEFAULT NULL;
|
||||
ALTER TABLE `cp_soundbites` CHANGE `longitude` `longitude` DECIMAL(9,6) NULL DEFAULT NULL;
|
||||
|
||||
/* update analytics procedures */
|
||||
|
||||
DELIMITER //
|
||||
|
||||
DROP PROCEDURE `cp_analytics_podcasts` //
|
||||
CREATE PROCEDURE `cp_analytics_podcasts`(
|
||||
IN `p_podcast_id` INT UNSIGNED,
|
||||
IN `p_episode_id` INT UNSIGNED,
|
||||
IN `p_country_code` VARCHAR(3),
|
||||
IN `p_region_code` VARCHAR(3),
|
||||
IN `p_latitude` DECIMAL(8,6),
|
||||
IN `p_longitude` DECIMAL(9,6),
|
||||
IN `p_service` VARCHAR(128),
|
||||
IN `p_app` VARCHAR(128),
|
||||
IN `p_device` VARCHAR(32),
|
||||
IN `p_os` VARCHAR(32),
|
||||
IN `p_bot` TINYINT(1) UNSIGNED,
|
||||
IN `p_filesize` INT UNSIGNED,
|
||||
IN `p_duration` DECIMAL(8,3) UNSIGNED,
|
||||
IN `p_age` INT UNSIGNED,
|
||||
IN `p_new_listener` TINYINT(1) UNSIGNED
|
||||
) COMMENT 'Add one hit in podcast logs tables.' DETERMINISTIC MODIFIES SQL DATA SQL SECURITY INVOKER
|
||||
BEGIN
|
||||
|
||||
SET @current_datetime = NOW();
|
||||
SET @current_date = DATE(@current_datetime);
|
||||
SET @current_hour = HOUR(@current_datetime);
|
||||
|
||||
IF NOT `p_bot` THEN
|
||||
INSERT INTO `cp_analytics_podcasts`(`podcast_id`, `date`)
|
||||
VALUES (p_podcast_id, @current_date)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`duration`=`duration`+`p_duration`,
|
||||
`bandwidth`=`bandwidth`+`p_filesize`,
|
||||
`hits`=`hits`+1,
|
||||
`unique_listeners`=`unique_listeners`+`p_new_listener`;
|
||||
INSERT INTO `cp_analytics_podcasts_by_hour`(`podcast_id`, `date`, `hour`)
|
||||
VALUES (p_podcast_id, @current_date, @current_hour)
|
||||
ON DUPLICATE KEY UPDATE `hits`=`hits`+1;
|
||||
INSERT INTO `cp_analytics_podcasts_by_episode`(`podcast_id`, `episode_id`, `date`, `age`)
|
||||
VALUES (p_podcast_id, p_episode_id, @current_date, p_age)
|
||||
ON DUPLICATE KEY UPDATE `hits`=`hits`+1;
|
||||
INSERT INTO `cp_analytics_podcasts_by_country`(`podcast_id`, `country_code`, `date`)
|
||||
VALUES (p_podcast_id, p_country_code, @current_date)
|
||||
ON DUPLICATE KEY UPDATE `hits`=`hits`+1;
|
||||
INSERT INTO `cp_analytics_podcasts_by_region`(`podcast_id`, `country_code`, `region_code`, `latitude`, `longitude`, `date`)
|
||||
VALUES (p_podcast_id, p_country_code, p_region_code, p_latitude, p_longitude, @current_date)
|
||||
ON DUPLICATE KEY UPDATE `hits`=`hits`+1;
|
||||
END IF;
|
||||
INSERT INTO `cp_analytics_podcasts_by_player`(`podcast_id`, `service`, `app`, `device`, `os`, `is_bot`, `date`)
|
||||
VALUES (p_podcast_id, p_service, p_app, p_device, p_os, p_bot, @current_date)
|
||||
ON DUPLICATE KEY UPDATE `hits`=`hits`+1;
|
||||
END //
|
||||
|
||||
DROP PROCEDURE `cp_analytics_unknown_useragents` //
|
||||
CREATE PROCEDURE `cp_analytics_unknown_useragents`(IN `p_useragent` VARCHAR(191)) COMMENT 'Add an unknown useragent to table cp_analytics_unknown_useragents.' DETERMINISTIC MODIFIES SQL DATA SQL SECURITY INVOKER INSERT INTO `cp_analytics_unknown_useragents`(`useragent`)
|
||||
VALUES (p_useragent)
|
||||
ON DUPLICATE KEY UPDATE `hits`=`hits`+1 //
|
||||
|
||||
DROP PROCEDURE `cp_analytics_website` //
|
||||
CREATE PROCEDURE `cp_analytics_website`(
|
||||
IN `p_podcast_id` INT UNSIGNED,
|
||||
IN `p_browser` VARCHAR(191),
|
||||
IN `p_entry_page` VARCHAR(512),
|
||||
IN `p_referer_url` VARCHAR(512),
|
||||
IN `p_domain` VARCHAR(128),
|
||||
IN `p_keywords` VARCHAR(384)
|
||||
) COMMENT 'Add one hit in website logs tables.' DETERMINISTIC MODIFIES SQL DATA SQL SECURITY INVOKER BEGIN
|
||||
|
||||
SET @current_date = DATE(NOW());
|
||||
|
||||
INSERT INTO cp_analytics_website_by_browser(`podcast_id`, `browser`, `date`)
|
||||
VALUES (p_podcast_id, p_browser, @current_date)
|
||||
ON DUPLICATE KEY UPDATE `hits`=`hits`+1;
|
||||
INSERT INTO cp_analytics_website_by_referer(`podcast_id`, `referer_url`, `domain`, `keywords`, `date`)
|
||||
VALUES (p_podcast_id, p_referer_url, p_domain, p_keywords, @current_date)
|
||||
ON DUPLICATE KEY UPDATE `hits`=`hits`+1;
|
||||
INSERT INTO cp_analytics_website_by_entry_page(`podcast_id`, `entry_page_url`, `date`)
|
||||
VALUES (p_podcast_id, p_entry_page, @current_date)
|
||||
ON DUPLICATE KEY UPDATE `hits`=`hits`+1;
|
||||
END //
|
||||
|
||||
COMMIT;
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Hosting platform made for podcasters",
|
||||
"fr": "Plateforme d'hébergement conçue pour les podcasteurs"
|
||||
},
|
||||
"version": "1.0.0-57~ynh2",
|
||||
"version": "1.0.0-59~ynh1",
|
||||
"url": "https://podlibre.org/",
|
||||
"upstream": {
|
||||
"license": "GPL-3.0-only",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
YNH_PHP_VERSION="7.3"
|
||||
YNH_PHP_VERSION="8.0"
|
||||
|
||||
extra_php_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mysqlnd"
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
phpversion=$YNH_PHP_VERSION
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
|
|
|
@ -32,7 +32,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
phpversion=$YNH_PHP_VERSION
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
|
@ -75,7 +75,11 @@ chown -R $app:www-data "$final_path"
|
|||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
#ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
|
|
|
@ -21,6 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
phpversion=$YNH_PHP_VERSION
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -92,6 +93,12 @@ chmod 750 "$final_path"
|
|||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DATABASE
|
||||
#=================================================
|
||||
|
||||
#ynh_mysql_execute_file_as_root --file=../conf/upgrade.sql --database=$db_name
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue