XF 2.0 XFMG wont upgrade

surfsup

Well-known member
Ok got all other apps to upgrade no problem now but for the media gallery its giving me this error after pressing 'upgrade' ?
Code:
TruckMount Forums #1 Carpet Cleaning Forums
League\Flysystem\FileExistsException: File already exists at path: xfmg/album_thumbnail/0/433-4122db7f48662e24a5726beb03e97a0b.jpg in src/vendor/league/flysystem/src/Filesystem.php at line 401
League\Flysystem\Filesystem->assertAbsent() in src/vendor/league/flysystem/src/Filesystem.php at line 81
League\Flysystem\Filesystem->writeStream()
call_user_func_array() in src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php at line 431
League\Flysystem\EventableFilesystem\EventableFilesystem->callFilesystemMethod() in src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php at line 395
League\Flysystem\EventableFilesystem\EventableFilesystem->delegateMethodCall() in src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php at line 275
League\Flysystem\EventableFilesystem\EventableFilesystem->writeStream()
call_user_func_array() in src/vendor/league/flysystem/src/MountManager.php at line 203
League\Flysystem\MountManager->copy() in src/addons/XFMG/Setup.php at line 1866
XFMG\Setup->upgrade902000010Step25() in src/XF/AddOn/StepRunnerUpgradeTrait.php at line 117
XFMG\Setup->upgradeStepRunner() in src/XF/AddOn/StepRunnerUpgradeTrait.php at line 74
XFMG\Setup->upgrade() in src/XF/Admin/Controller/AddOn.php at line 437
XF\Admin\Controller\AddOn->actionUpgrade() in src/XF/Mvc/Dispatcher.php at line 249
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 88
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1879
XF\App->run() in src/XF.php at line 328
XF::runApp() in admin.php at line 13
 
Did you upgrade in this position before and then revert the DB but not the files? If so, that could be the cause.

This should workaround it. In src/addons/XFMG/Setup.php, change:
Code:
$copied = $this->app->fs()->copy($mediaThumbAbsPath, $albumThumbAbsPath);
if ($copied)
{
   $db->update('xf_mg_album', ['thumbnail_date' => time()], 'album_id = ?', $albumId);
}
to:
Code:
if (!$this->app->fs()->has($albumThumbAbsPath))
{
   $copied = $this->app->fs()->copy($mediaThumbAbsPath, $albumThumbAbsPath);
   if ($copied)
   {
      $db->update('xf_mg_album', ['thumbnail_date' => time()], 'album_id = ?', $albumId);
   }
}
(There are whitespace differences in the real code.)

Let me know if that solves the problem.
 
Did you upgrade in this position before and then revert the DB but not the files? If so, that could be the cause.

This should workaround it. In src/addons/XFMG/Setup.php, change:
Code:
$copied = $this->app->fs()->copy($mediaThumbAbsPath, $albumThumbAbsPath);
if ($copied)
{
   $db->update('xf_mg_album', ['thumbnail_date' => time()], 'album_id = ?', $albumId);
}
to:
Code:
if (!$this->app->fs()->has($albumThumbAbsPath))
{
   $copied = $this->app->fs()->copy($mediaThumbAbsPath, $albumThumbAbsPath);
   if ($copied)
   {
      $db->update('xf_mg_album', ['thumbnail_date' => time()], 'album_id = ?', $albumId);
   }
}
(There are whitespace differences in the real code.)

Let me know if that solves the problem.
YES!! It worked!! :D
 
Back
Top Bottom