UNIMOODLE / moodle-mod_certifygen

GNU General Public License v3.0
1 stars 1 forks source link

Error en cron checkfile #24

Open juacas opened 2 months ago

juacas commented 2 months ago

Escenario:

Parece que se obtiene un modelo con validador null y no se puede instanciar la clase por fallar el nombre.

Pasos a dar:

Datos

mdl_certifygen_model

id name idnumber type mode templateid timeondemmand langs validation report usermodified timecreated timemodified
1 Curso superado Curso_STD_Superado 1 1 2 30 en,es certifygenvalidation_csv \N 2 1722344489 1724854903

mdl_certifygen_validations

id name courses code certifygenid issueid userid modelid lang status usermodified timecreated timemodified
12 \N \N \N 2 8 2963 1 en 3 2 1724855872 1724856035
13 \N \N \N 2 9 108 1 en 3 2 1724856366 1724856800

mdl_certifygen_validationcsv

id validationid applicationid token usermodified timecreated timemodified
3 13 FIRMA-DOCUMENTAL-2024-01124 2232944272BB 108 1724856376 1724856376

El cron genera un error al obtener un valor "null" del método de validación del modelo.

Execute scheduled task: Comprobar archivos (mod_certifygen\task\checkfile)
... started 16:52:38. Current memory use 3.0 MB.

Deprecated: simplexml_load_string(): Passing null to parameter #3 ($options) of type int is deprecated in /var/www/html/moodle403/mod/certifygen/validation/csv/classes/certifygenvalidation_csv.php on line 304

Call Stack:
    0.2834     382152   1. {main}() /var/www/html/moodle403/admin/cron.php:0
    0.3212     848080   2. core\cron::run_main_process($keepalive = 0) /var/www/html/moodle403/admin/cron.php:80
    0.3645     970376   3. core\cron::run_scheduled_tasks($startruntime = 1724856757, $startprocesstime = 1724856757) /var/www/html/moodle403/lib/classes/cron.php:125
    0.6143    3129160   4. core\cron::run_inner_scheduled_task($task = class mod_certifygen\task\checkfile { private ${core\task\task_base}lock = class core\lock\lock { protected $key = 'b59edb5dfed67e5b370d79311942b166dcc6b688'; protected $factory = class core\lock\mysql_lock_factory { ... }; protected $released = FALSE; protected $caller = '/var/www/html/moodle403/lib/classes/task/manager.php on line 1059' }; private ${core\task\task_base}cronlock = NULL; private ${core\task\task_base}component = 'mod_certifygen'; private ${core\task\task_base}blocking = FALSE; private ${core\task\task_base}faildelay = '0'; private ${core\task\task_base}nextruntime = '1724856660'; private ${core\task\task_base}timestarted = 1724856758; private ${core\task\task_base}hostname = '578587b3f2fe'; private ${core\task\task_base}pid = 62135; private ${core\task\scheduled_task}hour = '*'; private ${core\task\scheduled_task}minute = '*'; private ${core\task\scheduled_task}day = '*'; private ${core\task\scheduled_task}month = '*'; private ${core\task\scheduled_task}dayofweek = '*'; private ${core\task\scheduled_task}lastruntime = '1724855382'; private ${core\task\scheduled_task}customised = '1'; private ${core\task\scheduled_task}overridden = FALSE; private ${core\task\scheduled_task}disabled = FALSE }) /var/www/html/moodle403/lib/classes/cron.php:208
    0.6213    3148480   5. mod_certifygen\task\checkfile->execute() /var/www/html/moodle403/lib/classes/cron.php:405
    0.6386    3234624   6. certifygenvalidation_csv\certifygenvalidation_csv->getFile($courseid = 28, $validationid = 12, $code = '3860261980KA') /var/www/html/moodle403/mod/certifygen/classes/task/checkfile.php:80
    1.5516    3401312   7. simplexml_load_string($data = '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:obtenerContenidoDocumentoResponse xmlns:ns2="http://firma.ws.producto.com/"><obtenerContenidoDocumento><docsPeticion><documentos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="http://dto.firma.ws.producto.com" xsi:type="ns4:tDocumentoDTO"><descripcion>3860261980KA</descripcion><nombre>3860261980KA</nombre><datos>JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9Db2xvclNwYWNlL0RldmljZVJHQi9TdWJ0eXBlL0ltYWdlL0hlaWdodCAyNC'..., $class_name = NULL, $options = NULL, $namespace_or_prefix = 'http://schemas.xmlsoap.org/soap/envelope/') /var/www/html/moodle403/mod/certifygen/validation/csv/classes/certifygenvalidation_csv.php:304

