XF 2.1 Rebuild customer user field cache.

Dynamic

Well-known member
Hi everyone,

Just wondering what is wrong this this bit of code. It is not rebuilding the cache when we run it.

PHP:
<?php

$fileDir = '/var/www/html';

require($fileDir . '/src/XF.php');
XF::start($fileDir);
\XF::repository('XF:UserField')->rebuildFieldCache();
?>

Any help is appreciated.

Thanks.
 
Your code throws an exception, change '/var/www/htm' to __DIR__ and it executed correctly. To test I fetched the latest user and echo'ed out the result.

I tested this and it works fine:

Code:
<?php

$dir = __DIR__;
require($dir . '/src/XF.php');

XF::start($dir);
echo \XF::repository('XF:User')->getLatestValidUser();
 
Hi Lawrence,

Thanks for that mate. We actually got it to work by doing the following:

PHP:
<?php

$fileDir = '/var/www/html';

require($fileDir . '/src/XF.php');
XF::start($fileDir);
\XF::repository('XF:UserField')->rebuildUserFieldValuesCache($userId);
?>

Big thanks to @Aayush for the fix.
 
Back
Top Bottom