ThemeFuse / Unyson-Backups-Extension

Backup & Demo Content - This extension lets you create an automated backup schedule, import demo content or even create a demo content archive for migration purposes.
http://manual.unyson.io/en/latest/extension/backups/
10 stars 17 forks source link

theme_mods name replace #47

Closed spatricius closed 6 years ago

spatricius commented 7 years ago

Hi,

I'd like to update thememods option according to current theme location. Depending on where theme was installed by user, it can be: /themes/my_theme/ /themes/theme/my_theme/ /themes/zip/my_theme/ etc.

I can see this is supposed to be done automatically in restore task, however at \FW_Ext_Backups_Task_Type_DB_Restore::do_import there is this line:

// prevent template overwrite stylesheet (prefer stylesheet)
$state['params']['template'] !== $state['params']['stylesheet']

which prevents this from happening. Actually, I think it should be == instead of !==. However, if this is for a reason, I would like to hook my own replacements. Currently I'm not able to use the hook below because of $filter_data being empty:

if ( ! empty($filter_data) ) { $replace_option_names = array_merge( /** @since 2.0.12 */ apply_filters('fw_ext_backups_db_restore_option_names_replace', array(), $filter_data), $replace_option_names ); }

Thanks!

GheorgheP commented 7 years ago

It's not recommended installing the theme in sub-directories /themes/theme/my-theme, even wordpress do not handle theme properly, as during theme update it will add the updated version it in the themes root folder: