Not a bug Styles repository getStyleCacheData() doesn't include custom fields

Arty

Well-known member
Affected version
2.0.0 DP 10
I have added custom field to xf_styles table in my add-on's setup function. It is there in database.

However when using this code, custom field is not in results:
Code:
$repo = \XF::repository('XF:Style');
$styles = $repo->getStyleCacheData();
 
Actually there is still something fishy going on. Registry doesn't seem to refresh after add-on installed or uninstalled, so I tried to do it manually in setup:

This is what I have in setup:

Code:
public function installStep1()
{
   $this->schemaManager()->alterTable('xf_style', function(Alter $table)
   {
      $table->addColumn('test', 'tinyint')->setDefault(0);
   });
   \XF::repository('XF:Style')->rebuildStyleCache();
}
public function uninstallStep1()
{
   $this->schemaManager()->alterTable('xf_style', function(Alter $table)
   {
      $table->dropColumns('test');
   });
   \XF::repository('XF:Style')->rebuildStyleCache();
}
Looks like cache is repository is refreshed first, then column is added/deleted. So after installation custom column doesn't appear in registry, but after uninstall it does.

edit: also tried
Code:
\XF::repository('XF:Style')->triggerStyleDataRebuild();
it doesn't rebuild styles list
 
Last edited:
Top Bottom