Resource icon

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

No permission to download
@ActorMike this may be an XFMG bug.

You may be able to workaround the issue by changing one of the files. The file is src/addons/XFMG/Service/Album/ThumbnailGenerator.php.

This line:
PHP:
$itemTempFile = File::copyAbstractedPathToTempFile($mediaItem->getAbstractedThumbnailPath());

Should be removed and replaced with:

PHP:
$thumbPath = $mediaItem->getAbstractedThumbnailPath();
if (!File::abstractedPathExists($thumbPath))
{
   continue;
}

$itemTempFile = File::copyAbstractedPathToTempFile($thumbPath);

Let us know if that fixes the problem and I will get XFMG patched for the next release.
 
@ActorMike this may be an XFMG bug.

Let us know if that fixes the problem and I will get XFMG patched for the next release.
@Chris D- It worked, however as others have reported in previous comments, you cannot import "likes" or it throws an error. I'm not worried about the likes, but I thought you should know. Are we allowed to send you a PayPal for creating this importer?
Importing...
Step 5 of 8: Comments 00:00:01 [500] 82.84%
Step 5 of 8: Comments 00:00:01 [604]


In AbstractStatement.php line 228:

MySQL query error [1062]: Duplicate entry '13' for key 'PRIMARY'
 
Does anyone have any URL rewrites (preferably nginx) so that after the conversion old URL's still point to the newly imported data?
 
XF 1.4? The XF version shouldn't make a difference, we're only looking for a XenGallery 2.x database.
Great yeah currently running XenForo 1.4.2, it's been a while. Just waiting for Brogan to help with the update then I can run this. The gallery import is crucial for me. Should I remove or untick the likes import seeing as many people have said this isn't effective? Likes are not important at all.

Also as the gallery is large is there an option to run it though a command in Terminal rather than the browser? I'm worried it might not complete.
 
I'm not currently up to date on what the situation with likes is. Feel free to uncheck them if they're not essential.

After you set up any importer in XF 2.1, including this one, you get a choice between running it in your browser or running it on the command line.
 
We didn't need to import the likes, so we just commented that part of the code out.
Can anyone tell me how to do this? I get the same "Duplicate entry" error but would love to finalize this import...

...or IS everything imported with the exception of likes? Because that would be fine...

It seems like everything with the exception of album covers and the number of photos per album carried over...
 
Last edited:
set up any importer
What are the default paths to go in the Source database configuration?
In particular for the data directory would it be:

$config['/public_html/data/photos']

I'm not too sure how to write this?
 
Last edited:
I am struggling to keep the file numbers down below my hosts maximum permissible amount.
Notice in the data/photos folder that it looks like there is the same image in each folder of different quality.
Folders are:
l
m
o
s
Are these the Sonnb Gallery images in these folders? If so am i safe to delete any of them, which one is used for the import process?

Thanks, Craig
 
We import from data/photos into the XF attachment system so if the import was successful then you should no longer need the data/photos directory.
 
It's been about 9 months since we switched over, would it be okay, to drop all these Sonnb_xengallery tables in the MYSQL database? I assume they aren't connected to anything else.


sonnb-drop-tables.webp
 
I'm also getting a duplicate entry error.

