Fixed Error upgrading to RM 2.0

Snog

Well-known member
Affected version
2.0 Beta 1
I'm getting this error when attempting to upgrade the resource manage...
Code:
Server error log

[LIST]
[*]XF\Db\Exception: MySQL query error [1146]: Table 'mydbname.xf_resource' doesn't exist
[*]src/XF/Db/AbstractStatement.php:183
[*]Generated by: Snog
[*]Sep 5, 2017 at 4:27 PM
[/LIST]
[SIZE=4][B]Stack trace[/B][/SIZE]

#0 /var/www/clients/client0/web1/web/src/XF/Db/Mysqli/Statement.php(66): XF\Db\AbstractStatement->getException('MySQL query err...', 1146)
#1 /var/www/clients/client0/web1/web/src/XF/Db/AbstractAdapter.php(67): XF\Db\Mysqli\Statement->execute()
#2 /var/www/clients/client0/web1/web/src/XF/AddOn/AbstractSetup.php(185): XF\Db\AbstractAdapter->query('\n\t\t\tALTER TABLE...', Array)
#3 /var/www/clients/client0/web1/web/src/addons/XFRM/Setup.php(249): XF\AddOn\AbstractSetup->query('\n\t\t\tALTER TABLE...')
#4 /var/www/clients/client0/web1/web/src/XF/AddOn/StepRunnerUpgradeTrait.php(143): XFRM\Setup->upgrade1020010Step1(Array)
#5 /var/www/clients/client0/web1/web/src/XF/AddOn/StepRunnerUpgradeTrait.php(79): XFRM\Setup->upgradeStepRunner(1020010, 1, Array, 2000010, 2)
#6 /var/www/clients/client0/web1/web/src/XF/Admin/Controller/AddOn.php(424): XFRM\Setup->upgrade(Array)
#7 /var/www/clients/client0/web1/web/src/XF/Mvc/Dispatcher.php(232): XF\Admin\Controller\AddOn->actionUpgrade(Object(XF\Mvc\ParameterBag))
#8 /var/www/clients/client0/web1/web/src/XF/Mvc/Dispatcher.php(85): XF\Mvc\Dispatcher->dispatchClass('XF:AddOn', 'Upgrade', 'html', Object(XF\Mvc\ParameterBag), 'listAddOns')
#9 /var/www/clients/client0/web1/web/src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#10 /var/www/clients/client0/web1/web/src/XF/App.php(1771): XF\Mvc\Dispatcher->run()
#11 /var/www/clients/client0/web1/web/src/XF.php(319): XF\App->run()
#12 /var/www/clients/client0/web1/web/admin.php(13): XF::runApp('XF\\Admin\\App')
#13 {main}

Note that my resource manager installation is quite old. The files are xf_rm_xxx, so the file it's looking for would be xf_rm_resource.
 
xf_rm_resource is the XF2 table name. The XF1 table is xf_resource, so I'm confused as to why you have the new table name while running the 1.2 upgrade script.

Can you confirm that I'm interpreting your message correctly?
 
I misunderstood the error, so then that means the table is missing for some reason.

I'm doing a complete restore of my XF1 system and I'm going to try again.
 
If that table isn't in the DB, then that would suggest you didn't have a working RM 1.x installation -- that's pretty literally the most important table in the RM.
 
The original tables are there before the upgrade...
resoucetables.webp

I'm running another upgrade to XF 2 now and I'll do the RM upgrade to see if it happens again.
 
I think you can mark this one and the one I reported about changing passwords as PEBKAC.

I had the site in debug mode during upgrade. :oops:
 
Debug mode should be fine though...

But if you can't reproduce this, then we will likely need to close it.
 
Give me a few minutes to run through it again. I already started a fresh upgrade without debug mode.
 
These are the resource manager tables that exist when the error happens...

xf_rm_category
xf_rm_category_field
xf_rm_category_prefix
xf_rm_category_watch
xf_rm_resource
xf_rm_resource_download
xf_rm_resource_feature
xf_rm_resource_field
xf_rm_resource_field_value
xf_rm_resource_prefix
xf_rm_resource_prefix_group
xf_rm_resource_rating
xf_rm_resource_update
xf_rm_resource_version
xf_rm_resource_watch

I'll not do another upgrade until sometime tomorrow in case you have any other questions.

I upgraded to XF2 with debug enabled, and left it enabled during the RM upgrade.
 
There's a new error. I was ignoring what it was saying.

New error is:
Code:
[LIST]
[*]nvalidArgumentException: Unknown column xfrm_resource_count on XF:User
[*]src/XF/Mvc/Entity/Finder.php:1367
[*]Generated by: Unknown account
[*]Sep 5, 2017 at 5:30 PM
[/LIST]
[SIZE=4][B]Stack trace[/B][/SIZE]

