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

Demos on remote server #36

Closed batnyam closed 7 years ago

batnyam commented 7 years ago

Hello, I've some problem. Our team working on our new theme using Unyson framework and dummy data from our server. But haven't Tools > Demo Content Install menu in the WordPress admin.

I was created index.php in our server http://www.domain.com/demo/index.php It's config.php in same directory index.php

<?php
/**
 * Overwrite default config
 */

$cfg = array(
    'files' => array(
        // 'demo-id' => '/path/to/demo.zip',
                'dropx' => 'http://www.domain.com/demo/dropx.zip',
    ),
);
<?php
/**
 * @param FW_Ext_Backups_Demo[] $demos
 * @return FW_Ext_Backups_Demo[]
 */
function _filter_theme_fw_ext_backups_demos($demos) {
    $uri = get_template_directory_uri();
    $demos_array = array(
        'dropx' => array(
            'title' => __('DropX', 'ps_dropx'),
            'screenshot' => $uri . '/screenshot.png',
            'preview_link' =>  'http://www.demo.com',
        ),
    );

    $download_url = 'http://pxltheme.online/theme-demo/';

    foreach ($demos_array as $id => $data) {
        $demo = new FW_Ext_Backups_Demo($id, 'piecemeal', array(
            'url' => $download_url,
            'file_id' => $id,
        ));
        $demo->set_title($data['title']);
        $demo->set_screenshot($data['screenshot']);
        $demo->set_preview_link($data['preview_link']);

        $demos[ $demo->get_id() ] = $demo;

        unset($demo);
    }

    return $demos;
}
add_filter('fw:ext:backups-demo:demos', '_filter_theme_fw_ext_backups_demos');
?>

How to fix this problem?

ghost commented 7 years ago

But haven't Tools > Demo Content Install menu in the WordPress admin.

Check if your 'fw:ext:backups-demo:demos' filter is executed and $demos is populated.

'dropx' => 'http://www.domain.com/demo/dropx.zip',

You can't put url in that parameter. It must be a path to file because the file will be read directly from different byte position.

batnyam commented 7 years ago

@moldcraft how to check 'fw:ext:backups-demo:demos' filter is executed or not executed?

ghost commented 7 years ago

Put a fw_print('ok'); in it.

batnyam commented 7 years ago

this function didn't executed but i was override this function in functions.php it's working.