diff --git a/bin/noblogs.in b/bin/noblogs.in index a222008236f8b53950cfd55407098e6ca742a368..5ea6b39a39c91b86bb2ef857774cf3821b573f0d 100755 --- a/bin/noblogs.in +++ b/bin/noblogs.in @@ -21,6 +21,9 @@ Known commands: set-option OPTION_NAME OPTION_VALUE BLOG [...] Set the value of an option for the specified blogs. + set-theme THEME_NAME BLOG [...] + Set the theme for the specified blogs. + print-all-blogs Print a list of all existing blog IDs. @@ -68,23 +71,23 @@ Known commands: Set read-only mode for the local noblogs installation. The argument must be either the literal 'on' or 'off'. - ngg-convert BLOG + ngg-convert BLOG Convert Next Gen Gallery (NGG) photo galleries to stardard Wordpress galleries, and then notify (via email) admins of the fact. - https-siteurl BLOG + https-siteurl BLOG Adds https (instead of http) to siteurl and home options. - fix-cdn BLOG + fix-cdn BLOG Sets the correct CDN config. - rename-plugins BLOG + rename-plugins BLOG Disables old plugins and enables new ones, when there has been a change in names. - uninstall-plugin PLUGIN BLOG + uninstall-plugin PLUGIN BLOG Runs unistall action for PLUGIN. - wp-piwik-clear-config BLOG + wp-piwik-clear-config BLOG Clear the configuration for wp-piwik plugin. <?php @@ -189,6 +192,28 @@ function do_set_option($args) { } } +// 'set-theme': Set the theme of a blog. +function do_set_theme($args) { + $theme = array_shift($args); + if (!$theme) { + echo "Not enough arguments\n"; + help(); + } + + foreach ($args as $arg) { + $blog = noblogs_get_blog($arg); + if (!$blog) { + echo "Blog {$arg} not found.\n"; + continue; + } + + switch_to_blog($blog->blog_id); + update_option('template', $theme); + update_option('stylesheet', $theme); + echo "{$arg}: {$theme}\n"; + restore_current_blog(); + } +} // 'dump-shards': Print a JSON dictionary representing the full map // of backend -> blogs database mappings.