diff --git a/README.md b/README.md index 7135719..523915e 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,17 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Joomla! is a free and open-source content management system (CMS) for publishing web content. Over the years Joomla! has won several awards. It is built on a model–view–controller web application framework that can be used independently of the CMS that allows you to build powerful online applications. -**Shipped version:** 4.1.0~ynh1 +**Shipped version:** 4.1.0~ynh2 +## Screenshots + +![](./doc/screenshots/screenshot.jpg) + ## Disclaimers / important information -# Ldap configuration (For now you have to configure it youeself) +# Ldap configuration (For now you have to configure it yourself) Enable ldap Extension
Enter the following feilds:
**Host:** localhost
@@ -38,6 +42,38 @@ Enter the following feilds:
**Map Email:** mail
**Map User ID:** uid
+# LASTEST UPDATE REQUIRE MANUAL FIX WITH PHPMYADMIN + +1. Run phpmyadmin after applying the update + +2. Select 'joomla' database in the left panel + +![step 1](./doc/dbprefix/fix1.jpg) + +3. Select all tables in the right panel + +![step 2](./doc/dbprefix/fix2.jpg) + +4. Clic on the action menu + +![step 3](./doc/dbprefix/fix2.5.jpg) + +5. Clic add prefix to table + +![step 4](./doc/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](./doc/dbprefix/fix4.jpg) + +7. You're done, all tables are prefixed with your prefix + +![step 6](./doc/dbprefix/fix5.jpg) + ## Documentation and resources * Official app website: https://www.joomla.org/ diff --git a/README_fr.md b/README_fr.md index fe38bde..3436668 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,13 +14,17 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Joomla! is a free and open-source content management system (CMS) for publishing web content. Over the years Joomla! has won several awards. It is built on a model–view–controller web application framework that can be used independently of the CMS that allows you to build powerful online applications. -**Version incluse :** 4.1.0~ynh1 +**Version incluse :** 4.1.0~ynh2 +## Captures d'écran + +![](./doc/screenshots/screenshot.jpg) + ## Avertissements / informations importantes -# Ldap configuration (For now you have to configure it youeself) +# Ldap configuration (For now you have to configure it yourself) Enable ldap Extension
Enter the following feilds:
**Host:** localhost
@@ -34,6 +38,38 @@ Enter the following feilds:
**Map Email:** mail
**Map User ID:** uid
+# LASTEST UPDATE REQUIRE MANUAL FIX WITH PHPMYADMIN + +1. Run phpmyadmin after applying the update + +2. Select 'joomla' database in the left panel + +![step 1](./doc/dbprefix/fix1.jpg) + +3. Select all tables in the right panel + +![step 2](./doc/dbprefix/fix2.jpg) + +4. Clic on the action menu + +![step 3](./doc/dbprefix/fix2.5.jpg) + +5. Clic add prefix to table + +![step 4](./doc/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](./doc/dbprefix/fix4.jpg) + +7. You're done, all tables are prefixed with your prefix + +![step 6](./doc/dbprefix/fix5.jpg) + ## Documentations et ressources * Site officiel de l'app : https://www.joomla.org/ diff --git a/check_process b/check_process index d2460c0..823d278 100644 --- a/check_process +++ b/check_process @@ -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 diff --git a/conf/configuration.php b/conf/configuration.php index 5d7cd2b..7328567 100644 --- a/conf/configuration.php +++ b/conf/configuration.php @@ -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}'; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index ab1a471..79388ff 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -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 diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index a1fd2a0..73173d3 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,4 +1,4 @@ -# Ldap configuration (For now you have to configure it youeself) +# Ldap configuration (For now you have to configure it yourself) Enable ldap Extension
Enter the following feilds:
**Host:** localhost
@@ -11,3 +11,35 @@ Enter the following feilds:
**Map Full Name:** displayname
**Map Email:** mail
**Map User ID:** uid
+ +# LASTEST UPDATE REQUIRE MANUAL FIX WITH PHPMYADMIN + +1. Run phpmyadmin after applying the update + +2. Select 'joomla' database in the left panel + +![step 1](./doc/dbprefix/fix1.jpg) + +3. Select all tables in the right panel + +![step 2](./doc/dbprefix/fix2.jpg) + +4. Clic on the action menu + +![step 3](./doc/dbprefix/fix2.5.jpg) + +5. Clic add prefix to table + +![step 4](./doc/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](./doc/dbprefix/fix4.jpg) + +7. You're done, all tables are prefixed with your prefix + +![step 6](./doc/dbprefix/fix5.jpg) diff --git a/doc/dbprefix/dbpresfix b/doc/dbprefix/dbpresfix new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/doc/dbprefix/dbpresfix @@ -0,0 +1 @@ + diff --git a/doc/dbprefix/fix1.jpg b/doc/dbprefix/fix1.jpg new file mode 100644 index 0000000..29b182f Binary files /dev/null and b/doc/dbprefix/fix1.jpg differ diff --git a/doc/dbprefix/fix2.5.jpg b/doc/dbprefix/fix2.5.jpg new file mode 100644 index 0000000..4f8196a Binary files /dev/null and b/doc/dbprefix/fix2.5.jpg differ diff --git a/doc/dbprefix/fix2.jpg b/doc/dbprefix/fix2.jpg new file mode 100644 index 0000000..2842f93 Binary files /dev/null and b/doc/dbprefix/fix2.jpg differ diff --git a/doc/dbprefix/fix3.jpg b/doc/dbprefix/fix3.jpg new file mode 100644 index 0000000..5342d37 Binary files /dev/null and b/doc/dbprefix/fix3.jpg differ diff --git a/doc/dbprefix/fix4.jpg b/doc/dbprefix/fix4.jpg new file mode 100644 index 0000000..b0f0279 Binary files /dev/null and b/doc/dbprefix/fix4.jpg differ diff --git a/doc/dbprefix/fix5.jpg b/doc/dbprefix/fix5.jpg new file mode 100644 index 0000000..ca64e80 Binary files /dev/null and b/doc/dbprefix/fix5.jpg differ diff --git a/doc/screenshots/screenshot.jpg b/doc/screenshots/screenshot.jpg new file mode 100644 index 0000000..d8c94d4 Binary files /dev/null and b/doc/screenshots/screenshot.jpg differ diff --git a/manifest.json b/manifest.json index a7fdcf0..63e43bc 100644 --- a/manifest.json +++ b/manifest.json @@ -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", diff --git a/scripts/_common.sh b/scripts/_common.sh index ecd263f..28e792f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -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 diff --git a/scripts/backup b/scripts/backup index 4cf0ae1..5f502ba 100644 --- a/scripts/backup +++ b/scripts/backup @@ -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 diff --git a/scripts/install b/scripts/install index 52df8e4..8d9d012 100644 --- a/scripts/install +++ b/scripts/install @@ -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 diff --git a/scripts/restore b/scripts/restore index 112b5be..e29d747 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c9fb8b9..e2c64ee 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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