本文整理汇总了PHP中FLBuilderModel::install_database方法的典型用法代码示例。如果您正苦于以下问题:PHP FLBuilderModel::install_database方法的具体用法?PHP FLBuilderModel::install_database怎么用?PHP FLBuilderModel::install_database使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLBuilderModel
的用法示例。
在下文中一共展示了FLBuilderModel::install_database方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pre_1_2_8_restore
/**
* Restores a site to pre 1.2.8.
*
* @since 1.2.8
* @access private
* @return void
*/
private static function pre_1_2_8_restore()
{
global $wpdb;
if (!self::pre_1_2_8_table_exists() || self::pre_1_2_8_table_is_empty()) {
$cache_dir = FLBuilderModel::get_cache_dir();
$backup_path = $cache_dir['path'] . 'backup.dat';
// Install the database.
FLBuilderModel::install_database();
// Check for the backup file.
if (file_exists($backup_path)) {
// Get the backup data.
$backup = unserialize(file_get_contents($backup_path));
// Check for the correct backup data.
if (!isset($backup->nodes) || !isset($backup->meta)) {
return;
}
// Restore the nodes.
foreach ($backup->nodes as $node) {
$wpdb->insert("{$wpdb->prefix}fl_builder_nodes", array('node' => $node->node, 'type' => $node->type, 'layout' => $node->layout, 'parent' => $node->parent, 'position' => $node->position, 'settings' => $node->settings, 'status' => $node->status), array('%s', '%s', '%s', '%s', '%d', '%s', '%s'));
}
// Restore the meta.
foreach ($backup->meta as $meta) {
update_post_meta($meta->post_id, '_fl_builder_layout', $meta->meta_value);
}
}
}
}