Anonymiser les données de PrestaShop

Pour créer un environnement de développement, on duplique celui de production. Sauf qu’il ne faut pas garder les infos personnelles des clients. Déjà c’est dangereux, si vous gérez mal votre affaire vous risquez d’envoyer des mails aux clients et ça force tous les développeurs et intervenants à faire attention au RGPD.

Donc on anonymise tout, c’est plus simple.

Voici un script MariaDB qui anonymise les données clients : noms, prénoms, adresses, téléphones, e-mails, ip, communications. Il remplace les lettres par xxx en respectant la casse, les n° de téléphone par 0 en respectant le format et passe les IP en 127.0.0.1.

UPDATE ps_address pa
SET pa.alias = REGEXP_REPLACE(REGEXP_REPLACE(pa.alias, '(?-i)[a-z]', 'x'), '(?-i)[A-Z]', 'X'),
pa.lastname = REGEXP_REPLACE(REGEXP_REPLACE(pa.lastname, '(?-i)[a-z]', 'x'), '(?-i)[A-Z]', 'X'),
pa.firstname = REGEXP_REPLACE(REGEXP_REPLACE(pa.firstname, '(?-i)[a-z]', 'x'), '(?-i)[A-Z]', 'X'),
pa.address1 = REGEXP_REPLACE(REGEXP_REPLACE(pa.address1, '(?-i)[a-z]', 'x'), '(?-i)[A-Z]', 'X'),
pa.address2 = REGEXP_REPLACE(REGEXP_REPLACE(pa.address2, '(?-i)[a-z]', 'x'), '(?-i)[A-Z]', 'X'),
pa.city = REGEXP_REPLACE(REGEXP_REPLACE(pa.city, '(?-i)[a-z]', 'x'), '(?-i)[A-Z]', 'X'),
pa.other = REGEXP_REPLACE(REGEXP_REPLACE(pa.other, '(?-i)[a-z]', 'x'), '(?-i)[A-Z]', 'X'),
pa.company = REGEXP_REPLACE(REGEXP_REPLACE(pa.company, '(?-i)[a-z]', 'x'), '(?-i)[A-Z]', 'X'),
pa.phone = REGEXP_REPLACE(pa.phone, '[0-9]', '0'),
pa.phone_mobile = REGEXP_REPLACE(pa.phone_mobile, '[0-9]', '0'),
pa.vat_number = REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(pa.vat_number, '[0-9]', '0'), '(?-i)[a-z]', 'x'), '(?-i)[A-Z]', 'X'),
pa.dni = REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(pa.dni, '[0-9]', '0'), '(?-i)[a-z]', 'x'), '(?-i)[A-Z]', 'X');

UPDATE ps_customer c
SET c.lastname = REGEXP_REPLACE(REGEXP_REPLACE(c.lastname, '(?-i)[a-z]', 'x'), '(?-i)[A-Z]', 'X'),
c.firstname = REGEXP_REPLACE(REGEXP_REPLACE(c.firstname, '(?-i)[a-z]', 'x'), '(?-i)[A-Z]', 'X'),
c.email = CONCAT(c.id_customer, '@example.com');

UPDATE ps_customer c 
SET c.ip_registration_newsletter = '127.0.0.1' 
WHERE c.ip_registration_newsletter IS NOT NULL AND c.ip_registration_newsletter != '0';

UPDATE ps_customer_message cm
SET cm.message = REGEXP_REPLACE(REGEXP_REPLACE(cm.message, '(?-i)[a-z]', 'x'), '(?-i)[A-Z]', 'X'),
cm.ip_address = '2130706433';

UPDATE ps_customer_thread ct
SET ct.email = CONCAT(IF(ct.id_customer > 0, ct.id_customer, '0'), '@example.com');
Langage du code : SQL (Structured Query Language) (sql)

La syntaxe de REGEXP_REPLACE n’est pas la même pour MySQL et MariaBD, donc il faudra adapter.

Avoir un point comme séparateur dans GNOME calculator

Je dois faire plein de calculs à coller dans un css, c’est très gênant d’avoir à corriger tous les résultats pour remplacer les virgules par des points.

