From 399bbfe77c1d0abd29052745048fb3602e04564a Mon Sep 17 00:00:00 2001 From: lucha <lucha@paranoici.org> Date: Sat, 26 Nov 2016 16:53:11 +0100 Subject: [PATCH] command to fix cdn config --- bin/noblogs.in | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/bin/noblogs.in b/bin/noblogs.in index 91c2f2e..129bf45 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) { -- GitLab