The MU forums have moved to WordPress.org

Plugin halts with no error (3 posts)

  1. dancrumb
    Member
    Posted 16 years ago #

    Hi all,

    I have a plugin that appears to just halt without posting any errors. I've checked the apache logs and the suphp logs and there's nothing to indicate what the problem is at all. I'm looking for some pointers as to where else I could look.

    The page that my plugin generates takes 90s or so to run. I know that's not a good thing and I'll address that later.

    What I'm looking to do is to generate a list of all of the subscribers to each of the blogs. The only way I know to do this is to loop over each of the blog_ids. Foreach blog_id, I switch to that blog, then loop through all of the users. If the user has 'subscriber' capabilities, then I add them to my list.

    This is clunky, but WPMU doesn't seem to have a "get_users_of_blog" function (sadly).

    So... that takes about 90s to run. I looked into changing the max_execution_time and even put a set_time_limit(180) at the top of my plugin... that didn't help.

    I thought it might be down to the amount of data that was being sent to my browser, but the plugin behaviour does not vary with data output... it stops on the same blog every time.

    It seems to stop 'cleanly'. The browser isn't stuck in a loop or anything... No errors on the browser page... And, up until it stops, the page is steadily updated with information from each blog...

    When I look at the generated source, it is truncated... so the whole thing has just crapped out.

    Any suggestions on where I could look?

  2. dsader
    Member
    Posted 16 years ago #

    WPMU(and WP) does have a get_users_of_blog function, happily.

    Look for case 'users': in wpmu-blogs.php for usage.

    get_users_of_blog is defined in WP core, wp-includes/users.php

  3. wpmuguru
    Member
    Posted 16 years ago #

    As a side note, the problem most likely is that your web server has an execution time limit which your script is exceeding.

    switch_to_blog is resource/cpu intensive and that would be what was eating your cpu time.

About this Topic

  • Started 16 years ago by dancrumb
  • Latest reply from wpmuguru