XF 2.1 Error in: ACP-> Rebuild -> Caches und Indizes -> Rebuild UserCaches

Masetrix

Well-known member
Code:
    Error: Call to a member function rebuildUserFieldValuesCache() on null src/XF/Job/User.php:52

    Generiert von: xxx 1 Mai 2019 um 12:10

Stack-Trace

#0 src/XF/Job/AbstractRebuildJob.php(47): XF\Job\User->rebuildById(19550)
#1 src/XF/Job/Manager.php(253): XF\Job\AbstractRebuildJob->run(G)
#2 src/XF/Job/Manager.php(195): XF\Job\Manager->runJobInternal(Array, G)
#3 src/XF/Job/Manager.php(111): XF\Job\Manager->runJobEntry(Array, G)
#4 src/XF/Admin/Controller/Tools.php(120): XF\Job\Manager->runByIds(Array, 8)
#5 src/XF/Mvc/Dispatcher.php(321): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#6 src/XF/Mvc/Dispatcher.php(244): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Tools), NULL)
#7 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Tools), NULL)
#8 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#9 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#10 src/XF.php(390): XF\App->run()
#11 admin.php(13): XF::runApp('XF\\Admin\\App')
#12 {main}

Status der Anfrage

array(4) {
  ["url"] => string(24) "/admin.php?tools/run-job"
  ["referrer"] => string(49) "/admin.php?tools/run-job"
  ["_GET"] => array(1) {
    ["tools/run-job"] => string(0) ""
  }
  ["_POST"] => array(3) {
    ["_xfRedirect"] => string(59) "/admin.php?tools/rebuild&success=1"
    ["_xfToken"] => string(8) "********"
    ["only_ids"] => string(4) "4203"
  }
}

Code:
Error: Call to a member function rebuildUserFieldValuesCache() on null in src/XF/Job/User.php at line 52

    XF\Job\User->rebuildById() in src/XF/Job/AbstractRebuildJob.php at line 47
    XF\Job\AbstractRebuildJob->run() in src/XF/Job/Manager.php at line 253
    XF\Job\Manager->runJobInternal() in src/XF/Job/Manager.php at line 195
    XF\Job\Manager->runJobEntry() in src/XF/Job/Manager.php at line 111
    XF\Job\Manager->runByIds() in src/XF/Admin/Controller/Tools.php at line 120
    XF\Admin\Controller\Tools->actionRunJob() in src/XF/Mvc/Dispatcher.php at line 321
    XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 244
    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
 
I don't think we'd see this as a bug, actually, because the conditions here are not something we would expect to happen in normal use of the software. This is the code in question:
PHP:
$user->Profile->rebuildUserFieldValuesCache();
For this to cause a problem and get this far, the $user record exists (in the xf_user table) but it does not have a record in xf_user_profile.

I'm not sure if you have ever imported users from another software, particularly if it was an unofficial or non-supported or third-party importer? If so, that is the likely cause for this. All official XF migration paths will always include all relevant user records.

To fix the problem, you would need to execute the following queries:
SQL:
INSERT IGNORE INTO xf_user_option (user_id) SELECT user_id FROM xf_user;
INSERT IGNORE INTO xf_user_privacy (user_id) SELECT user_id FROM xf_user;
INSERT IGNORE INTO xf_user_profile (user_id) SELECT user_id FROM xf_user;
INSERT IGNORE INTO xf_user_authenticate (user_id) SELECT user_id FROM xf_user;
It will be useful to know what the result of these queries is, and whether it solves the problem.
 
To fix the problem, you would need to execute the following queries:
SQL:
INSERT IGNORE INTO xf_user_option (user_id) SELECT user_id FROM xf_user;
INSERT IGNORE INTO xf_user_privacy (user_id) SELECT user_id FROM xf_user;
INSERT IGNORE INTO xf_user_profile (user_id) SELECT user_id FROM xf_user;
INSERT IGNORE INTO xf_user_authenticate (user_id) SELECT user_id FROM xf_user;
It will be useful to know what the result of these queries is, and whether it solves the problem.
 
After i run the php cmd.php xf-rebuild:users command via CLI, command breaks after userid 2489860 (last user id is : 2635293)
So i though, it may related after user id > 2489860 ?

Ekran Resmi 2019-09-02 18.40.35.png

Should i run your sql queries @Chris D ? And run the xf-rebuild:users command again?

Also, i don't want to start that process from user id #1 because it runs about 5 hours :)
Can i start the rebuild process from specific user_id ?

Thanks
 
Top Bottom