Pour que la calculatrice d’Ubuntu utilise le point comme séparateur décimal, il faut la lancer comme suit dans un terminal :

LC_NUMERIC=en_US.UTF-8 gnome-calculatorLangage du code : Bash (bash)

Source : https://forums.linuxmint.com/viewtopic.php?p=1366261&sid=628026c11647ae21afbe12b8eec60941#p1366261

Sauvegarde automatique sur FTP

A force je pense avoir un script de sauvegarde FTP efficace.

Il sauvegarde les bases de données ainsi qu’un dossier du serveur et les envoi sur un serveur FTP. Si le serveur FTP est plein, il supprime les sauvegardes les plus anciennes jusqu’à avoir assez de place pour mettre la nouvelle.

Si une erreur arrive, il envoi un mail d’alerte.

Le script nécessite curlftpfs.

Utilisation :

  • Modifiez le script dans la partie configuration
  • Enregistrez le sur le serveur, par exemple dans /opt/scripts/backup.sh
  • Donnez les droits d’execution au fichier : chmod +x /opt/scripts/backup.sh
  • Ajoutez une tâche cron : 02 00 * * * /bin/bash /opt/scripts/backup.sh > /var/log/backup.log 2>&1

#!/bin/bash

### Configuration ###

### MYSQL ###
MUSER="" # MySQL user, must can execute 'show databases'
MPASS="" # MySQL password
MHOST="" # MySQL host

### FTP ###
FTPD="/" # FTP folder
FTPUSER="" # FTP user
FTPPASS="" # FTP password
FTPHOST="" # FTP host
FTPSIZE=107374182400 # Size of the FTP in Bytes (here 100 GB)

### Others ###
EMAIL="" # Email to send alerts
FILES_DIR="/home" # Directory to backup

### End of configuration ###

### Check system ###

if ! [ -x "$(command -v tar)" ]; then
  echo 'Error: tar is not installed.'
  exit 1
fi

if ! [ -x "$(command -v gzip)" ]; then
  echo 'Error: gzip is not installed.'
  exit 1
fi

if ! [ -x "$(command -v mysql)" ]; then
  echo 'Error: mysql is not installed.'
  exit 1
fi

if ! [ -x "$(command -v mysqldump)" ]; then
  echo 'Error: mysqldump is not installed.'
  exit 1
fi

if ! [ -x "$(command -v curl)" ]; then
  echo 'Error: curl is not installed.'
  exit 1
fi

if ! [ -x "$(command -v curlftpfs)" ]; then
  echo 'Error: curlftpfs is not installed.'
  exit 1
fi

if ! [ -x "$(command -v fusermount)" ]; then
  echo 'Error: fusermount is not installed.'
  exit 1
fi

if ! [ -d "$FILES_DIR" ]; then
  echo "Error: $FILES_DIR does not exists."
  exit 1
fi

### Start ###

echo $(date +"%Y-%m-%d %T")" Start of process"

NOW=$(date +%Y%m%d) # current date to have the file with the name-YYYYMMDD.tar.gz

FTP_DIR=$(mktemp -d -t ftp-XXXXXXXXXX) # create local FTP directory

# check if directory was created
if [ -d "$FTP_DIR" ]; then
  echo $(date +"%Y-%m-%d %T")" Created local FTP directory $FTP_DIR"
else
  echo "Error: Could not create local FTP directory $FTP_DIR"
  echo "Could not create local FTP directory $FTP_DIR" | mail -s "Backup Error" "#EMAIL"
  exit 1
fi

BACKUP_DIR=$(mktemp -d -t bk-XXXXXXXXXX) # create backup directory

if [ -d "$BACKUP_DIR" ]; then
  echo $(date +"%Y-%m-%d %T")" Created backup directory $BACKUP_DIR"
else
  echo "Error: Could not create backup directory $BACKUP_DIR"
  echo "Could not create backup directory $BACKUP_DIR" | mail -s "Backup Error" "#EMAIL"
  rm -rf "$FTP_DIR"
  echo $(date +"%Y-%m-%d %T")" Deleted local FTP directory $FTP_DIR"
  exit 1
fi