Code:
Server error log
XF\Db\DuplicateKeyException: MySQL query error [1062]: Duplicate entry '52' for key 'PRIMARY' src/XF/Db/AbstractStatement.php:228
Generated by: Alex Apr 28, 2021 at 7:20 PM
Stack trace
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 (?, ?, ?, ?, ?, ?, ?, ?)
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1062, '23000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1062, '23000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(218): XF\Db\AbstractAdapter->query('INSERT  INTO `x...', Array)
#4 src/XF/Import/Data/EntityEmulator.php(327): XF\Db\AbstractAdapter->insert('xf_reaction_con...', Array)
#5 src/XF/Import/Data/AbstractEmulatedData.php(71): XF\Import\Data\EntityEmulator->insert(52, Object(XF\Db\Mysqli\Adapter))
#6 src/XF/Import/Data/AbstractData.php(127): XF\Import\Data\AbstractEmulatedData->write(52)
#7 src/addons/XG2XFMG/Import/Importer/XenGallery.php(779): XF\Import\Data\AbstractData->save(52)
#8 src/XF/Import/Runner.php(242): XG2XFMG\Import\Importer\XenGallery->stepLikes(Object(XF\Import\StepState), Array, 8)
#9 src/XF/Import/Runner.php(59): XF\Import\Runner->runStep('likes', Object(XF\Import\StepState), 8)
#10 src/XF/Admin/Controller/Import.php(234): XF\Import\Runner->run()
#11 src/XF/Mvc/Dispatcher.php(350): XF\Admin\Controller\Import->actionRun(Object(XF\Mvc\ParameterBag))
#12 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Import', 'Run', Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Import), NULL)
#13 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Import), NULL)
#14 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#15 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#16 src/XF.php(488): XF\App->run()
#17 admin.php(13): XF::runApp('XF\\Admin\\App')
#18 {main}
Request state
array(4) {
  ["url"] => string(21) "/admin.php?import/run"
  ["referrer"] => string(50) "https://staging.site.com/admin.php?import/"
  ["_GET"] => array(1) {
    ["import/run"] => string(0) ""
  }
  ["_POST"] => array(1) {
    ["_xfToken"] => string(8) "********"
  }
}



I seem to be missing a fair few personal albums, so not sure if the error above caused the import not to complete properly.
 
I'm also getting a duplicate entry error.

Code:
Server error log
XF\Db\DuplicateKeyException: MySQL query error [1062]: Duplicate entry '52' for key 'PRIMARY' src/XF/Db/AbstractStatement.php:228
Generated by: Alex Apr 28, 2021 at 7:20 PM
Stack trace
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 (?, ?, ?, ?, ?, ?, ?, ?)
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1062, '23000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1062, '23000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(218): XF\Db\AbstractAdapter->query('INSERT  INTO `x...', Array)
#4 src/XF/Import/Data/EntityEmulator.php(327): XF\Db\AbstractAdapter->insert('xf_reaction_con...', Array)
#5 src/XF/Import/Data/AbstractEmulatedData.php(71): XF\Import\Data\EntityEmulator->insert(52, Object(XF\Db\Mysqli\Adapter))
#6 src/XF/Import/Data/AbstractData.php(127): XF\Import\Data\AbstractEmulatedData->write(52)
#7 src/addons/XG2XFMG/Import/Importer/XenGallery.php(779): XF\Import\Data\AbstractData->save(52)
#8 src/XF/Import/Runner.php(242): XG2XFMG\Import\Importer\XenGallery->stepLikes(Object(XF\Import\StepState), Array, 8)
#9 src/XF/Import/Runner.php(59): XF\Import\Runner->runStep('likes', Object(XF\Import\StepState), 8)
#10 src/XF/Admin/Controller/Import.php(234): XF\Import\Runner->run()
#11 src/XF/Mvc/Dispatcher.php(350): XF\Admin\Controller\Import->actionRun(Object(XF\Mvc\ParameterBag))
#12 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Import', 'Run', Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Import), NULL)
#13 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Import), NULL)
#14 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#15 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#16 src/XF.php(488): XF\App->run()
#17 admin.php(13): XF::runApp('XF\\Admin\\App')
#18 {main}
Request state
array(4) {
  ["url"] => string(21) "/admin.php?import/run"
  ["referrer"] => string(50) "https://staging.site.com/admin.php?import/"
  ["_GET"] => array(1) {
    ["import/run"] => string(0) ""
  }
  ["_POST"] => array(1) {
    ["_xfToken"] => string(8) "********"
  }
}



I seem to be missing a fair few personal albums, so not sure if the error above caused the import not to complete properly.
Getting the same errors on command line import: I've deleted about 5 of these manually but it keeps happening on subsequent numbers..



Code:
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 (?, ?, ?, ?, ?, ?, ?, ?)



[20:21][root public]# php cmd.php xf:import
Starting import from sonnb XenGallery 2.x (Beta)...
 - Importing...
In AbstractStatement.php line 228:

  MySQL query error [1062]: Duplicate entry '265695' 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 (?, ?, ?, ?, ?, ?, ?, ?)



[20:21][root public]# php cmd.php xf:import-finalize
The import session is not yet completed.
 
Back
Top Bottom