gadgetto / UserImport

An extra to easily import users into the MODX user database and batch-assign MODX user groups and roles.
GNU General Public License v2.0
3 stars 4 forks source link

SQL Error #12

Closed jcthomas00 closed 4 years ago

jcthomas00 commented 4 years ago

Hi, I'm not sure if you still work on UserImport but I tried using it today and got the following error:

[2020-05-12 09:22:33] (ERROR @ /paas/c0413/www/core/xpdo/xpdo.class.php : 1289) Could not get table name for class: modAccess
[2020-05-12 09:22:33] (ERROR @ /paas/c0413/www/core/xpdo/om/xpdoobject.class.php : 240) Error 42000 executing statement: 
Array
(
    [0] => 42000
    [1] => 1064
    [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS `modAccess` WHERE `modAccess`.`principal` = 32' at line 1
).

If you could tell me how I can resolve this, I'll be very grateful. Thank you.

gadgetto commented 4 years ago

How/when does the error occur? Could you please list the steps to reproduce this? Which MODX version? Which PHP version?

The log entries you posted are from an older MODX problem which has nothing to do with UserImport. https://github.com/modxcms/revolution/issues/13725

jcthomas00 commented 4 years ago

Thanks for responding, Martin.

You are correct, that error seems unrelated to UserImport as I didn't get that error again. However, I'm still unable to import users. There is no error message in console or logs. This is the file I used (renamed with txt extension for upload) new2.txt

I'm running MODX Revolution 2.7.1-pl and PHP 7.1

These are what my settings look like: image

Could you tell me what I'm doing incorrectly? I need to import 750 users and would really like to use your extra.

gadgetto commented 4 years ago

I just imported the 2 users from your new2.txt file without any problems (there was only a PHP warning - undefined index dob, which I have to check why this happens). What does the import console window show when you run the import?

Am 13.05.2020 um 14:29 schrieb Jacob Thomas notifications@github.com:

Thanks for responding, Martin.

You are correct, that error seems unrelated to UserImport as I didn't get that error again. However, I'm still unable to import users. There is no error message in console or logs. This is the file I used (renamed with txt extension for upload) new2.txt https://github.com/gadgetto/UserImport/files/4621924/new2.txt I'm running MODX Revolution 2.7.1-pl and PHP 7.1

These are what my settings look like: https://user-images.githubusercontent.com/14240957/81736691-91aa9880-945c-11ea-86a4-152f4fc4ed19.png Could you tell me what I'm doing incorrectly? I need to import 750 users and would really like to use your extra.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gadgetto/UserImport/issues/12#issuecomment-627949692, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGWBQLSR4R5WNALEZGKPQ3RRKHDXANCNFSM4M64XK5A.

jcthomas00 commented 4 years ago

It stalls after showing batch size:

Screen Shot 2020-05-13 at 8 13 44 AM
gadgetto commented 4 years ago

It could be a file/folder access problem. Where do you rund the MODX website?

It seems that the file handle could not be established. Normally if this happens there should be an error message in console window.

Could you please also open the browser developer console and look for any JS errors?

Am 13.05.2020 um 15:15 schrieb Jacob Thomas notifications@github.com:

It stalls after showing batch size: https://user-images.githubusercontent.com/14240957/81817109-d5031680-94f1-11ea-93c8-163a88d19fd4.png — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gadgetto/UserImport/issues/12#issuecomment-627978060, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGWBQLSCUZUL6POPGGPIULRRKMPVANCNFSM4M64XK5A.

jcthomas00 commented 4 years ago

There are 2 JS error when I try uploading the file. Is this something I need to resolve with my server? I'm hosted on ModX Cloud.

Screen Shot 2020-05-13 at 9 05 12 AM
gadgetto commented 4 years ago

Seems there is some limitation or lock for uploading files. Is the php tmp directory accessible? Maybe a provider limitation?

jcthomas00 commented 4 years ago

The tmp directory in the root has 775 permission. Is that the folder it's trying to upload to? Can I change the upload directory to fix this?

gadgetto commented 4 years ago

When uploading a file via Browser/PHP a temporary file is created within the PHP tmp directory. Where this directory is located, depends on your provider. This directory can’t be configured from within UserImport but you can override these settings using the .htaccess file (if your provider allows this).

The PHP tmp directory is not inside your webroot!

Here is an excerpt from a php.ini setup file:

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files.
; Will use system default if not set.
;upload_tmp_dir = 

; Maximum allowed size for uploaded files.
upload_max_filesize = 16M

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20

; Maximum size of POST data that PHP will accept.
post_max_size = 20M

max_input_time = 60
memory_limit = 128M
max_execution_time = 30
jcthomas00 commented 4 years ago

Hi Martin,

after some back-and-forth with my hosting tech support, they pointed that Ereg() is not supported in PHP 7 and causes this error: [13-May-2020 20:59:19 America/Chicago] PHP Fatal error: Uncaught Error: Call to undefined function ereg() in /www/core/components/userimport/model/userimport/importhandler.class.php:762

Do you have any suggestions for this? Thanks.

gadgetto commented 4 years ago

This will be fixed in upcoming release! Thanks for reporting - and good catch!

In the meantime you can replace the file core/components/userimport/model/userimport/importhandler.class.php

with the new one from GitHub.