Resource icon

sonnb XenGallery 2.x to XenForo Media Gallery 2.1.x 1.0.1

No permission to download

Chris D

XenForo developer
Staff member
Chris D submitted a new resource:

sonnb XenGallery 2.x to XenForo Media Gallery 2.1.x - Keep your gallery running after updating to XenForo 2.x

This importer was created in order to support people who wish to migrate to XenForo 2.x but who currently may not be able to because their preferred gallery add-on hasn't yet been updated.

As ever, we recommend testing any import fully before doing it on a live site.

Once you have updated to XenForo 2.1.1 and XenForo Media Gallery 2.1.1 install this add-on as you would any other.

Then go to Tools >...

Read more about this resource...
 
Hello, everybody,

I guess I'm one of the first to actively test the importer.

Since the import is taking place right now, I share my experiences with you directly.

Of course, you have to have the source files of SonnB's gallery in your database and the current XFMG 2.1.1 in your XF2.1.1. If you have already saved data in the XFMG, it may be helpful to uninstall the add-on first and then reinstall it (that's how I did it) to avoid import errors (same IDs, or other...).

Bildschirmfoto 2019-03-27 um 14.03.04.webp



The settings are as already known and problem-free. Note that you have to set the correct path to the source forum:

Bildschirmfoto 2019-03-27 um 14.04.06.webp


Currently we are at 11.14%...

Bildschirmfoto 2019-03-27 um 14.09.06.webp


I'll keep you up to date...




Edit #1:
The importer got stuck at 11.14% for about 10 minutes.

I did a page refresh and the importer continues working.

Bildschirmfoto 2019-03-27 um 14.18.55.webp


Edit #2:
Until now the import took about 24 minutes, minus the 10 minutes waiting time until I did the page refresh, so 14 minutes.

Bildschirmfoto 2019-03-27 um 14.27.50.webp
 
Last edited:
The import resulted in an error:

Result shown in red:
Code:
XF\Db\Exception: MySQL statement prepare error [1054]: Unknown column 'like_id' in 'field list' in src/XF/Db/AbstractStatement.php at line 217
XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 39
XF\Db\Mysqli\Statement->prepare() in src/XF/Db/Mysqli/Statement.php at line 54
XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 94
XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 150
XF\Db\AbstractAdapter->fetchOne() in src/addons/XG2XFMG/Import/Importer/XenGallery.php at line 683
XG2XFMG\Import\Importer\XenGallery->getStepEndLikes() in src/XF/Import/Runner.php at line 197
XF\Import\Runner->setupRunnableStep() in src/XF/Import/Runner.php at line 81
XF\Import\Runner->initializeRun() in src/XF/Import/Runner.php at line 52
XF\Import\Runner->run() in src/XF/Admin/Controller/Import.php at line 234
XF\Admin\Controller\Import->actionRun() in src/XF/Mvc/Dispatcher.php at line 321
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 248
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2177
XF\App->run() in src/XF.php at line 390
XF::runApp() in admin.php at line 13

Server error log:

Code:
[LIST]
[*]XF\Db\Exception: MySQL statement prepare error [1054]: Unknown column 'like_id' in 'field list'
[*] 
[*]src/XF/Db/AbstractStatement.php:217
[/LIST]
[ICODE]