# deletes the temp directories when leaving the script
function cleanup {
  if [ -d "$FTP_DIR" ]; then
    fusermount -u "$FTP_DIR"
    rmdir "$FTP_DIR"
    echo $(date +"%Y-%m-%d %T")" Deleted local FTP directory $FTP_DIR"
  fi
  if [ -d "$BACKUP_DIR" ]; then
    rm -rf "$BACKUP_DIR"
    echo $(date +"%Y-%m-%d %T")" Deleted backup directory $BACKUP_DIR"
  fi
  echo $(date +"%Y-%m-%d %T")" End of process"
}

# register the cleanup function to be called on the EXIT signal
trap cleanup EXIT

# implementation of script starts here
curlftpfs ftp://$FTPHOST$FTPD -o user="$FTPUSER:$FTPPASS" "$FTP_DIR"

echo $(date +"%Y-%m-%d %T")" FTP mounted in $FTP_DIR"

### Files backup ###

echo $(date +"%Y-%m-%d %T")" Starting files backup"

WORKING_DIR=$BACKUP_DIR/$NOW

echo $(date +"%Y-%m-%d %T")" Create $WORKING_DIR directory"
mkdir -p "$WORKING_DIR"

echo $(date +"%Y-%m-%d %T")" Backup directory /etc to $WORKING_DIR/etc.tar"
tar -cf "$WORKING_DIR/etc.tar" "/etc" # to simplify will copy it all
echo $(date +"%Y-%m-%d %T")" Backup directory $FILES_DIR to $WORKING_DIR/files.tar"
tar -cf "$WORKING_DIR/files.tar" "$FILES_DIR"

ARCHIVE=$BACKUP_DIR/files-$NOW.tar.gz

echo $(date +"%Y-%m-%d %T")" Compress directory $WORKING_DIR to $ARCHIVE"
tar -zcf "$ARCHIVE" --remove-files "$WORKING_DIR"
rm -rf "$WORKING_DIR"

echo $(date +"%Y-%m-%d %T")" Files backup created in $ARCHIVE"

### check free space on ftp server ###
ARCHIVE_SIZE=$(stat -c%s "$ARCHIVE")
echo $(date +"%Y-%m-%d %T")" File size : $ARCHIVE_SIZE"
FTP_DIR_SIZE=$(du -cb "$FTP_DIR" | awk 'END{print $1}')
echo $(date +"%Y-%m-%d %T")" FTP space used $FTP_DIR_SIZE"
while [ $(($FTP_DIR_SIZE+$ARCHIVE_SIZE)) -ge $FTPSIZE ];
do
    FILE_TO_DELETE=$(ls -t "$FTP_DIR" | tail -1)
    echo $(date +"%Y-%m-%d %T")" Delete $FILE_TO_DELETE from FTP"
    rm "$FTP_DIR/$FILE_TO_DELETE"
    FTP_DIR_SIZE=$(du -cb "$FTP_DIR" | awk 'END{print $1}')
    echo $(date +"%Y-%m-%d %T")" FTP space used $FTP_DIR_SIZE"
done

echo $(date +"%Y-%m-%d %T")" Copy $ARCHIVE to FTP"

curl --user $FTPUSER:$FTPPASS --upload-file "$ARCHIVE" ftp://$FTPHOST$FTPD
if [ $? != 0 ]; then
  echo "Error: Could not copy $ARCHIVE to FTP server"
  echo "Error when coping $ARCHIVE to FTP server" | mail -s "Backup Error" "#EMAIL"
else
  echo $(date +"%Y-%m-%d %T")" Files backup moved to FTP"
fi

### clear ###

echo $(date +"%Y-%m-%d %T")" Delete $ARCHIVE"
rm -rf "$ARCHIVE"
echo $(date +"%Y-%m-%d %T")" End of files backup"

### Databases backup ###
echo $(date +"%Y-%m-%d %T")" Starting databases backup"

WORKING_DIR=$BACKUP_DIR/$NOW
echo $(date +"%Y-%m-%d %T")" Create $WORKING_DIR directory"
mkdir -p "$WORKING_DIR"

