[Bug]: Add destinations to Backwpup with an addons plugins

Aperta
#127 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
php
Ambito
backend

Direzione di ricerca

Reproduce the runnow path from the jobs page, then inspect class-job.php (create) and start_http where BackWPup::get_registered_destinations() is called. Compare that registration timing with class-page-jobs.php and the backwpup_register_destination hook; done means the added destination is recognized during execution and the job no longer reports "No destination correctly defined".

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

type: bug
Description of the bug

Hello,

Your plugin has no native Pcloud implementation, so I’m trying to create an addon plugin to do this, I saw you had the “backwpup_register_destination” hook to add a destination, so I did this:

function addPcloud() {
if(is_plugin_active( 'backwpup/backwpup.php' )) {
require_once 'inc/class-destination-pcloud.php';
function register_destination_pcloud($registered_destinations) {
$registered_destinations["PCLOUD"] = [
'class' => \BackWPup_Destination_Pcloud::class,
'info' => [
'ID' => 'PCLOUD',
'name' => __('Pcloud', 'backwpup'),
'description' => __('Backup to Pcloud', 'backwpup'),
],
'can_sync' => false,
'needed' => [
'php_version' => '',
'functions' => ['curl_exec'],
'classes' => [],
],
];
return $registered_destinations;
}
add_filter('backwpup_register_destination', "register_destination_pcloud");
}
}

add_action('admin_init', 'addPcloud');

(it changes nothing to the bug if i change "admin_init" by "init" or if remove the if(is_plugin_active('backwpup/backwpup.php' ) )

I have copy the Dropbox Classes which have similar api connection to Pcloud and i have change all i need to change (for the moment, I have just a connection to Pcloud API and all the others functions are same as Dropbox).

It work, i can configure my job and get my pcloud token but when i launch the job via action : “runnow” (i don’t expect it send file because i don’t modify the function to do this) it don’t find the destination although my jobs is configured…

Bellow the log error :

[INFO] BackWPup 4.0.0; A project of Inpsyde GmbH
[INFO] WordPress 5.9.7
[INFO] Log Level: Debug
[INFO] BackWPup job: Opération avec l´ID 2; DBDUMP+FILE+WPPLUGIN
[INFO] Runs with user: (0)
[INFO] BackWPup no automatic job start configured
[INFO] BackWPup job started manually
[INFO] PHP ver.: 7.3.33 (32bit); cgi-fcgi; Linux
[INFO] Maximum PHP script execution time is 165 seconds
[INFO] Script restart time is configured to 30 seconds
[INFO] MySQL ver.: 5.7.42-log
[INFO] Web Server: Apache
[INFO] curl ver.: 7.38.0; OpenSSL/1.0.1t
[INFO] Temp folder is: /home/clapsoorbe/preprodcria/wp-content/uploads/backwpup-c16906-temp/
[INFO] Logfile is: /home/clapsoorbe/preprodcria/wp-content/uploads/backwpup-c16906-logs/backwpup_log_25fc73_2023-06-14_09-30-03.html
[INFO] Backup file is: /home/clapsoorbe/preprodcria/wp-content/uploads/backwpup-c16906-temp/2023-06-14_09-30-03_PXAWSBX202.zip
[14-Jun-2023 09:30:03] ERROR: No destination correctly defined for backup! Please correct job settings.
[14-Jun-2023 09:30:03] ERROR: Job has ended with errors in 0 seconds. You must resolve the errors for correct execution.

After some research, i found the function create (in class-job.php), and try many test, it seems that my destination don’t exist when BackWPup::get_registered_destinations() is call inside the function “create” (also in start_http which call the create function) but if i call BackWPup::get_registered_destinations() in the html of class-page-jobs.php my destination exist ! Therefore, the verification of the job’s destination don’t match with any listed destination.

I also found my Pcloud Class is not the problem, because i add Dropbox Class to my registered destination and reconfigure the task and it does the same !

Reproduction instructions

1- Create a plugin
2- add destinations (like explain in the description of the bug)
3- code your class based on dropbox
4- add a job and configure it
5- launch the job the jobs page link (action "runnow")

Expected behavior

I expect the code run and found my added destination.

Environment info

BackWPup 4.0.0
WordPress 5.9.7
PHP ver.: 7.3.33 (32bit)
Linux
MySQL ver.: 5.7.42-log
Web Server: Apache
curl ver.: 7.38.0

Relevant log output
[INFO] BackWPup 4.0.0; A project of Inpsyde GmbH
[INFO] WordPress 5.9.7
[INFO] Log Level: Debug
[INFO] BackWPup job: Opération avec l´ID 2; DBDUMP+FILE+WPPLUGIN
[INFO] Runs with user: (0)
[INFO] BackWPup no automatic job start configured
[INFO] BackWPup job started manually
[INFO] PHP ver.: 7.3.33 (32bit); cgi-fcgi; Linux
[INFO] Maximum PHP script execution time is 165 seconds
[INFO] Script restart time is configured to 30 seconds
[INFO] MySQL ver.: 5.7.42-log
[INFO] Web Server: Apache
[INFO] curl ver.: 7.38.0; OpenSSL/1.0.1t
[INFO] Temp folder is: /home/clapsoorbe/preprodcria/wp-content/uploads/backwpup-c16906-temp/
[INFO] Logfile is: /home/clapsoorbe/preprodcria/wp-content/uploads/backwpup-c16906-logs/backwpup_log_25fc73_2023-06-14_09-30-03.html
[INFO] Backup file is: /home/clapsoorbe/preprodcria/wp-content/uploads/backwpup-c16906-temp/2023-06-14_09-30-03_PXAWSBX202.zip
[14-Jun-2023 09:30:03] ERROR: No destination correctly defined for backup! Please correct job settings.
[14-Jun-2023 09:30:03] ERROR: Job has ended with errors in 0 seconds. You must resolve the errors for correct execution.
Additional context

No response

Code of Conduct
  • I agree to follow this project's Code of Conduct
Lingua principale
PHP
Stelle
96
Fork
48
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di wp-media/backwpup

Tutte le issue di wp-media/backwpup

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.