... used 13 dbqueries
... used 0.96750092506409 seconds
Scheduled task failed: Comprobar archivos (mod_certifygen\task\checkfile),Class "\" not found
Backtrace:
* line 405 of /lib/classes/cron.php: call to mod_certifygen\task\checkfile->execute()
* line 208 of /lib/classes/cron.php: call to core\cron::run_inner_scheduled_task()
* line 125 of /lib/classes/cron.php: call to core\cron::run_scheduled_tasks()
* line 80 of /admin/cron.php: call to core\cron::run_main_process()

Execute scheduled task: Comprobar estado de los certificados (mod_certifygen\task\checkstatus)
... started 16:52:39. Current memory use 3.2 MB.
juacas commented 2 months ago

Diagnosticado el problema de "Class "\" not found": se debe a que hay un cambio del modelo de datos sin upgrade.php, faltaba la columna "repository" en tabla de modelos.

Persiste el uso "deprecated" de simplexml_load_string() (Creo que es cambiar null por 0 en el tercer argumento).

juacas commented 1 month ago

Sigue apareciendo el error:

Entorno:

Execute scheduled task: Comprobar estado de los certificados (mod_certifygen\task\checkstatus)
... started 15:22:39. Current memory use 2.8 MB.

Deprecated: simplexml_load_string(): Passing null to parameter #3 ($options) of type int is deprecated in /var/www/html/moodle40/mod/certifygen/validation/csv/classes/certifygenvalidation_csv.php on line 696

Call Stack:
    0.0038     383328   1. {main}() /var/www/html/moodle40/admin/cron.php:0
    0.0313     795208   2. cron_run() /var/www/html/moodle40/admin/cron.php:81
    0.0555     912912   3. cron_run_scheduled_tasks($timenow = 1729084959) /var/www/html/moodle40/lib/cronlib.php:73
    0.0893    2888008   4. cron_run_inner_scheduled_task($task = class mod_certifygen\task\checkstatus { private ${core\task\task_base}lock = class core\lock\lock { protected $key = '7fb46201e80b529d30755a2feb5309f453906f30'; protected $factory = class core\lock\mysql_lock_factory { ... }; protected $released = FALSE; protected $caller = '/var/www/html/moodle40/lib/classes/task/manager.php on line 913' }; private ${core\task\task_base}cronlock = NULL; private ${core\task\task_base}component = 'mod_certifygen'; private ${core\task\task_base}blocking = FALSE; private ${core\task\task_base}faildelay = '0'; private ${core\task\task_base}nextruntime = '1729084920'; private ${core\task\task_base}timestarted = 1729084959; private ${core\task\task_base}hostname = '578587b3f2fe'; private ${core\task\task_base}pid = 43066; private ${core\task\scheduled_task}hour = '*'; private ${core\task\scheduled_task}minute = '*'; private ${core\task\scheduled_task}day = '*'; private ${core\task\scheduled_task}month = '*'; private ${core\task\scheduled_task}dayofweek = '*'; private ${core\task\scheduled_task}lastruntime = '0'; private ${core\task\scheduled_task}customised = '1'; private ${core\task\scheduled_task}overridden = FALSE; private ${core\task\scheduled_task}disabled = FALSE }) /var/www/html/moodle40/lib/cronlib.php:120
    0.0974    3374904   5. mod_certifygen\task\checkstatus->execute() /var/www/html/moodle40/lib/cronlib.php:263
    0.1054    3511176   6. certifygenvalidation_csv\certifygenvalidation_csv->get_status($validationid = 1, $code = '4194164710KA') /var/www/html/moodle40/mod/certifygen/classes/task/checkstatus.php:86
    0.2856    3530296   7. simplexml_load_string($data = '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:consultaEstadoPeticionResponse xmlns:ns2="http://firma.ws.producto.com/"><consultaEstadoPeticion><idAplicacion>MOODLE</idAplicacion><peticiones><estadoCircuito>FIRMADO</estadoCircuito><firmantes><estado>FIRMADO</estado><fechaFirma>2024-10-16T15:18:02+02:00</fechaFirma><id>UNIVERSIDAD</id></firmantes><identificador><token>4194164710KA</token><version>1</version></identificador><sustituye>true</sustituye></peticiones><result'..., $class_name = NULL, $options = NULL, $namespace_or_prefix = 'http://schemas.xmlsoap.org/soap/envelope/') /var/www/html/moodle40/mod/certifygen/validation/csv/classes/certifygenvalidation_csv.php:696