Come escludere file e cartelle

BackWPup let you exclude some files and folders in the back up process through is settings page. We recently implemented new hooks to let you manage and extends these setting via code. Here follows a brief tutorial on how to achieve that result. Exclude Settings On the BackWPup Settings page, click on Data under your…

Home Domande frequenti Come escludere file e cartelle

BackWPup di escludere alcuni file e cartelle dal processo di backup tramite la pagina delle impostazioni. Recentemente abbiamo implementato nuovi hook per consentire di gestire ed estendere queste impostazioni tramite codice. Di seguito è riportato un breve tutorial su come ottenere questo risultato.

Escludi impostazioni

On the BackWPup Settings page, click on Data under your Files backup card, then select the gear icon next to Files to manage exclusion settings.

Qui puoi scegliere quali file e cartelle delle tue installazioni non devono essere inclusi nel backup.

Tuttavia, i nuovi hook dei filtri consentono ora di ampliare anche alcune di queste possibilità.

Inoltre, invece di gestirlo a livello di back-end, puoi utilizzare un filtro per impostare un'opzione.

Esaminiamo ogni punto uno per uno.

Aggiungi cartelle da escludere nell'elenco delle cartelle dei contenuti di backup

The hook backwpup_content_exclude_dirs lets you add directories in the list of the ones that you wish to exclude from the backup process in your wp-content WordPress directory.

Suppose you have the folders named just-a-folder and another-folder in your WordPress wp-content directory. If you want to add these folders to the Backup content folder exclude list, you can implement the following filter:

add_filter(
      'backwpup_content_exclude_dirs',
      function ($directories) {
          array_push(
                      $directories,
                      'just-a-folder',
                      'another-folder'
                    );
          return $directories;
      }
);

Nelle impostazioni troverai queste opzioni relative alle cartelle da escludere.

Aggiungi cartelle da escludere in altri elenchi delle impostazioni

Allo stesso modo, come descritto nella sezione precedente, se devi aggiungere nuove directory da escludere dal backup, puoi creare un filtro personalizzato. Puoi farlo utilizzando gli hook elencati qui di seguito:

backwpup

This hook lets you extend the Backup plugins list. It lets you add the folders you want to exclude in your WordPress wp-content/plugins directory.

backwpup

This hook lets you extend the Backup themes list. It lets you add the folders you want to exclude in your WordPress wp-content/themes directory

backwpup

This hook lets you extend the Backup upload folder list. It lets you add the folders you want to exclude in your WordPress wp-content/upload directory

Escludi file e cartelle

If you need to exclude any folder or file from the WordPress root directory on your server, you can use the Exclude files/folders from backup text area in the GUI: just add the folders and the file extensions you want to exclude, separated by comma.

But if you want to achieve the same result using a filter, this is again possible via the hook backwpup_file_exclude .

Di seguito ti forniamo un esempio di implementazione che ti permette di aggiungere due estensioni di file (.pdf e .epub) all'elenco dei file che desideri escludere dal backup.

add_filter(
    'backwpup_file_exclude',
    function ($fileExtensions) {
        return $fileExtensions . ',.pdf,.epub';
    }
);

Quindi, se andiamo nelle impostazioni, possiamo vedere come queste due estensioni siano state correttamente configurate nella sezione " Escludi file/cartelle/estensioni dal backup", come mostrato di seguito.

Proteggi WordPress tuo WordPress

Garantisci ai dati del tuo sito web la protezione che meritano con BackWPup Pro.