Method for displaying themes in use

0

It would be nice to see a list of all themes that are in use, by how many blogs and by which blogs. Not sure how difficult this is but list which blogs have modified the theme.

Thoughts?

  • drmike
    • DEV MAN’s Mascot

    Here’s the fix to make it cached for an hour:

    // do stats
    if($blogs) {

    $count_ts = get_site_option( "theme_count_ts" );

    if( time() - $count_ts > 3600 ) {
    foreach ($blogs as $blog) {
    if( !array_key_exists( $blogtheme[$blog->blog_id], $themeinfo ) ) {
    $themeinfo[$blogtheme[$blog->blog_id]] = 1;
    $themeblogs[$blogtheme[$blog->blog_id]] = array();
    $themeblogs[$blogtheme[$blog->blog_id]][0] = $blog;
    } else {
    $themeblogs[$blogtheme[$blog->blog_id]][$themeinfo[$blogtheme[$blog->blog_id]]] = $blog;
    $themeinfo[$blogtheme[$blog->blog_id]]++;
    }
    }
    arsort($themeinfo);
    update_site_option( "theme_count", $themeinfo );
    update_site_option( "theme_count_ts", time() );

    }

    $themecount = get_site_option( "theme_count" );
    }
    // show stats

  • drmike
    • DEV MAN’s Mascot

    We don’t use this plugin so it may or may not work for you. (We’d rather count themes changes to be honest.) A very quick test shows that it does. Your mileage may vary.

    That reminds me. I needed to do that blog directory as cached…..

    edit: An additional fix would be to remove the javascripts with their listing of blogs and just display the theme count. If you;re doing that, I’d remove the saving of the blogs as well. This was just a two minute coding project.

  • drmike
    • DEV MAN’s Mascot

    It does. I hadn’t looked at it before so I was more concerned that it was doing public output that visitors could see. And refresh, over and over again. If that’s what was happening, I’d be more concerned about load. Considering that this is a Site Admin page and only you’re going to see it, it’s not really an issue.

    For example, the blog directory that Andrea wrote about eons ago is something that needs to be cached. That’s public, you can have lots of folks looking at it over and over again, it’s running through a long list of blogs if you do have that many, etc.

    edit: If you have hundreds if not thousands of blogs, I’d be more concerned about the links and the data being saved. The code that generates that should go. Just to save the same and to be able to generate a smaller page.