mirror of
https://github.com/YunoHost-Apps/friendica_ynh.git
synced 2024-09-03 18:36:14 +02:00
Fix
This commit is contained in:
parent
41c39d47e4
commit
30bc787b0c
13 changed files with 111 additions and 310 deletions
|
@ -1,7 +1,7 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld"
|
||||||
admin="john" (USER)
|
admin="john"
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=0
|
setup_sub_dir=0
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
|
|
||||||
$a->config['system']['addon'] = 'ldapauth';
|
|
||||||
|
|
||||||
$a->config['ldapauth']['ldap_server'] = 'localhost';
|
|
||||||
$a->config['ldapauth']['ldap_searchdn'] = 'ou=users,dc=yunohost,dc=org';
|
|
||||||
$a->config['ldapauth']['ldap_userattr'] = 'uid';
|
|
||||||
$a->config['ldapauth']['ldap_autocreateaccount'] = 'true';
|
|
||||||
$a->config['ldapauth']['ldap_autocreateaccount_emailattribute'] = 'mail';
|
|
2
conf/cron
Normal file
2
conf/cron
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Run poller periodically to update Friendica
|
||||||
|
*/10 * * * * __APP__ cd __FINALPATH__; /usr/bin/php__PHPVERSION__ bin/worker.php
|
|
@ -1,112 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// If automatic system installation fails:
|
|
||||||
|
|
||||||
|
|
||||||
die('The configuration you did manually contains some mistakes. Please have a look at your .htconfig.php file.');
|
|
||||||
// If you are doing the configuration manually, please remove the line above
|
|
||||||
|
|
||||||
|
|
||||||
// Copy or rename this file to .htconfig.php
|
|
||||||
|
|
||||||
// Why .htconfig.php? Because it contains sensitive information which could
|
|
||||||
// give somebody complete control of your database. Apache's default
|
|
||||||
// configuration denies access to and refuses to serve any file beginning
|
|
||||||
// with .ht
|
|
||||||
|
|
||||||
// Then set the following for your MySQL installation
|
|
||||||
|
|
||||||
$db_host = 'your.mysqlhost.com';
|
|
||||||
$db_user = 'mysqlusername';
|
|
||||||
$db_pass = 'mysqlpassword';
|
|
||||||
$db_data = 'mysqldatabasename';
|
|
||||||
|
|
||||||
// Use environment variables for mysql if they are set beforehand
|
|
||||||
if (!empty(getenv('MYSQL_HOST'))
|
|
||||||
&& !empty(getenv('MYSQL_PORT'))
|
|
||||||
&& (!empty(getenv('MYSQL_USERNAME')) || !empty(getenv('MYSQL_USER')))
|
|
||||||
&& !empty(getenv('MYSQL_PASSWORD'))
|
|
||||||
&& !empty(getenv('MYSQL_DATABASE'))) {
|
|
||||||
$db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT');
|
|
||||||
if (!empty(getenv('MYSQL_USERNAME'))) {
|
|
||||||
$db_user = getenv('MYSQL_USERNAME');
|
|
||||||
} elseif (!empty(getenv('MYSQL_USER'))) {
|
|
||||||
$db_user = getenv('MYSQL_USER');
|
|
||||||
}
|
|
||||||
$db_pass = getenv('MYSQL_PASSWORD');
|
|
||||||
$db_data = getenv('MYSQL_DATABASE');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the database connection charset to full Unicode (utf8mb4).
|
|
||||||
// Changing this value will likely corrupt the special characters.
|
|
||||||
// You have been warned.
|
|
||||||
$a->config['system']['db_charset'] = "utf8mb4";
|
|
||||||
|
|
||||||
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
|
|
||||||
// It can be changed later and only applies to timestamps for anonymous viewers.
|
|
||||||
|
|
||||||
$default_timezone = 'America/Los_Angeles';
|
|
||||||
|
|
||||||
// Default system language
|
|
||||||
|
|
||||||
$a->config['system']['language'] = 'en';
|
|
||||||
|
|
||||||
// What is your site name?
|
|
||||||
|
|
||||||
$a->config['sitename'] = "YunoHost Friendica Social Network";
|
|
||||||
|
|
||||||
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
|
|
||||||
// Be certain to create your own personal account before setting
|
|
||||||
// REGISTER_CLOSED. 'register_text' (if set) will be displayed prominently on
|
|
||||||
// the registration page. REGISTER_APPROVE requires you set 'admin_email'
|
|
||||||
// to the email address of an already registered person who can authorise
|
|
||||||
// and/or approve/deny the request.
|
|
||||||
|
|
||||||
// In order to perform system administration via the admin panel, admin_email
|
|
||||||
// must precisely match the email address of the person logged in.
|
|
||||||
|
|
||||||
$a->config['register_policy'] = REGISTER_CLOSEDS;
|
|
||||||
$a->config['register_text'] = '';
|
|
||||||
$a->config['admin_email'] = '__ADMIN_EMAIL__';
|
|
||||||
|
|
||||||
// Maximum size of an imported message, 0 is unlimited
|
|
||||||
|
|
||||||
$a->config['max_import_size'] = 200000;
|
|
||||||
|
|
||||||
// maximum size of uploaded photos
|
|
||||||
|
|
||||||
$a->config['system']['maximagesize'] = 800000;
|
|
||||||
|
|
||||||
// Location of PHP command line processor
|
|
||||||
|
|
||||||
$a->config['php_path'] = 'php';
|
|
||||||
|
|
||||||
// Server-to-server private message encryption (RINO) is allowed by default.
|
|
||||||
// set to 0 to disable, 1 to enable
|
|
||||||
|
|
||||||
$a->config['system']['rino_encrypt'] = 1;
|
|
||||||
|
|
||||||
// allowed themes (change this from admin panel after installation)
|
|
||||||
|
|
||||||
$a->config['system']['allowed_themes'] = 'quattro,vier,duepuntozero,smoothly';
|
|
||||||
|
|
||||||
// default system theme
|
|
||||||
|
|
||||||
$a->config['system']['theme'] = 'vier';
|
|
||||||
|
|
||||||
|
|
||||||
// By default allow pseudonyms
|
|
||||||
|
|
||||||
$a->config['system']['no_regfullname'] = true;
|
|
||||||
|
|
||||||
//Deny public access to the local directory
|
|
||||||
//$a->config['system']['block_local_dir'] = false;
|
|
||||||
|
|
||||||
// Location of the global directory
|
|
||||||
$a->config['system']['directory'] = 'https://dir.friendica.social';
|
|
||||||
|
|
||||||
// Allowed protocols in link URLs; HTTP protocols always are accepted
|
|
||||||
$a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid', 'gopher'];
|
|
||||||
|
|
||||||
// Authentication cookie lifetime, in days
|
|
||||||
$a->config['system']['auth_cookie_lifetime'] = 7;
|
|
44
conf/local-sample.config.php
Normal file
44
conf/local-sample.config.php
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Local configuration
|
||||||
|
|
||||||
|
/* If automatic system installation fails:
|
||||||
|
*
|
||||||
|
* Copy this file to local.config.php
|
||||||
|
*
|
||||||
|
* Why local.config.php? Because it contains sensitive information which could
|
||||||
|
* give somebody complete control of your database. Apache's default
|
||||||
|
* configuration will interpret any .php file as a script and won't show the values
|
||||||
|
*
|
||||||
|
* Then set the following for your MySQL installation
|
||||||
|
*
|
||||||
|
* If you're unsure about what any of the config keys below do, please check the static/defaults.config.php file for
|
||||||
|
* detailed documentation of their data type and behavior.
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
'database' => [
|
||||||
|
'hostname' => 'localhost',
|
||||||
|
'username' => '__DB_NAME__',
|
||||||
|
'password' => '__DB_PWD__',
|
||||||
|
'database' => '__DB_NAME__',
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
],
|
||||||
|
|
||||||
|
// ****************************************************************
|
||||||
|
// The configuration below will be overruled by the admin panel.
|
||||||
|
// Changes made below will only have an effect if the database does
|
||||||
|
// not contain any configuration for the friendica system.
|
||||||
|
// ****************************************************************
|
||||||
|
|
||||||
|
'config' => [
|
||||||
|
'admin_email' => '__EMAIL__',
|
||||||
|
'sitename' => 'Friendica Social Network',
|
||||||
|
'register_policy' => \Friendica\Module\Register::OPEN,
|
||||||
|
'register_text' => '',
|
||||||
|
],
|
||||||
|
'system' => [
|
||||||
|
'default_timezone' => 'UTC',
|
||||||
|
'language' => 'en',
|
||||||
|
],
|
||||||
|
];
|
|
@ -1,41 +0,0 @@
|
||||||
<?php return <<<INI
|
|
||||||
|
|
||||||
; If automatic system installation fails:
|
|
||||||
|
|
||||||
; Copy this file to local.ini.php
|
|
||||||
|
|
||||||
; Why local.ini.php? Because it contains sensitive information which could
|
|
||||||
; give somebody complete control of your database. Apache's default
|
|
||||||
; configuration will interpret any .php file as a script and won't show the values
|
|
||||||
|
|
||||||
; Then set the following for your MySQL installation
|
|
||||||
|
|
||||||
[database]
|
|
||||||
hostname = localhost
|
|
||||||
username = mysqlusername
|
|
||||||
password = mysqlpassword
|
|
||||||
database = mysqldatabasename
|
|
||||||
charset = utf8mb4
|
|
||||||
|
|
||||||
|
|
||||||
; ****************************************************************
|
|
||||||
; The configuration below will be overruled by the admin panel.
|
|
||||||
; Changes made below will only have an effect if the database does
|
|
||||||
; not contain any configuration for the friendica system.
|
|
||||||
; ****************************************************************
|
|
||||||
|
|
||||||
[config]
|
|
||||||
admin_email =
|
|
||||||
|
|
||||||
sitename = Friendica Social Network
|
|
||||||
|
|
||||||
register_policy = REGISTER_OPEN
|
|
||||||
register_text =
|
|
||||||
|
|
||||||
[system]
|
|
||||||
default_timezone = UTC
|
|
||||||
|
|
||||||
language = en
|
|
||||||
|
|
||||||
INI;
|
|
||||||
// Keep this line
|
|
|
@ -1,36 +1,6 @@
|
||||||
##
|
|
||||||
# Friendica Nginx configuration
|
|
||||||
# by Olaf Conradi
|
|
||||||
#
|
|
||||||
# On Debian based distributions you can add this file to
|
|
||||||
# /etc/nginx/sites-available
|
|
||||||
#
|
|
||||||
# Then customize to your needs. To enable the configuration
|
|
||||||
# symlink it to /etc/nginx/sites-enabled and reload Nginx using
|
|
||||||
#
|
|
||||||
# service nginx reload
|
|
||||||
##
|
|
||||||
|
|
||||||
##
|
|
||||||
# You should look at the following URL's in order to grasp a solid understanding
|
|
||||||
# of Nginx configuration files in order to fully unleash the power of Nginx.
|
|
||||||
#
|
|
||||||
# http://wiki.nginx.org/Pitfalls
|
|
||||||
# http://wiki.nginx.org/QuickStart
|
|
||||||
# http://wiki.nginx.org/Configuration
|
|
||||||
##
|
|
||||||
|
|
||||||
##
|
|
||||||
# This configuration assumes your domain is example.net
|
|
||||||
# You have a separate subdomain friendica.example.net
|
|
||||||
# You want all Friendica traffic to be https
|
|
||||||
# You have an SSL certificate and key for your subdomain
|
|
||||||
# You have PHP FastCGI Process Manager (php5-fpm) running on localhost
|
|
||||||
# You have Friendica installed in /var/www/friendica
|
|
||||||
##
|
|
||||||
|
|
||||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
location __PATH__/ {
|
location __PATH__/ {
|
||||||
|
|
||||||
alias __FINALPATH__/;
|
alias __FINALPATH__/;
|
||||||
|
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
|
@ -41,17 +11,13 @@ location __PATH__/ {
|
||||||
rewrite ^(.*)$ /index.php?pagename=$1;
|
rewrite ^(.*)$ /index.php?pagename=$1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#allow uploads up to 20MB in size
|
#allow uploads up to 20MB in size
|
||||||
client_max_body_size 20m;
|
client_max_body_size 20m;
|
||||||
client_body_buffer_size 128k;
|
client_body_buffer_size 128k;
|
||||||
|
|
||||||
|
|
||||||
#Default indexes and catch-all
|
#Default indexes and catch-all
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
|
|
||||||
# make sure webfinger and other well known services aren't blocked
|
# make sure webfinger and other well known services aren't blocked
|
||||||
# by denying dot files and rewrite request to the front controller
|
# by denying dot files and rewrite request to the front controller
|
||||||
location ^~ /.well-known/ {
|
location ^~ /.well-known/ {
|
||||||
|
@ -68,7 +34,6 @@ location __PATH__/ {
|
||||||
deny all;
|
deny all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#Execute and serve PHP files
|
#Execute and serve PHP files
|
||||||
location ~* \.php$ {
|
location ~* \.php$ {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
# Run poller periodically to update Friendica
|
|
||||||
*/10 * * * * __USER__ cd __YNH_WWW_PATH__; /usr/bin/php__PHP_VERSION__ bin/worker.php
|
|
|
@ -14,7 +14,7 @@
|
||||||
"email": ""
|
"email": ""
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 4.1.0"
|
"yunohost": ">= 4.2.0"
|
||||||
},
|
},
|
||||||
"previous_maintainers": {
|
"previous_maintainers": {
|
||||||
"name": "aymhce",
|
"name": "aymhce",
|
||||||
|
@ -31,20 +31,12 @@
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a domain for Friendica. Friendica must be installed on the ROOT domain, so be careful!",
|
|
||||||
"fr": "Choisissez un domaine pour Friendica.Friendica doit etre installe a la racine, soyez prudent"
|
|
||||||
},
|
|
||||||
"example": "domain.org"
|
"example": "domain.org"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user",
|
||||||
"ask": {
|
"example": "johndoe"
|
||||||
"en": "Choose the Friendica administrator (must be an existing YunoHost user)",
|
|
||||||
"fr": "Choisissez l'administrateur pour Friendica (l'utilisateur YunoHost doit exister)"
|
|
||||||
},
|
|
||||||
"example": "homer"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -28,7 +28,7 @@ ynh_abort_if_errors
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url='/'
|
path_url='/'
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
admin_mail=$(yunohost user info $admin | grep "mail:" | cut -d' ' -f2)
|
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
is_public=1
|
is_public=1
|
||||||
database="1"
|
database="1"
|
||||||
|
|
||||||
|
@ -53,10 +53,17 @@ ynh_script_progression --message="Storing installation settings..."
|
||||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
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=path --value=$path_url
|
||||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
ynh_app_setting_set --app=$app --key=email --value=$email
|
||||||
ynh_app_setting_set --app=$app --key=email --value=$admin_mail
|
|
||||||
ynh_app_setting_set --app=$app --key=database --value=$database
|
ynh_app_setting_set --app=$app --key=database --value=$database
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring system user..."
|
||||||
|
|
||||||
|
# Create a system user
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A MYSQL DATABASE
|
# CREATE A MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -82,6 +89,10 @@ cp -f "$final_path/.htaccess-dist" "$final_path/.htaccess"
|
||||||
# 2 - Clone addons repo
|
# 2 - Clone addons repo
|
||||||
git clone https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon"
|
git clone https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon"
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -90,29 +101,15 @@ ynh_script_progression --message="Configuring NGINX web server..."
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
# configure friendica
|
|
||||||
config="$final_path/config/local.config.php"
|
|
||||||
cp -f "$final_path/config/local-sample.config.php" $config
|
ynh_add_config --template="../conf/local-sample.config.php" --destination="$final_path/config/local.config.php"
|
||||||
ynh_replace_string --match_string="your.mysqlhost.com" --replace_string="localhost" --target_file="$config"
|
|
||||||
ynh_replace_string --match_string="mysqlusername" --replace_string="$db_name" --target_file="$config"
|
|
||||||
ynh_replace_string --match_string="mysqldatabasename" --replace_string="$db_name" --target_file="$config"
|
|
||||||
ynh_replace_string --match_string="mysqlpassword" --replace_string="$db_pwd" --target_file="$config"
|
|
||||||
ynh_replace_string --match_string="'admin_email' => ''," --replace_string="'admin_email' => '$admin_mail'," --target_file="$config"
|
|
||||||
#ynh_replace_string --match_string="OPEN" --replace_string="CLOSED" --target_file="$config"
|
|
||||||
|
|
||||||
# init db
|
# init db
|
||||||
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "$final_path/database.sql"
|
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "$final_path/database.sql"
|
||||||
|
|
||||||
# ldap addon config
|
# LDAP addon config
|
||||||
cp "../conf/addon.config.php" "$final_path/config/."
|
ynh_add_config --template="../conf/addon.config.php" --destination="$final_path/config/addon.config.php"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring system user..."
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
ynh_system_user_create --username=$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
|
@ -127,11 +124,14 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
mkdir -p "${final_path}/view/smarty3"
|
mkdir -p "${final_path}/view/smarty3"
|
||||||
chmod -R 775 $final_path/view/smarty3
|
chmod -R 775 $final_path/view/smarty3
|
||||||
|
|
||||||
# Set up poller
|
#=================================================
|
||||||
ynh_replace_string --match_string="__YNH_WWW_PATH__" --replace_string="$final_path" --target_file="../conf/poller-cron"
|
# SETUP A CRON
|
||||||
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/poller-cron"
|
#=================================================
|
||||||
ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file="../conf/poller-cron"
|
ynh_script_progression --message="Setuping a cron..."
|
||||||
cp ../conf/poller-cron /etc/cron.d/$app
|
|
||||||
|
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||||
|
chown root: "/etc/cron.d/$app"
|
||||||
|
chmod 644 "/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
|
@ -145,14 +145,9 @@ pushd "$final_path"
|
||||||
php$phpversion bin/composer.phar install 2>/dev/null
|
php$phpversion bin/composer.phar install 2>/dev/null
|
||||||
bin/console config system addon ldapauth
|
bin/console config system addon ldapauth
|
||||||
popd
|
popd
|
||||||
|
|
||||||
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" <<< "INSERT INTO addon (id, name, version, installed, hidden, timestamp, plugin_admin) VALUES (NULL, 'ldapauth', '', '1', '0', UNIX_TIMESTAMP(), '0');"
|
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" <<< "INSERT INTO addon (id, name, version, installed, hidden, timestamp, plugin_admin) VALUES (NULL, 'ldapauth', '', '1', '0', UNIX_TIMESTAMP(), '0');"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Folder rights
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
chown -R $app: $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -60,6 +60,14 @@ db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
ynh_mysql_setup_db $db_name $db_name $db_pwd
|
ynh_mysql_setup_db $db_name $db_name $db_pwd
|
||||||
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RECREATE THE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Recreating the dedicated system user..."
|
||||||
|
|
||||||
|
# Create the dedicated user (if not existing)
|
||||||
|
ynh_system_user_create $app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -67,13 +75,10 @@ ynh_script_progression --message="Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
#=================================================
|
chmod 750 "$final_path"
|
||||||
# RECREATE THE DEDICATED USER
|
chmod -R o-rwx "$final_path"
|
||||||
#=================================================
|
chown -R $app:www-data "$final_path"
|
||||||
ynh_print_info "Recreating the dedicated system user..."
|
chmod -R 775 $final_path/view/smarty3
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
|
||||||
ynh_system_user_create $app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
|
@ -85,28 +90,12 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
# Recreate a dedicated php-fpm config
|
# Recreate a dedicated php-fpm config
|
||||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC RESTORATION
|
|
||||||
#=================================================
|
|
||||||
# REINSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reinstalling dependencies..."
|
|
||||||
|
|
||||||
# set permission
|
|
||||||
chmod -R 775 $final_path/view/smarty3
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE CRON FILE
|
# RESTORE THE CRON FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file "/etc/cron.d/$app"
|
ynh_restore_file "/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Folder rights
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
chown -R $app: $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -21,7 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
admin_mail=$(ynh_app_setting_get --app=$app --key=email)
|
email=$(ynh_app_setting_get --app=$app --key=email)
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
|
@ -76,9 +76,9 @@ if [ -f $final_path/.htconfig.php ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If admin_mail setting doesn't exist, create it
|
# If admin_mail setting doesn't exist, create it
|
||||||
if [ -z $admin_mail ]; then
|
if [ -z $email ]; then
|
||||||
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
|
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
ynh_app_setting_set --app=$app --key=email --value=$admin_mail
|
ynh_app_setting_set --app=$app --key=email --value=$email
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
# Cleaning legacy permissions
|
||||||
|
@ -88,6 +88,14 @@ if ynh_legacy_permissions_exists; then
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||||
|
|
||||||
|
# Create a dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -132,24 +140,15 @@ else
|
||||||
# Restore the smarty3 folder
|
# Restore the smarty3 folder
|
||||||
cp -a "$tmpdir/view/smarty3" "${final_path}"
|
cp -a "$tmpdir/view/smarty3" "${final_path}"
|
||||||
ynh_secure_remove "$tmpdir"
|
ynh_secure_remove "$tmpdir"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy config file for correct place
|
# Copy config file for correct place
|
||||||
config="$final_path/config/local.config.php"
|
ynh_add_config --template="../conf/local-sample.config.php" --destination="$final_path/config/local.config.php"
|
||||||
cp -a "/var/www/$app/config/local-sample.config.php" $config
|
|
||||||
|
|
||||||
# Replace strings in config file
|
chmod 750 "$final_path"
|
||||||
ynh_replace_string --match_string="your.mysqlhost.com" --replace_string="localhost" --target_file="$config"
|
chmod -R o-rwx "$final_path"
|
||||||
ynh_replace_string --match_string="mysqlusername" --replace_string="$db_name" --target_file="$config"
|
chown -R $app:www-data "$final_path"
|
||||||
ynh_replace_string --match_string="mysqldatabasename" --replace_string="$db_name" --target_file="$config"
|
|
||||||
ynh_replace_string --match_string="mysqlpassword" --replace_string="$db_pwd" --target_file= "$config"
|
|
||||||
ynh_replace_string --match_string="'admin_email' => ''," --replace_string="'admin_email' => '$admin_mail'," --target_file="$config"
|
|
||||||
#ynh_replace_string --match_string="OPEN" --replace_string="CLOSED" --target_file="$config"
|
|
||||||
|
|
||||||
# ldap addon config
|
|
||||||
cp -f "../conf/addon.config.php" "$final_path/config/."
|
|
||||||
|
|
||||||
# 3 - some extra folders
|
# 3 - some extra folders
|
||||||
chmod -R 775 $final_path/view/smarty3
|
chmod -R 775 $final_path/view/smarty3
|
||||||
|
@ -162,14 +161,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -182,17 +173,9 @@ ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||||
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
chown root: "/etc/cron.d/$app"
|
||||||
ynh_backup_if_checksum_is_different --file="$final_path/config/local.config.php"
|
chmod 644 "/etc/cron.d/$app"
|
||||||
# Recalculate and store the checksum of the file for the next upgrade.
|
|
||||||
ynh_store_file_checksum --file="$final_path/config/local.config.php"
|
|
||||||
|
|
||||||
# Set up cron job
|
|
||||||
ynh_replace_string --match_string="__YNH_WWW_PATH__" --replace_string="$final_path" --target_file="../conf/poller-cron"
|
|
||||||
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/poller-cron"
|
|
||||||
ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file="../conf/poller-cron"
|
|
||||||
cp "../conf/poller-cron" "/etc/cron.d/$app"
|
|
||||||
|
|
||||||
# Run composer
|
# Run composer
|
||||||
pushd "$final_path"
|
pushd "$final_path"
|
||||||
|
@ -200,12 +183,6 @@ pushd "$final_path"
|
||||||
bin/console config system addon ldapauth
|
bin/console config system addon ldapauth
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Folder rights
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
chown -R $app: $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue