jweiland-net / events2

With this TYPO3 extension you can organize one, multiple and recurring events.
GNU General Public License v2.0
18 stars 16 forks source link

documentation needed: how to use the importer #471

Closed ChristianHeimke closed 4 months ago

ChristianHeimke commented 6 months ago

I'm totally new to typo3 and need to import ~100 events to this plugin backend. The events are managed in an xls file - according to https://docs.typo3.org/p/jweiland/events2/main/en-us/FAQ/Index.html#can-i-import-events and https://github.com/jweiland-net/events2/blob/main/Tests/Functional/Fixtures/XmlImport/Success.xml I transformed the xls to xml based on the fixture with a small ruby script. But the documentation did not go further... How can I import the generated xml? could you please provide a beginner documentation how to use the importer? I guess it is pretty easy if you understand how typo3 works...

or maybe provide a cli interface to import it - that would be awesome :)

sfroemkenjw commented 6 months ago

Moin @ChristianHeimke

welcome to the TYPO3 universe ;-)

PLease install and/or activate the TYPO3 own extension scheduler. Either with composer req typo3/cms-scheduler at a composer-based installation or visit the extensionmanager and activate the scheduler extension in zip package installation.

After that you got a new TYPO3 backend module scheduler or Planer (in germany). In this module you can create new tasks. From the list of tasks you can select the events2 importer. Fill in all the needed fields like iteration, date, storage page and of cause a path to your XML file on the server. You don't have the file on server? Please upload it your server. Maybe to fileadmin directory and set absolute path in task. Save the record.

Now you can execute the importer manually in scheduler module.

If you want to import the events recurring you should create a cronjob at your hosters customer menu and execute the typo3 binary:

ZIP-package: typo3/sysext/core/bin/typo3 scheduler:run

Composer: vendor/bin/typo3 scheduler:run

Nice greetings

Stefan

ChristianHeimke commented 4 months ago

hi @sfroemkenjw,

thank you for your help - but I didn't get it working :-/

the current settings are: image

the simple.xml file is the one from your fixtures.

if I run the task, it will fail with the error Call to a member function hasFile() on null or from the logs

Fri, 07 Jun 2024 06:29:30 +0000 [ERROR] request="7d87e859ec97d" component="TYPO3.CMS.Scheduler.Scheduler": Task failed to execute successfully. Class: JWeiland\Events2\Task\Import, UID: 1- Error: Call to a member function hasFile() on null, in file /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Resource/ResourceFactory.php:393 - {"class":"JWeiland\\Events2\\Task\\Import","uid":1,"exception":"Error: Call to a member function hasFile() on null in /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Resource/ResourceFactory.php:393\nStack trace:\n#0 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Resource/ResourceFactory.php(299): TYPO3\\CMS\\Core\\Resource\\ResourceFactory->getObjectFromCombinedIdentifier('99:fileadmin/us...')\n#1 /var/www/html/typo3conf/ext/events2/Classes/Task/Import.php(53): TYPO3\\CMS\\Core\\Resource\\ResourceFactory->retrieveFileOrFolderObject('99:fileadmin/us...')\n#2 /var/www/html/typo3_src-12.4.13/typo3/sysext/scheduler/Classes/Scheduler.php(175): JWeiland\\Events2\\Task\\Import->execute()\n#3 /var/www/html/typo3_src-12.4.13/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php(513): TYPO3\\CMS\\Scheduler\\Scheduler->executeTask(Object(JWeiland\\Events2\\Task\\Import))\n#4 /var/www/html/typo3_src-12.4.13/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php(108): TYPO3\\CMS\\Scheduler\\Controller\\SchedulerModuleController->executeTasks(Object(TYPO3\\CMS\\Backend\\Template\\ModuleTemplate), Array)\n#5 /var/www/html/typo3_src-12.4.13/typo3/sysext/backend/Classes/Http/RouteDispatcher.php(77): TYPO3\\CMS\\Scheduler\\Controller\\SchedulerModuleController->handleRequest(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#6 /var/www/html/typo3_src-12.4.13/typo3/sysext/backend/Classes/Http/RequestHandler.php(104): TYPO3\\CMS\\Backend\\Http\\RouteDispatcher->dispatch(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#7 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Middleware/ResponsePropagation.php(34): TYPO3\\CMS\\Backend\\Http\\RequestHandler->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#8 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Core\\Middleware\\ResponsePropagation->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(TYPO3\\CMS\\Backend\\Http\\RequestHandler))\n#9 /var/www/html/typo3_src-12.4.13/typo3/sysext/backend/Classes/Middleware/SiteResolver.php(64): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#10 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Backend\\Middleware\\SiteResolver->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))\n#11 /var/www/html/typo3_src-12.4.13/typo3/sysext/backend/Classes/Middleware/SudoModeInterceptor.php(51): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#12 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Backend\\Middleware\\SudoModeInterceptor->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))\n#13 /var/www/html/typo3_src-12.4.13/typo3/sysext/backend/Classes/Middleware/AdditionalResponseHeaders.php(37): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#14 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Backend\\Middleware\\AdditionalResponseHeaders->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))\n#15 /var/www/html/typo3_src-12.4.13/typo3/sysext/backend/Classes/Middleware/ContentSecurityPolicyHeaders.php(50): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#16 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Backend\\Middleware\\ContentSecurityPolicyHeaders->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))\n#17 /var/www/html/typo3_src-12.4.13/typo3/sysext/backend/Classes/Middleware/OutputCompression.php(43): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#18 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Backend\\Middleware\\OutputCompression->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))\n#19 /var/www/html/typo3_src-12.4.13/typo3/sysext/backend/Classes/Middleware/BackendModuleValidator.php(194): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#20 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Backend\\Middleware\\BackendModuleValidator->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))\n#21 /var/www/html/typo3_src-12.4.13/typo3/sysext/backend/Classes/Middleware/BackendUserAuthenticator.php(159): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#22 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Backend\\Middleware\\BackendUserAuthenticator->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))\n#23 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Middleware/RequestTokenMiddleware.php(71): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#24 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Core\\Middleware\\RequestTokenMiddleware->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))\n#25 /var/www/html/typo3_src-12.4.13/typo3/sysext/backend/Classes/Middleware/BackendRouteInitialization.php(80): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#26 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Backend\\Middleware\\BackendRouteInitialization->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))\n#27 /var/www/html/typo3_src-12.4.13/typo3/sysext/backend/Classes/Middleware/ContentSecurityPolicyReporter.php(41): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#28 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Backend\\Middleware\\ContentSecurityPolicyReporter->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))\n#29 /var/www/html/typo3_src-12.4.13/typo3/sysext/backend/Classes/Middleware/ForcedHttpsBackendRedirector.php(55): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#30 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Backend\\Middleware\\ForcedHttpsBackendRedirector->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))\n#31 /var/www/html/typo3_src-12.4.13/typo3/sysext/backend/Classes/Middleware/LockedBackendGuard.php(71): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#32 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Backend\\Middleware\\LockedBackendGuard->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))\n#33 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Middleware/NormalizedParamsAttribute.php(41): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#34 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Core\\Middleware\\NormalizedParamsAttribute->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))\n#35 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Middleware/VerifyHostHeader.php(55): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#36 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(162): TYPO3\\CMS\\Core\\Middleware\\VerifyHostHeader->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))\n#37 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(70): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#38 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/AbstractApplication.php(80): TYPO3\\CMS\\Core\\Http\\MiddlewareDispatcher->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#39 /var/www/html/typo3_src-12.4.13/typo3/sysext/backend/Classes/Http/Application.php(58): TYPO3\\CMS\\Core\\Http\\AbstractApplication->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#40 /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Http/AbstractApplication.php(92): TYPO3\\CMS\\Backend\\Http\\Application->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#41 /var/www/html/typo3_src-12.4.13/typo3/index.php(20): TYPO3\\CMS\\Core\\Http\\AbstractApplication->run()\n#42 /var/www/html/typo3_src-12.4.13/typo3/index.php(21): {closure}()\n#43 {main}"}
Fri, 07 Jun 2024 06:29:30 +0000 [CRITICAL] request="7d87e859ec97d" component="TYPO3.CMS.Core.Error.ProductionExceptionHandler": Core: Exception handler (WEB: BE): Error, code #0, file /var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Resource/ResourceFactory.php, line 393: Call to a member function hasFile() on null - {"mode":"WEB","application_mode":"BE","exception_class":"Error","exception_code":0,"file":"/var/www/html/typo3_src-12.4.13/typo3/sysext/core/Classes/Resource/ResourceFactory.php","line":393,"message":"Call to a member function hasFile() on null","request_url":"http://localhost:8080/typo3/module/scheduler/manage?token=--AnonymizedToken--","exception":null}

I have no idea why. The 99 it set randomly - with 1 it fails with another error: Currently no file for import found.
The storage pid 2 is the id from the folder I've created via the list view - without knowing if this is the right way. Maybe you can clearify what IDs needs to be set and how to find them.

I've uploaded the file via typ3 - creating it via ssh didn't change anything. neither if I use the absolut filesystem path, no r the relative path

Thank you very much 🙏

ChristianHeimke commented 4 months ago

@sfroemkenjw ... friendly reminder ping... 🙏 🙏 🙏

sfroemkenjw commented 4 months ago

Relates: #475

Hello @ChristianHeimke

I'm pretty sure the defined file path is wrong. Usually 1:/ is your fileadmin folder where 1 is the UID of the sys_file_storage record (on PID 0) containing the configuration for fileadmin directory. Sure, the UID can also be 2, 3or 5, but having fileadmin configuration in a sys_file_storage with UID 99 looks very very suspect to me. Please check, if that UID is correct. Sure, you have written randomly, but please keep it 1.

Next problem is the path to the xml file. As 1:/ already contains the absolute path including the fileadmin directory, you only need to set the rest of the path to your xmlfile.

Example: 1:/user_upload/simple.xml

I have just tested that and the file will be found then. But there seems to be further problems with newer PHP versions. I have just provided a new patch and relate it to your issue here.

Unfortnaturly the GitHub alternative CodeBerg for static_info_tables is down. So I can't provide a new release.

Stefan

sfroemkenjw commented 4 months ago

I have just released version 9.0.7 which catches some issues with the importer classes. As you both reacted with heart-icon it already seams to work. I'm closing that issue now