1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/joomla_ynh.git synced 2024-09-03 19:26:34 +02:00

Merge pull request #10 from jarod5001/testing

Testing
This commit is contained in:
yalh76 2022-03-23 02:39:31 +01:00 committed by GitHub
commit ae110166ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 101 additions and 42 deletions

View file

@ -2,8 +2,8 @@
; Manifest
domain="domain.tld"
path="/path"
admin="john"
is_public=1
admin="john"
password="1Strong-Password"
; Checks
pkg_linter=1
@ -15,11 +15,12 @@
upgrade=1
# 4.0.6~ynh1
upgrade=1 from_commit=56aa844deccfdb2383bdc76b3fd3ce5eeb2bffe3
# 4.1.0~ynh1
upgrade=1 from_commit=ba8c26361212a96e2920da2eb2a99bf61889f63e
backup_restore=1
multi_instance=1
port_already_use=0
change_url=1
;;; Options
Email=anmol@datamol.org
Notification=
Notification=none

View file

@ -43,7 +43,7 @@ class JConfig
public $user = '__DB_USER__'; // Database username
public $password = '__DB_PWD__'; // Database password
public $db = '__DB_NAME__'; // Database name
public $dbprefix = ''; // Any random string ending with _
public $dbprefix = '__DB_PREFIX__'; // Any random string ending with _
public $dbencryption = 0;
public $dbsslverifyservercert = false;
public $dbsslkey = '';
@ -52,7 +52,7 @@ class JConfig
public $dbsslcipher = '';
/* Server Settings */
public $secret = ''; // Use something very secure. For example on linux the following command `cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-16} | head -n 1`
public $secret = '__SECRET__'; // Use something very secure. For example on linux the following command `cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-16} | head -n 1`
public $gzip = false;
public $error_reporting = 'default';
public $helpurl = 'https://help.joomla.org/proxy?keyref=Help{major}{minor}:{keyref}&lang={langcode}';

View file

@ -389,9 +389,9 @@ chdir = __FINALPATH__
; Default Value: clean env
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
@ -419,8 +419,8 @@ chdir = __FINALPATH__
;php_admin_value[memory_limit] = 32M
; Common values to change to increase file upload limit
; php_admin_value[upload_max_filesize] = 50M
; php_admin_value[post_max_size] = 50M
php_admin_value[upload_max_filesize] = 250M
php_admin_value[post_max_size] = 250M
; php_admin_flag[mail.add_x_header] = Off
; Other common parameters

View file

@ -11,3 +11,36 @@ Enter the following feilds:<br>
**Map Full Name:** displayname<br>
**Map Email:** mail<br>
**Map User ID:** uid<br>
# LASTEST UPDATE REQUIRE MANUAL FIX WITH PHPMYADMIN
1. Run phpmyadmin after applying the update
2. Select 'joomla' database in the left panel
![step 1](dbprefix/fix1.jpg)
3. Select all tables in the right panel
![step 2](dbprefix/fix2.jpg)
4. Clic on the action menu
![step 3](dbprefix/fix2.5.jpg)
5. Clic add prefix to table
![step 4](dbprefix/fix3.jpg)
6. Enter the database prefix you see in the error message of joomla :
```
Table 'joomla.JuzW_menu' doesn't exist
```
it looks like 'JuzW_' in the prefix box and validate
![step 5](dbprefix/fix4.jpg)
7. You're done, all tables are prefixed with your prefix
![step 6](dbprefix/fix5.jpg)

1
doc/dbprefix/dbpresfix Normal file
View file

@ -0,0 +1 @@

BIN
doc/dbprefix/fix1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
doc/dbprefix/fix2.5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
doc/dbprefix/fix2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

BIN
doc/dbprefix/fix3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

BIN
doc/dbprefix/fix4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
doc/dbprefix/fix5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

View file