### Backup each databases ###
DBS="$(mysql -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')"
if [ $? != 0 ]; then
  echo "Error: Could not list databases"
  echo "Could not list databases" | mail -s "Backup Error" "#EMAIL"
  return 1
fi

for DB in $DBS
do
    mkdir "$WORKING_DIR/$DB"
    DB_ARCHIVE=$WORKING_DIR/$DB/$DB.sql.gz
    echo $(date +"%Y-%m-%d %T")" Backup database $DB to $DB_ARCHIVE"
    MYSQL_PWD=$MPASS mysqldump --add-drop-table --single-transaction --skip-lock-tables --allow-keywords -q -c -u $MUSER -h $MHOST "$DB" | gzip -9 > "$DB_ARCHIVE"
done

ARCHIVE=$BACKUP_DIR/databases-$NOW.tar.gz
echo $(date +"%Y-%m-%d %T")" Compress directory $WORKING_DIR to $ARCHIVE"
tar -zcf "$ARCHIVE" --remove-files "$WORKING_DIR"
rm -rf "$WORKING_DIR"

echo $(date +"%Y-%m-%d %T")" Databases backup created in $ARCHIVE"

### check free space on ftp server ###
ARCHIVE_SIZE=$(stat -c%s "$ARCHIVE")
echo $(date +"%Y-%m-%d %T")" File size : $ARCHIVE_SIZE"
FTP_DIR_SIZE=$(du -cb "$FTP_DIR" | awk 'END{print $1}')
echo $(date +"%Y-%m-%d %T")" FTP space used $FTP_DIR_SIZE"
while [ $(($FTP_DIR_SIZE+$ARCHIVE_SIZE)) -ge $FTPSIZE ];
do
    FILE_TO_DELETE=$(ls -t "$FTP_DIR" | tail -1)
    echo $(date +"%Y-%m-%d %T")" Delete $FILE_TO_DELETE from FTP"
    rm "$FTP_DIR/$FILE_TO_DELETE"
    FTP_DIR_SIZE=$(du -cb "$FTP_DIR" | awk 'END{print $1}')
    echo $(date +"%Y-%m-%d %T")" FTP space used $FTP_DIR_SIZE"
done

echo $(date +"%Y-%m-%d %T")" Copy $ARCHIVE to FTP"
curl --user $FTPUSER:$FTPPASS --upload-file "$ARCHIVE" ftp://$FTPHOST$FTPD
if [ $? != 0 ]; then
  echo "Error: Could not copy $ARCHIVE to FTP server"
  echo "Error when coping $ARCHIVE to FTP server" | mail -s "Backup Error" "#EMAIL"
else
  echo $(date +"%Y-%m-%d %T")" Database backup moved to FTP"
fi

### clear ###
echo $(date +"%Y-%m-%d %T")" Delete $ARCHIVE"
rm -rf "$ARCHIVE"
echo $(date +"%Y-%m-%d %T")" End of databases backup"Langage du code : Bash (bash)

Programmer les popups de Popup Builder

La version gratuite du plugin WordPress Popup Builder ne permet pas programmer l’affichage des popups. Cependant elle créé le filtre sgpbOtherConditions qui permet de les désactiver.

Ce filtre est appelé pour chaque popup qui peut s’afficher sur la page et si l’argument ‘status’ à false est ajouté à ceux existants, la popup ne s’affiche pas.

	/**
	 * Check Popup conditions
	 *
	 * @since 1.0.0
	 *
	 * @return array
	 *
	 */
	private function isSatisfyForOtherConditions()
	{
		$popup = $this->getPopup();
		$popupOptions = $popup->getOptions();
		$popupId = $popup->getId();

		$dontAlowOpenPopup = apply_filters('sgpbOtherConditions', array('id' => $popupId, 'popupOptions' => $popupOptions, 'popupObj' => $popup));

		return $dontAlowOpenPopup['status'];
	}

Langage du code : PHP (php)

Pour désactiver automatiquement vos popups, vous pouvez ajouter ce code à functions.php

add_filter('sgpbOtherConditions', 'my_sgpbOtherConditions', 10, 1);

