Fixed Allow importers to recommend a default value for the import table name

Jake B.

Well-known member
This would prevent quite a bit of confusion, obviously it'll only work the first time they use that importer, but the developer could easily check if the table exists and append an _{i} at the end to solve that.
 

Just one less thing for someone to have to enter themselves. Would also let XenForo recommend a format that could be automatically detected when installing the redirects add-on rather than sifting through the select menu - again, not really a big deal, just a small enhancement

And what's confusing about it?

Not sure, honestly. We've gotten a few tickets, as well as a reply to our resource asking about it. Mostly just people asking what it's for, and what they should enter.
 
I think pre-filling it with a value which could then be rejected because you've already run that import and the log already exists probably would just exacerbate the confusion tbh.

Though, I think I see how it could be confusing. Maybe the wording isn't clear enough as to its significance.

I'll move it to bugs so we can consider what to do.
 
I think pre-filling it with a value which could then be rejected because you've already run that import and the log already exists probably would just exacerbate the confusion tbh.

It's definitely not a perfect solution, but it'd be relatively easy to work around this:

the developer could easily check if the table exists and append an _{i} at the end to solve that.

So it'd be able to get a list of tables, check if xf_vb_import_log exists, if it does it'd check xf_vb_import_log_1 then xf_vb_import_log_2, and so on
 
There is a new method on the AbstractImporter class called getSuggestedLogTableName. This gets the short name of the importer class, e.g. PhotopostPro or vBulletin or XenForo21 and generates a reasonable prefix, e.g. import_log_photopostpro.

We then append a number to it, starting with 1, and we test whether the table already exists.

196745

Should do the trick. Also changed the wording and indicated that the log table name is required.
 
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.1).

Change log:
Automatically suggest a name for the import log table, based on the importer class name and a numeric suffix.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
There is a new method on the AbstractImporter class called getSuggestedLogTableName. This gets the short name of the importer class, e.g. PhotopostPro or vBulletin or XenForo21 and generates a reasonable prefix, e.g. import_log_photopostpro.

We then append a number to it, starting with 1, and we test whether the table already exists.

Even better! Thanks :)
 
Back
Top Bottom