#0 /var/www/clients/client0/web1/web/src/XF/Mvc/Entity/Finder.php(492): XF\Mvc\Entity\Finder->resolveFieldToTableAndColumn('xfrm_resource_c...', true)
#1 /var/www/clients/client0/web1/web/src/XF/Mvc/Entity/Finder.php(220): XF\Mvc\Entity\Finder->columnSqlName('xfrm_resource_c...', true)
#2 /var/www/clients/client0/web1/web/src/XF/Mvc/Entity/Finder.php(118): XF\Mvc\Entity\Finder->buildCondition('xfrm_resource_c...', '>', 0)
#3 /var/www/clients/client0/web1/web/src/XF/Service/MemberStat/Preparer.php(195): XF\Mvc\Entity\Finder->where('xfrm_resource_c...', '>', 0)
#4 /var/www/clients/client0/web1/web/src/XF/Service/MemberStat/Preparer.php(62): XF\Service\MemberStat\Preparer->getResultsData()
#5 /var/www/clients/client0/web1/web/src/XF/Cron/MemberStats.php(19): XF\Service\MemberStat\Preparer->cache()
#6 [internal function]: XF\Cron\MemberStats::rebuildMemberStatsCache(Object(XF\Entity\CronEntry))
#7 /var/www/clients/client0/web1/web/src/XF/Job/Cron.php(38): call_user_func(Array, Object(XF\Entity\CronEntry))
#8 /var/www/clients/client0/web1/web/src/XF/Job/Manager.php(193): XF\Job\Cron->run(8)
#9 /var/www/clients/client0/web1/web/src/XF/Job/Manager.php(140): XF\Job\Manager->runJobInternal(Array, 8)
#10 /var/www/clients/client0/web1/web/src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 8)
#11 /var/www/clients/client0/web1/web/job.php(15): XF\Job\Manager->runQueue(false, 8)
#12 {main}

But it does exist...
count.webp
 
Yeah we think there's an issue with the order the steps are running, or that steps are repeating themselves for some reason.

It's not something we've been able to reproduce in our testing so far but certainly something is wrong as someone is experiencing a very similar issue with an XFMG upgrade!
 
Yeah, I was ignoring what the new error was saying and just assumed it was the same error as the original post. Then on my last run, I actually looked at the error to see what it said.

The error from the orignal post comes up if you try to upgrade a second time.
 
If you have time to start the entire process again from scratch, could you attempt to run the upgrade from the CLI instead of the GUI?

Code:
php cmd.php xf:addon-upgrade XFRM
 
Sure... error at cleanup...
Code:
Please confirm that you want to upgrade the following add-on: (XenForo Resource Manager 1.1.2) (y/n)y
Upgrading . . . . . . . . . . .
Complete.

Importing add-on data
Importing... Add-on data (Admin navigation)
Importing... Add-on data (Admin permission)
Importing... Add-on data (Class extensions)
Importing... Add-on data (Code event listeners)
Importing... Add-on data (Content type fields)
Importing... Add-on data (Member stats)
Importing... Add-on data (Navigation)
Importing... Add-on data (Options)
Importing... Add-on data (Option groups)
Importing... Add-on data (Permissions)
Importing... Add-on data (Permission interface groups)
Importing... Add-on data (Phrases)
Importing... Add-on data (Routes)
Importing... Add-on data (Templates)
Importing... Add-on data (Template modifications)
Importing... Add-on data (Widget definitions)
Importing... Add-on data (Widget positions)


Running clean up tasks...


  [ErrorException]
  Undefined index:

That's exactly how it comes up, nothing after Undefined index:

Same routine.. upgrade to XF2 with debug enabled. Upgrade RM with debug enabled.
 
And this is what is in the admin error log...
Code:
[LIST]
[*]ErrorException: Undefined index: 
[*]src/XF/Permission/Builder.php:382
[*]Generated by: Unknown account
[*]Sep 5, 2017 at 6:07 PM
[/LIST]
[SIZE=4][B]Stack trace[/B][/SIZE]

#0 /var/www/clients/client0/web1/web/src/XF/Permission/Builder.php(382): XF::handlePhpError(8, 'Undefined index...', '/var/www/client...', 382, Array)
#1 /var/www/clients/client0/web1/web/src/XF/Permission/Builder.php(350): XF\Permission\Builder->pickPermissionPriorityValue(Array, 'flag')
#2 /var/www/clients/client0/web1/web/src/XF/Permission/TreeContentPermissions.php(111): XF\Permission\Builder->calculatePermissions(Array, Array, Array)
#3 /var/www/clients/client0/web1/web/src/XF/Permission/TreeContentPermissions.php(102): XF\Permission\TreeContentPermissions->buildForContent(39, Array, 0, Array)
#4 /var/www/clients/client0/web1/web/src/XF/Permission/TreeContentPermissions.php(40): XF\Permission\TreeContentPermissions->buildForChildrenOf(NULL, Array, 0, Array)
#5 /var/www/clients/client0/web1/web/src/XF/Permission/Builder.php(148): XF\Permission\TreeContentPermissions->rebuildCombination(Object(XF\Entity\PermissionCombination), Array)
#6 /var/www/clients/client0/web1/web/src/XF/Permission/Builder.php(140): XF\Permission\Builder->rebuildCombinationContent(Object(XF\Entity\PermissionCombination), Array)
#7 /var/www/clients/client0/web1/web/src/XF/Job/PermissionRebuild.php(58): XF\Permission\Builder->rebuildCombination(Object(XF\Entity\PermissionCombination))
#8 /var/www/clients/client0/web1/web/src/XF/Job/Manager.php(193): XF\Job\PermissionRebuild->run(8)
#9 /var/www/clients/client0/web1/web/src/XF/Job/Manager.php(140): XF\Job\Manager->runJobInternal(Array, 8)
#10 /var/www/clients/client0/web1/web/src/XF/Job/Manager.php(116): XF\Job\Manager->runJobEntry(Array, 8)
#11 /var/www/clients/client0/web1/web/src/XF/Cli/Runner.php(104): XF\Job\Manager->runById(10, 8)
#12 /var/www/clients/client0/web1/web/src/XF/Cli/Runner.php(64): XF\Cli\Runner->postExecutionCleanUp(Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/clients/client0/web1/web/cmd.php(15): XF\Cli\Runner->run()
#14 {main}

Odd there's different errors between an upgrade via CLI and the admin panel.
 
We have had the same issue with tables / columns already renamed / dropped. It happened after trying to upgrade XFRM again (the first time probably failed because MySQL was too slow.)
 
Back
Top Bottom