// update popin status
function my_sgpbOtherConditions($args = array()) {
    // if popup is already unactive, do nothing
    if (isset($args['status']) && $args['status'] === false) {
        return $args;
    }

    switch ($args['id']) {
        case 17938: // summer holiday active between 2021-07-30 and 2021-08-01
            $now = time() + 2 * 60 * 60; // for time zone, can be improved
            $from = strtotime('2021-07-30 00:00:00');
            $to = strtotime('2021-08-02 00:00:00');

            // if we are not between 2021-07-30 and 2021-08-01 desactivate the popup
            if (($now < $from) || ($now > $to)) {
                $args['status'] = false;
            }			
            break;
        case 16412:  // covid reassurance unactive between 2021-07-30 and 2021-08-01
            $now = time() + 2 * 60 * 60; // for time zone, can be improved
            $from = strtotime('2021-07-30 00:00:00');
            $to = strtotime('2021-08-02 00:00:00');

            // if we are between 2021-07-30 and 2021-08-01 desactivate the popup
            if (($now >= $from) && ($now <= $to)) {
                $args['status'] = false;
            }
            break;
    }
    return $args;	
}Langage du code : PHP (php)

Ainsi la popup 17938 ne sera active qu’entre le 30 juillet et le 1 août 2021 alors que la 16412 ne le sera que le reste du temps.

Rediriger les fiches produits dans WooCommerce

Dans WooCommerce chaque produit a une page dédiée. Dans le panier, les produits renvoient à celles-ci.

Si vous voulez désactiver cette fonctionnalité et afficher une page avec tous vos produits, vous pouvez ajouter ce code à functions.php

// redirige les pages produits
add_action('wp','prevent_access_to_product_page');
function prevent_access_to_product_page(){
  if ( is_product() ) {
    wp_redirect( get_permalink( 269 ) );
  }
}Langage du code : PHP (php)

Ainsi toutes les pages produits redirigeront vers la page 269.

Source : How to disable/hide woocommerce single product page?

Autoriser les images avec des longs ID dans PrestaShop

Par construction PrestaShop ne peut pas gérer les images avec des ID supérieurs à 9 999 999 (7 chiffres). C’est déjà beaucoup et on a pas souvent besoin de plus mais j’ai eu affaire à un script d’import qui impose les ID d’images et donc ça arrive.

Pourquoi PrestaShop ne les gèrent pas ?

En fait, PrestaShop n’a pas de soucis avec les ID de 8 chiffres ou plus, tant que la base de données l’accepte, lui aussi. Le problème vient de la façon d’accéder aux images.

L’URL d’une image est https://example.com/123-large/mon-image.jpg soit [url de la boutique]/[ID de l'image]-[format à afficher]/[texte pour le référencement].jpg et le fichier .htaccess explique au serveur que quand on a une url de ce type, il faut aller chercher le fichier qu’il faut dans le dossier des images /img/p/

Le fichier .htaccess de PrestaShop ressemble à ça

RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]Langage du code : JavaScript (javascript)

Donc quand le serveur reçoit l’URL https://example.com/123-large/mon-image.jpg il affiche le fichier /img/p/1/2/3/123-large.jpg. C’est rapide et ça ne demande pas de ressource, PrestaShop n’est même pas appelé quand on veut afficher une image produit.

Mais on ne peut pas utiliser $10 dans un fichier .htaccess, il est interprété comme $1 puis le caractère 0. Comme dans la dernière ligne de l’extrait ci-dessus on utilise $9, on ne peut pas aller plus loin.

Ma solution

Si on appelle l’URL https://example.com/123456789-large/mon-image.jpg, le serveur ne reconnait pas ce format et essaye simplement d’afficher le fichier /123456789-large/mon-image.jpg qui n’existe pas et renvoie donc une erreur 404. PrestaShop affiche donc une jolie page pour dire que le fichier n’a pas été trouvée.

L’astuce consiste à utiliser cette page pour afficher l’image demandée en complétant le controller PageNotFound.

