• Resolved HosseinRafiei

    (@hosseinrafiei)


    Hi,

    Thanks for creating this awesome plugin.
    I integrated my plugin with more than 5K active installs with clone function in your plugin but in large scale websites I received timeout error in clone process.

    I investigated the issue and it seems the error is related to ns_recursive_dir_copy function of your plugin. It tries to clone all directories and files of wp-content/uploads directory to the sites/[new-blog-id] and it faced timeout due to large amount of files.

    One of the directories that you’re trying to copy belongs to my plugin and normally has hundred thousands of images and actually your plugin never should copy that directory.

    To fix that please add following filter to ns_recursive_dir_copy function so I can exclude my own directory using that filter. This way your plugin don’t face timeout error during clone.

    $files = apply_filters('ns_cloner_site_dir_copy', scandir($src), $src, $dst);

    It should be added instead of following line.

    $files = scandir($src);

    You can change the filter name to whatever you like.
    Looks forward to hear back from you soon.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Never Settle

    (@neversettle)

    Hi @hosseinrafiei,

    Thanks so much for your feedback. We have great news which is that this is actually already included in NS Cloner 4.0 which is currently in final testing and will be released publicly very soon.

    So you can get ready for it, the implementation in 4.0 is slightly different – basically just the inverse of what you suggested, in that it filters what to *ignore* instead of what to *include*. The filter is called ‘ns_cloner_dir_copy_ignore’, and would be used like this:

    add_filter( 'ns_cloner_dir_copy_ignore', function( $ignore ) {
       $ignore[] = 'directory-you-dont-want-copied';
       return $ignore;
    });
    Thread Starter HosseinRafiei

    (@hosseinrafiei)

    Hi @neversettle,

    Thanks for your reply. I made my plugin compatible with the new filter.
    Cannot wait to see the new version.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Timeout on Clone’ is closed to new replies.