diff --git a/bin/noblogs.in b/bin/noblogs.in index 91c2f2e08b49ffb579294f6a1b5408b4b0a115ed..129bf4543c049568c9672b4cb84cc7117079b297 100755 --- a/bin/noblogs.in +++ b/bin/noblogs.in @@ -75,6 +75,9 @@ Known commands: https-siteurl BLOG Adds https (instead of http) to siteurl and home options. + fix-cdn BLOG + Sets the correct CDN config. + <?php exit(1); } @@ -469,6 +472,35 @@ function do_https_siteurl($args){ } } +// rewrites the correct settings for the CDN +function do_fix_cdn($args){ + $config = array( + 'ossdl_off_cdn_url' => "https://noblogs.ai-cdn.net", + 'ossdl_off_include_dirs' => "wp-content,wp-includes", + 'ossdl_off_exclude' => ".php, blogs.dir", + ); + + foreach ($args as $arg) { + $blog = noblogs_get_blog($arg); + if (!$blog) { + echo "{$arg}: blog not found.\n"; + continue; + } + switch_to_blog($blog->blog_id); + + foreach ($config as $opt => $new){ + $old = get_option($opt); + if ($old === $new){ + continue; + } + update_option($opt,$new); + } + + echo "{$arg}\n"; + restore_current_blog(); + } +} + // Command-line parsing. $cmd = $argv[1]; if (!$cmd) {