<?php
class PageNotFoundController extends PageNotFoundControllerCore
{
    public function initContent()
    {
        list($filename) = explode('?', $_SERVER['REQUEST_URI']);
        if (preg_match('/([0-9]+)(\-[_a-zA-Z0-9-]*)?\/.*\.jpg/', $filename, $matches)) {
            $path = _PS_ROOT_DIR_.'/img/p/'.implode('/', str_split($matches[1], 1)).'/'.$matches[1].$matches[2].'.jpg';
            if (file_exists($path)) {
                header('Content-Type: '.mime_content_type($path)?:'image/jpg');
                readfile($path);
                die();
            } else {
                header('HTTP/1.1 404 Not Found');
                header('Status: 404 Not Found');
                header('Content-Type: image/gif');
                readfile(_PS_ROOT_DIR_.'/img/404.gif');
                die();
            }
        }
        return parent::initContent();
    }
}Langage du code : PHP (php)

Code à placer dans /override/controllers/front/PageNotFoundController.php

Le principe est le suivant :

  • quand le controller PageNotFound est appelé, on regarde si l’URL correspond à celle d’une image produit,
  • si oui on regarde si elle existe,
    • si oui on l’affiche et c’est terminé
    • si non on affiche une image d’erreur
  • si non on laisse le controller gérer

Sources :

input-date pour Vue3

Pareil que pour nl2br, j’ai voulu utiliser un champ date dans Vue3 mais le code que j’utilisais dans vue.js ne fonctionne pas.

Voici mon adaptation

// adapted from https://acdcjunior.github.io/how-bind-date-object-to-input-date-vue.js-v-model.html
{
    props: ['modelValue'],
    emits: ['update:modelValue'],
    setup() {
        const dateToYYYYMMDD = (d) => {
            // alternative implementations in https://stackoverflow.com/q/23593052/1850609
            try {
                return d && new Date(d.getTime()-(d.getTimezoneOffset()*60*1000)).toISOString().split('T')[0];
            } catch(e) {
                return null;
            }
        };
        return {
            dateToYYYYMMDD,
        }
    },
    template: `
      <input
        v-model="value"
        type="date"
        @input="$emit('update:modelValue', $event.target.valueAsDate)"
    />
    `,
    computed: {
      value: {
        get() {
            return this.dateToYYYYMMDD(this.modelValue);
        },
        set(value) {
        }
      }
    }
}Langage du code : JavaScript (javascript)

nl2br pour Vue3

J’ai voulu utiliser nl2br pour vue.js mais il n’est pas compatible avec Vue3.

Voici mon adaptation

// Adapted from https://github.com/inouetakuya/vue-nl2br/
{
    props: {
        tag: {
            type: String,
            required: true,
        },
        text: {
            type: String,
            required: true,
        },
        className: {
            type: String,
            required: false,
        },
    },
    setup(props) {
        return () =>
            Vue.h(
                props.tag,
                {
                    'class': props.className
                },
                props.text.split('\n').reduce((accumulator, string) => {
                    if (!Array.isArray(accumulator)) {
                        return [accumulator, Vue.h('br'), string]
                    }
                    return accumulator.concat([Vue.h('br'), string])
                })
            );
    },
};Langage du code : JavaScript (javascript)

iframe remplacé par i-frame dans Joomla

Si dans Joomla les balises <iframe>  sont remplacées par <i-frame> , c’est peut être à cause de RSFirewall!

La solution pour désactiver ce comportement est là : Scrambled tags (iframe becomes i-frame)

Le plus simple est de désactiver la protection pour son IP en l’ajoutant dans Composants > RSFirewall! > Blocklist/Safelist, bouton « Nouveau » et en sélectionnant « Safelist ».

 

Télécharger un dossier depuis Google Drive à partir du terminal

Pour faire suite à Télécharger un fichier depuis Google Drive à partir du terminal, j’ai eu à télécharger tout un dossier et la méthode décrite ne peut pas fonctionner.

J’ai donc utilisé rclone et ça fonctionne très bien. C’est plus long parce qu’il faut créer une application comme décrit dans la documentation mais une fois configuré c’est simple.

rclone copy drive:dossier_source ../dossier_destination

Il est dit sur la page de téléchargement comment l’installer mais ce n’est pas utile. Il fonctionne en décompressant l’archive et en l’exécutant dans le dossier créé.