@ -5,7 +5,7 @@
"description": {
"en": "A content management system."
},
"version": "4.1.0~ynh1",
"version": "4.1.0~ynh2",
"url": "https://www.joomla.org",
"upstream": {
"license": "GPL-2.0-only",
@ -24,7 +24,7 @@
"multi_instance": true,
"services": [
"nginx",
"php7.3-fpm",
"php8.0-fpm",
"mysql"
],
"arguments": {
@ -36,18 +36,18 @@
{
"name": "path",
"type": "path",
"example": "/example",
"example": "/joomla",
"default": "/joomla"
},
{
"name": "admin",
"type": "user"
},
{
"name": "is_public",
"type": "boolean",
"default": true
},
{
"name": "admin",
"type": "user"
},
{
"name": "password",
"type": "password",

View file

@ -5,7 +5,9 @@
#=================================================
# dependencies used by the app
pkg_dependencies=""
YNH_PHP_VERSION="8.0"
pkg_dependencies="php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-posix php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-memcache php${YNH_PHP_VERSION}-memcached php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-sockets php${YNH_PHP_VERSION}-mcrypt php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-fileinfo php${YNH_PHP_VERSION}-mbstring"
#=================================================
# PERSONAL HELPERS

View file

@ -14,9 +14,6 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors

View file

@ -22,13 +22,16 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
admin_email=$(ynh_user_get_info $admin 'mail')
is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
password=$YNH_APP_ARG_PASSWORD
app=$YNH_APP_INSTANCE_NAME
admin_email=$(ynh_user_get_info --username="$admin" --key="mail")
db_prefix="$(ynh_string_random --length="4")_"
secret=$(ynh_string_random --length="16")
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
@ -48,6 +51,8 @@ ynh_script_progression --message="Storing installation settings..."
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=admin --value=$admin
ynh_app_setting_set --app=$app --key=db_prefix --value=$db_prefix
ynh_app_setting_set --app=$app --key=secret --value=$secret
#=================================================
# STANDARD MODIFICATIONS
@ -64,7 +69,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CREATE A MYSQL DATABASE
@ -105,6 +110,7 @@ ynh_script_progression --message="Configuring PHP-FPM..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC SETUP
@ -123,23 +129,20 @@ chown $app:$app "$final_path/configuration.php"
#=================================================
ynh_script_progression --message="Setuping database..."
ynh_replace_string --match_string="#__" --replace_string="" --target_file="$final_path/installation/sql/mysql/base.sql"
ynh_replace_string --match_string="#__" --replace_string="" --target_file="$final_path/installation/sql/mysql/extensions.sql"
ynh_replace_string --match_string="#__" --replace_string="" --target_file="$final_path/installation/sql/mysql/supports.sql"
ynh_replace_string --match_string="#__" --replace_string="$db_prefix" --target_file="$final_path/installation/sql/mysql/base.sql"
ynh_replace_string --match_string="#__" --replace_string="$db_prefix" --target_file="$final_path/installation/sql/mysql/extensions.sql"
ynh_replace_string --match_string="#__" --replace_string="$db_prefix" --target_file="$final_path/installation/sql/mysql/supports.sql"
ynh_mysql_execute_file_as_root --file="$final_path/installation/sql/mysql/base.sql" --database=$db_name
ynh_mysql_execute_file_as_root --file="$final_path/installation/sql/mysql/extensions.sql" --database=$db_name
ynh_mysql_execute_file_as_root --file="$final_path/installation/sql/mysql/supports.sql" --database=$db_name
JUSERID=$[ ( $RANDOM % 100 ) + 1 ]
JPASS="$(echo -n "$password" | md5sum | awk '{ print $1 }' )"
ynh_mysql_execute_as_root --database=$db_name --sql="INSERT INTO \`users\` (\`id\`, \`name\`, \`username\`, \`email\`, \`password\`, \`block\`, \`sendEmail\`, \`registerDate\`, \`lastvisitDate\`, \`activation\`, \`params\`, \`lastResetTime\`, \`resetCount\`, \`otpKey\`, \`otep\`, \`requireReset\`) VALUES ('${JUSERID}', 'Me', '${admin}', '${admin_email}', '${JPASS}', '0', '0', '0000-00-00 00:00:00.000000', '0000-00-00 00:00:00.000000', '', '', '0000-00-00 00:00:00.000000', '0', '', '', '0');"
ynh_mysql_execute_as_root --database=$db_name --sql="INSERT INTO \`user_usergroup_map\` (\`user_id\`, \`group_id\`) VALUES ('${JUSERID}', '8');"
JUSERINC=$((JUSERID+1))
ynh_mysql_execute_as_root --database=$db_name --sql="ALTER TABLE \`users\` auto_increment = ${JUSERINC};"
ynh_secure_remove --file="$final_path/installation"
pushd "$final_path/cli"
php$phpversion joomla.php user:add --username "$admin" --name "$admin" --password "$password" --email "$admin_email" --usergroup "Super Users" -n
popd
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -147,6 +150,11 @@ ynh_secure_remove --file="$final_path/installation"
#=================================================
ynh_script_progression --message="Configuring log rotation..."
mkdir -p "/var/log/$app"
chmod 750 "/var/log/$app"
chmod -R o-rwx "/var/log/$app"
chown -R $app:www-data "/var/log/$app"
# Use logrotate to manage application logfile(s)
ynh_use_logrotate

View file

@ -14,9 +14,6 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -57,7 +54,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
@ -101,6 +98,11 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
mkdir -p "/var/log/$app"
chmod 750 "/var/log/$app"
chmod -R o-rwx "/var/log/$app"
chown -R $app:www-data "/var/log/$app"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================

View file

@ -23,6 +23,8 @@ 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
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
db_prefix=$(ynh_app_setting_get --app=$app --key=db_prefix)
secret=$(ynh_app_setting_get --app=$app --key=secret)
#=================================================
# CHECK VERSION
@ -52,13 +54,25 @@ ynh_abort_if_errors
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# If db_prefix doesn't exist, create it
if [ -z "$db_prefix" ]; then
db_prefix=""
ynh_app_setting_set --app=$app --key=db_prefix --value=$db_prefix
fi
# If secret doesn't exist, create it
if [ -z "$secret" ]; then
secret=""
ynh_app_setting_set --app=$app --key=secret --value=$secret
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
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -101,10 +115,6 @@ ynh_add_fpm_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# ...
#=================================================
#=================================================
# UPDATE A CONFIG FILE
#=================================================
@ -122,6 +132,11 @@ chown $app:$app "$final_path/configuration.php"
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..."
mkdir -p "/var/log/$app"
chmod 750 "/var/log/$app"
chmod -R o-rwx "/var/log/$app"
chown -R $app:www-data "/var/log/$app"
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append