1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/limesurvey_ynh.git synced 2024-09-03 19:36:32 +02:00

More example_ynh

This commit is contained in:
yalh76 2022-06-16 00:33:32 +02:00
parent a82b7f0de4
commit ebeacbc5f9
6 changed files with 33 additions and 27 deletions

View file

@ -2,5 +2,6 @@ SOURCE_URL=https://github.com/LimeSurvey/LimeSurvey/archive/refs/tags/5.2.6+2112
SOURCE_SUM=d097af55794000d87ad8f88698597f6cba2e972499819d3f4bd55748f1de1765
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=limesurvey.tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -28,10 +28,10 @@ return array(
'db' => array(
'connectionString' => 'mysql:host=localhost;port=3306;dbname=__DB_NAME__;',
'emulatePrepare' => true,
'username' => '__DB_NAME__',
'username' => '__DB_USER__',
'password' => '__DB_PWD__',
'charset' => 'utf8mb4',
'tablePrefix' => 'lime_',
'tablePrefix' => '__PREFIX__',
),
'emcache' => array('class' => 'CFileCache'),
@ -65,7 +65,7 @@ return array(
// 'use_asset_manager'=>true, // Uncomment if you want to use debug mode and asset manager at the same time
'enableLdap' => true,
'force_ssl' => true,
'uploaddir' => '__DATADIR__'
'uploaddir' => '__DATADIR__/upload'
)
);
/* End of file config.php */

View file

@ -1,12 +1,12 @@
UPDATE lime_plugins SET active=1 WHERE name="AuthLDAP";
UPDATE __PREFIX__plugins SET active=1 WHERE name="AuthLDAP";
INSERT INTO `lime_permissions` (`id`, `entity`, `entity_id`, `uid`, `permission`, `create_p`, `read_p`, `update_p`, `delete_p`, `import_p`, `export_p`) VALUES
INSERT INTO `__PREFIX__permissions` (`id`, `entity`, `entity_id`, `uid`, `permission`, `create_p`, `read_p`, `update_p`, `delete_p`, `import_p`, `export_p`) VALUES
(2,'global',0,2,'auth_ldap',0,1,0,0,0,0),
(3,'global',0,2,'surveys',1,0,0,0,0,0);
INSERT INTO `lime_plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key`, `value`) VALUES
INSERT INTO `__PREFIX__plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key`, `value`) VALUES
(2, 5, NULL, NULL, 'server', '\"ldap:\\/\\/localhost\"'),
(3, 5, NULL, NULL, 'ldapport', '\"\"'),
(4, 5, NULL, NULL, 'ldapversion', '\"3\"'),
@ -35,6 +35,6 @@ INSERT INTO `lime_plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key
#(24, 7, NULL, NULL, 'serverkey', '"REMOTE_USER"'),
#(25, 7,NULL,NULL,'is_default','\"1\"');
INSERT INTO `lime_settings_global` VALUES
INSERT INTO `__PREFIX__settings_global` VALUES
('defaultlang','__LANGUAGE__'),
('AssetsVersion','30214');

View file

@ -32,6 +32,8 @@ is_admin_public=$YNH_APP_ARG_IS_ADMIN_PUBLIC
app=$YNH_APP_INSTANCE_NAME
prefix=lime_
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
@ -52,6 +54,7 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=prefix --value=$prefix
#=================================================
# STANDARD MODIFICATIONS
@ -92,9 +95,6 @@ ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod 750 "$final_path/tmp"
chmod 750 "$final_path/upload"
chmod 750 "$final_path/application/config/"
#=================================================
# PHP-FPM CONFIGURATION
@ -120,15 +120,16 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Creating a data directory..." --weight=1
datadir=/home/yunohost.app/limesurvey/upload
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir
mkdir -p $datadir/upload
# Remove upload if empty
rmdir $datadir 2> /dev/null && mv "$final_path/upload" $datadir || true
chown -R $app:www-data "$datadir"
chmod -R o-rwx "$datadir"
ln -s $datadir $final_path/upload 2> /dev/null || true
chown -R $app:www-data "$datadir"
ln -s $datadir/upload $final_path/upload 2> /dev/null || true
#=================================================
# ADD A CONFIGURATION
@ -154,7 +155,7 @@ mail=$(ynh_user_get_info --username="$admin" --key="mail")
ynh_exec_as "$app" php$phpversion $ls_cli install "$admin" "$password" "$fullname" "$mail"
# Permission should be correctly set before to do this
#ynh_exec_as "$app" php $ls_cli install "$admin" "$(ynh_string_random 24)" "$fullname" "$mail"
#ynh_exec_as "$app" php$phpversion $ls_cli install "$admin" "$(ynh_string_random 24)" "$fullname" "$mail"
#=================================================
# LOAD SQL SPECIFIC CONFIG

View file

@ -34,7 +34,6 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
admin=$(ynh_app_setting_get --app=$app --key=admin)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -64,21 +63,20 @@ ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod 755 "$final_path/tmp"
chmod 755 "$final_path/application/config/"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring data directory..." --weight=2
ynh_script_progression --message="Restoring the data directory..." --weight=2
# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup.
ynh_restore_file --origin_path="$datadir" --not_mandatory
mkdir -p "$datadir"
mkdir -p "$datadir/upload"
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
ln -s $datadir $final_path/upload 2> /dev/null || true
ln -s $datadir/upload $final_path/upload 2> /dev/null || true
#=================================================
# SPECIFIC RESTORATION

View file

@ -68,6 +68,12 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# If prefix doesn't exist, create it
if [ -z "$prefix" ]; then
prefix="lime_"
ynh_app_setting_set --app=$app --key=prefix --value=$prefix
fi
# If datadir doesn't exist, create it
if [ -z "$datadir" ]; then
datadir=/home/yunohost.app/$app/upload
@ -77,7 +83,7 @@ if [ -z "$datadir" ]; then
rmdir $datadir 2> /dev/null && mv "$final_path/upload" $datadir || true
chown -R $app:www-data "$datadir"
chmod -R o-rwx "$datadir"
ln -s $datadir $final_path/upload
ln -s $datadir/upload $final_path/upload
fi
# Cleaning legacy permissions
@ -131,7 +137,7 @@ chmod 750 "$final_path/tmp"
chmod 750 "$final_path/application/config/"
chown -R $app:www-data "$datadir"
chmod 750 $datadir
ln -s $datadir $final_path/upload 2> /dev/null || true
ln -s $datadir/upload $final_path/upload 2> /dev/null || true
#=================================================
# UPGRADE DEPENDENCIES
@ -174,7 +180,7 @@ chown $app:$app "$final_path/application/config/config.php"
ynh_script_progression --message="Upgrading DB..."
# Migrate DB
ynh_exec_as "$app" php $final_path/application/commands/console.php updatedb
ynh_exec_as "$app" php$phpversion $final_path/application/commands/console.php updatedb
#=================================================
# GENERIC FINALIZATION