[CODE=php]Stack trace
            SELECT MAX(like_id) FROM xf_liked_content WHERE content_type IN('sonnb_xengallery_album', 'sonnb_xengallery_audio', 'sonnb_xengallery_photo', 'sonnb_xengallery_video', 'sonnb_xengallery_comment')
       
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL statement...', 1054, '42S22')
#1 src/XF/Db/Mysqli/Statement.php(39): XF\Db\Mysqli\Statement->getException('MySQL statement...', 1054, '42S22')
#2 src/XF/Db/Mysqli/Statement.php(54): XF\Db\Mysqli\Statement->prepare()
#3 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#4 src/XF/Db/AbstractAdapter.php(150): XF\Db\AbstractAdapter->query('
            SELECT MAX(...', Array)
#5 src/addons/XG2XFMG/Import/Importer/XenGallery.php(683): XF\Db\AbstractAdapter->fetchOne('
            SELECT MAX(...')
#6 src/XF/Import/Runner.php(197): XG2XFMG\Import\Importer\XenGallery->getStepEndLikes()
#7 src/XF/Import/Runner.php(81): XF\Import\Runner->setupRunnableStep()
#8 src/XF/Import/Runner.php(52): XF\Import\Runner->initializeRun()
#9 src/XF/Admin/Controller/Import.php(234): XF\Import\Runner->run()
#10 src/XF/Mvc/Dispatcher.php(321): XF\Admin\Controller\Import->actionRun(Object(XF\Mvc\ParameterBag))
#11 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:Import', 'Run', Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Import), NULL)
#12 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Import), NULL)
#13 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#14 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#15 src/XF.php(390): XF\App->run()
#16 admin.php(13): XF::runApp('XF\\Admin\\App')
#17 {main}
Request state
array(4) {
  ["url"] => string(21) "/admin.php?import/run"
  ["referrer"] => string(41) "https://gsx-s1000.de/admin.php?import/run"
  ["_GET"] => array(1) {
    ["import/run"] => string(0) ""
  }
  ["_POST"] => array(1) {
    ["_xfToken"] => string(8) "********"
  }
}
 
Nevertheless:

it seems as if a partially import with the most important details has been performed. (y)(y)
Only the likes were not imported.

The albums and pictures contained therein were created.
Furthermore the usernames have been linked to the forum according to the albums and so the users can edit their own albums (at least it seems so).
 
@Chris D first up, thank you so much for creating this - hugely appreciated.

I've just done a test import and got the likes error same as @7emper5i:

Code:
XF\Db\Exception: MySQL statement prepare error [1146]: Table '(database name).xf_liked_content' doesn't exist src/XF/Db/AbstractStatement.php:217

No issues though as the gallery likes are not vital to us.

Thank you again.
 
That should allow you to finish the import guys. Bear in mind that if the import got stuck there and you were unable to complete it fully, then a couple of steps (content streams and photo tagging) won't have run yet, plus at the end a number of rebuilds are run.

So please update to that latest version, and you should be able to go back to the importer to continue.

That should bring the likes across automatically to reactions.
 
I can start the pending import over, but I get the following error page:

Code:
XF\Db\DuplicateKeyException: MySQL query error [1062]: Duplicate entry '171' for key 'PRIMARY' in src/XF/Db/AbstractStatement.php at line 217
XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 77
XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 94
XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 221
XF\Db\AbstractAdapter->insert() in src/XF/Import/Data/EntityEmulator.php at line 326
XF\Import\Data\EntityEmulator->insert() in src/XF/Import/Data/AbstractEmulatedData.php at line 55
XF\Import\Data\AbstractEmulatedData->write() in src/XF/Import/Data/AbstractData.php at line 126
XF\Import\Data\AbstractData->save() in src/addons/XG2XFMG/Import/Importer/XenGallery.php at line 779
XG2XFMG\Import\Importer\XenGallery->stepLikes() in src/XF/Import/Runner.php at line 231
XF\Import\Runner->runStep() in src/XF/Import/Runner.php at line 59
XF\Import\Runner->run() in src/XF/Admin/Controller/Import.php at line 234
XF\Admin\Controller\Import->actionRun() in src/XF/Mvc/Dispatcher.php at line 321
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 248
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2177
XF\App->run() in src/XF.php at line 390
XF::runApp() in admin.php at line 13
 
May I ask, how to solve this SQL query error?

I've de- and reinstalled everything again and again, but this error persists.
 
@Chris D I am running XF 1.5.23. Just wanted to confirm that we upgrade to XenForo 2.1.x and XenForo Media Gallery 2.1.x and then run the importer and it will import all the Sonnb XenGallery that was previously in XF 1.5.23. Thanks!
 
Got the following error during import on a test site:

Code:
XF\Db\DuplicateKeyException: MySQL query error [1062]: Duplicate entry '53529' for key 'PRIMARY' in src/XF/Db/AbstractStatement.php at line 217
XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 77
XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 94
XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 221
XF\Db\AbstractAdapter->insert() in src/XF/Import/Data/EntityEmulator.php at line 326
XF\Import\Data\EntityEmulator->insert() in src/XF/Import/Data/AbstractEmulatedData.php at line 55
XF\Import\Data\AbstractEmulatedData->write() in src/XF/Import/Data/AbstractData.php at line 126
XF\Import\Data\AbstractData->save() in src/addons/XG2XFMG/Import/Importer/XenGallery.php at line 779
XG2XFMG\Import\Importer\XenGallery->stepLikes() in src/XF/Import/Runner.php at line 231
XF\Import\Runner->runStep() in src/XF/Import/Runner.php at line 59
XF\Import\Runner->run() in src/XF/Admin/Controller/Import.php at line 234
XF\Admin\Controller\Import->actionRun() in src/XF/Mvc/Dispatcher.php at line 321
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 248
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2177
XF\App->run() in src/XF.php at line 390
XF::runApp() in admin.php at line 13
 
We got a very similar error right near the end of the import:

Code:
XF\Db\DuplicateKeyException: MySQL query error [1062]: Duplicate entry '2381' for key 'PRIMARY' in src/XF/Db/AbstractStatement.php at line 217
XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 77
XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 94
XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 221
XF\Db\AbstractAdapter->insert() in src/XF/Import/Data/EntityEmulator.php at line 326
XF\Import\Data\EntityEmulator->insert() in src/XF/Import/Data/AbstractEmulatedData.php at line 55
XF\Import\Data\AbstractEmulatedData->write() in src/XF/Import/Data/AbstractData.php at line 127
XF\Import\Data\AbstractData->save() in src/addons/XG2XFMG/Import/Importer/XenGallery.php at line 779
XG2XFMG\Import\Importer\XenGallery->stepLikes() in src/XF/Import/Runner.php at line 231
XF\Import\Runner->runStep() in src/XF/Import/Runner.php at line 59
XF\Import\Runner->run() in src/XF/Admin/Controller/Import.php at line 234
XF\Admin\Controller\Import->actionRun() in src/XF/Mvc/Dispatcher.php at line 321
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 248
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2178
XF\App->run() in src/XF.php at line 390
XF::runApp() in admin.php at line 13

We didn't need to import the likes, so we just commented that part of the code out.
 
Last edited:
Same error here:

- Step 5 of 8: Comments 00:00:01 [492]

In AbstractStatement.php line 217:

MySQL query error [1062]: Duplicate entry '4' for key 'PRIMARY'


xf:import [--processes PROCESSES] [--finalize]

Exception query:

INSERT INTO xf_reaction_content (reaction_content_id, reaction_id, content_type, content_id, reaction_user_id, reaction_date, content_user_id, is_counted) VALUES (?, ?, ?, ?, ?, ?, ?, ?)


Anyone fix this yet?
 
Hi @Chris D!

Does this importer support importing data that's stored off-server? In our case, all data is stored in an AWS bucket via [bd]AttachmentStore. We've already purchased XFMG2 and intend to use that moving forward.

All the best,
zig
 
The importer was originally designed to work with an existing XF 1.5 database where the xf_liked_content table is assumed to exist. This update removes that assumption so it should work if you're importing from an XF 2.1 database.

Is it possible to

1.
update xf1 to xf2
use the importer to bring data from old "sonnbee xf1 tables" to xmg 2?


or

2.
update xf to xf2
update sonbee from xf1 to xf2 (beta)
use importer
 
There are no thumbnails when I go to view the albums, is this normal? http://staging.fordthunderbirdforum.com/media/albums/

@Chris D - When I try to finalize I get the following errors:
League\Flysystem\FileNotFoundException: File not found at path: xfmg/thumbnail/0/62-c0024dcab84bb8dfbbb57e6fd67b5c61.jpg in src\vendor\league\flysystem\src\Filesystem.php at line 389
  1. League\Flysystem\Filesystem->assertPresent() insrc\vendor\league\flysystem\src\Filesystem.php at line 194
  2. League\Flysystem\Filesystem->readStream()
  3. call_user_func_array() in src\vendor\league\flysystem-eventable-filesystem\src\EventableFilesystem.php at line 431
  4. League\Flysystem\EventableFilesystem\EventableFilesystem->callFilesystemMethod() in src\vendor\league\flysystem-eventable-filesystem\src\EventableFilesystem.php at line 395
  5. League\Flysystem\EventableFilesystem\EventableFilesystem->delegateMethodCall() in src\vendor\league\flysystem-eventable-filesystem\src\EventableFilesystem.php at line 154
  6. League\Flysystem\EventableFilesystem\EventableFilesystem->readStream() in src\vendor\league\flysystem\src\MountManager.phpat line 343
  7. League\Flysystem\MountManager->readStream() in src\XF\Util\File.phpat line 175
  8. XF\Util\File::copyAbstractedPathToTempFile() insrc\addons\XFMG\Service\Album\ThumbnailGenerator.php at line 148
  9. XFMG\Service\Album\ThumbnailGenerator->createAlbumThumbnail() insrc\addons\XFMG\Job\AlbumThumb.php at line 55
  10. XFMG\Job\AlbumThumb->run() in src\XF\Job\Atomic.php at line 38
  11. XF\Job\Atomic->run() in src\XF\Job\Manager.php at line 253
  12. XF\Job\Manager->runJobInternal() in src\XF\Job\Manager.php at line195
  13. XF\Job\Manager->runJobEntry() in src\XF\Job\Manager.php at line 79
  14. XF\Job\Manager->runQueue() in src\XF\Admin\Controller\Tools.php at line 139
  15. XF\Admin\Controller\Tools->actionRunJob() insrc\XF\Mvc\Dispatcher.php at line 350
  16. XF\Mvc\Dispatcher->dispatchClass() in src\XF\Mvc\Dispatcher.php at line261
  17. XF\Mvc\Dispatcher->dispatchFromMatch() in src\XF\Mvc\Dispatcher.phpat line 113
  18. XF\Mvc\Dispatcher->dispatchLoop() in src\XF\Mvc\Dispatcher.php at line55
  19. XF\Mvc\Dispatcher->run() in src\XF\App.php at line 2184
  20. XF\App->run() in src\XF.php at line 391
  21. XF::runApp() in admin.php at line 13

import.webp
 
Last edited:
@Chris D- Update: I just tried from the command line and got the same error. I've started manually uploading a thumbnail for the missing photo jpg file. I run php cmd.php xf:import-finalize again, and it gets stuck again on another JPG. I have 14,916 Thumbnails in the data\xfmg\thumbnail folder right now in 15 folders. Thanks in advance.

missing-thumbnail.webpcommand-line.webp
 
XF\Db\DuplicateKeyException: MySQL query error [1062]: Duplicate entry '16294' for key 'PRIMARY' in src/XF/Db/AbstractStatement.php at line 228

And what i do now, please?
 
Back
Top Bottom