Changeset 1189487
- Timestamp:
- 06/29/2015 11:27:44 AM (11 years ago)
- Location:
- angry-creative-logger
- Files:
-
- 2 added
- 2 deleted
- 20 edited
- 1 copied
-
tags/0.8 (copied) (copied from angry-creative-logger/trunk)
-
tags/0.8/classes/inspector.php (modified) (2 diffs)
-
tags/0.8/classes/routine_handler.php (modified) (2 diffs)
-
tags/0.8/classes/settings.php (modified) (1 diff)
-
tags/0.8/classes/wp_cli.php (modified) (5 diffs)
-
tags/0.8/functions.php (modified) (1 diff)
-
tags/0.8/plugin.php (modified) (1 diff)
-
tags/0.8/readme.txt (modified) (2 diffs)
-
tags/0.8/routines/db_collations.php (modified) (3 diffs)
-
tags/0.8/routines/file_permissions.php (added)
-
tags/0.8/routines/git_status.php (modified) (1 diff)
-
tags/0.8/routines/site_visibility.php (modified) (2 diffs)
-
tags/0.8/routines/write_permissions.php (deleted)
-
trunk/classes/inspector.php (modified) (2 diffs)
-
trunk/classes/routine_handler.php (modified) (2 diffs)
-
trunk/classes/settings.php (modified) (1 diff)
-
trunk/classes/wp_cli.php (modified) (5 diffs)
-
trunk/functions.php (modified) (1 diff)
-
trunk/plugin.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/routines/db_collations.php (modified) (3 diffs)
-
trunk/routines/file_permissions.php (added)
-
trunk/routines/git_status.php (modified) (1 diff)
-
trunk/routines/site_visibility.php (modified) (2 diffs)
-
trunk/routines/write_permissions.php (deleted)
Legend:
- Unmodified
- Added
- Removed
-
angry-creative-logger/tags/0.8/classes/inspector.php
r1171849 r1189487 2 2 /* 3 3 Class name: AC Inspector 4 Version: 0. 64 Version: 0.7 5 5 Author: Sammy Nordström, Angry Creative AB 6 6 */ … … 323 323 } 324 324 325 if ( $args['success'] ) { 326 $log_level = "success"; 327 } 328 329 if ( $args['error'] ) { 330 $log_level = "error"; 331 } 332 325 333 $output = '['.date("d M, Y H:i:s").'] ['.__CLASS__.'] [ ' .strtoupper($log_level). ' ] - '; 326 334 -
angry-creative-logger/tags/0.8/classes/routine_handler.php
r1171849 r1189487 2 2 /* 3 3 Class name: ACI Routine Handler 4 Version: 0. 3.25 Depends: AC Inspector 0.5.x 4 Version: 0.4 5 Depends: AC Inspector 0.5.x or newer 6 6 Author: Sammy Nordström, Angry Creative AB 7 7 */ … … 195 195 self::$force_enabled = array_merge( self::$force_enabled, array( $routine ) ); 196 196 } 197 198 } 199 200 public static function release_tier_aware() { 201 202 if ( defined( 'SITE_RELEASE_TIER' ) ) { 203 return true; 204 } 205 206 return false; 207 208 } 209 210 public static function get_release_tier() { 211 212 if ( defined( 'SITE_RELEASE_TIER' ) && in_array( SITE_RELEASE_TIER, array( 'local', 'development', 'integration', 'test', 'stage', 'production' ) ) ) { 213 return SITE_RELEASE_TIER; 214 } 215 216 return false; 217 218 } 219 220 public static function is_release_tier( $tier ) { 221 222 if ( defined( 'SITE_RELEASE_TIER' ) && !empty( $tier ) && $tier == SITE_RELEASE_TIER ) { 223 return true; 224 } 225 226 return false; 197 227 198 228 } -
angry-creative-logger/tags/0.8/classes/settings.php
r1125402 r1189487 3 3 Class name: ACI Settings 4 4 Version: 0.3.2 5 Depends: AC Inspector 0.5.x 5 Depends: AC Inspector 0.5.x or newer 6 6 Author: Sammy Nordström, Angry Creative AB 7 7 */ -
angry-creative-logger/tags/0.8/classes/wp_cli.php
r1171849 r1189487 3 3 /* 4 4 Class name: Angry Inspector Command 5 Version: 0. 16 Depends: AC Inspector 0. 65 Version: 0.2 6 Depends: AC Inspector 0.7, ACI Routine Handler 0.4 7 7 Author: Sammy Nordström, Angry Creative AB 8 8 */ … … 20 20 * ## EXAMPLES 21 21 * 22 * wp angry-inspector inspect write-permissions22 * wp angry-inspector inspect file-permissions 23 23 * 24 24 * @synopsis [--force] [<routine>] [<other-routine>] … … 93 93 } 94 94 95 if ( AC_Inspector::$error_count ) { 96 AC_Inspector::$error_count = 0; 97 continue; 98 } 99 95 100 $routine_log_count = AC_Inspector::$log_count - $total_log_count; 96 101 97 WP_CLI::success( "Inspected $routine with $routine_log_count remark(s).\n" ); 102 WP_CLI::success( "Inspected $routine with $routine_log_count remark(s).\n" ); 103 104 if ( $routine_log_count > 0 ) { 105 106 $repair_method = ACI_Routine_Handler::get_repair_method( $all_routines[$routine_key], $routine_options ); 107 if ( !empty( $repair_method ) ) { 108 109 WP_CLI::confirm( "Routine $routine has a repair method that may or may not fix the problem for you.\n" . 110 "Have you made a backup of your website's entire source code, uploaded files and database\n" . 111 "and want me to try and run the repair method with the risk of me messing everything up?" ); 112 113 $total_log_count = AC_Inspector::$log_count; 114 $total_error_count = AC_Inspector::$error_count; 115 $total_success_count = AC_Inspector::$success_count; 116 117 call_user_func( $repair_method ); 118 119 $routine_log_count = AC_Inspector::$log_count - $total_log_count; 120 $routine_error_count = AC_Inspector::$error_count - $total_error_count; 121 $routine_success_count = AC_Inspector::$success_count - $total_success_count; 122 123 if ( $routine_error_count > 0 ) { 124 WP_CLI::error( "Repair method for routine '$routine' yielded $routine_error_count error(s).\n" ); 125 } else if ( $routine_success_count > 0 || $routine_log_count > 0 ) { 126 WP_CLI::success( "Successfully performed repair method for routine '$routine' with no errors.\n" ); 127 } else { 128 WP_CLI::success( "Nothing seems broken. If it ain't broke, don't fix it.\n" ); 129 } 130 131 } 132 133 } 98 134 99 135 } else { … … 117 153 * ## EXAMPLES 118 154 * 119 * wp angry-inspector repair write-permissions155 * wp angry-inspector repair file-permissions 120 156 * 121 157 * @synopsis [--force] [<routine>] [<other-routine>] … … 217 253 218 254 WP_CLI::add_command( 'angry-inspector', 'Angry_Inspector_Command' ); 255 -
angry-creative-logger/tags/0.8/functions.php
r839003 r1189487 12 12 13 13 } 14 15 function aci_release_tier_aware() { 16 17 return ACI_Routine_Handler::release_tier_aware(); 18 19 } 20 21 function aci_get_release_tier() { 22 23 return ACI_Routine_Handler::get_release_tier(); 24 25 } 26 27 function aci_is_release_tier( $tier ) { 28 29 return ACI_Routine_Handler::is_release_tier( $tier ); 30 31 } -
angry-creative-logger/tags/0.8/plugin.php
r1171849 r1189487 4 4 Plugin URI: http://angrycreative.se 5 5 Description: Inspects and logs possible issues with your Wordpress installation. 6 Version: 0. 76 Version: 0.8 7 7 Author: Robin Björklund, Sammy Nordström, Angry Creative AB 8 8 */ 9 9 10 define( 'ACI_PLUGIN_VERSION', '0. 7' );10 define( 'ACI_PLUGIN_VERSION', '0.8' ); 11 11 12 12 define( 'ACI_PLUGIN_DIR', dirname( __FILE__ ) ); -
angry-creative-logger/tags/0.8/readme.txt
r1171849 r1189487 4 4 Requires at least: 4.0 5 5 Tested up to: 4.2.2 6 Stable tag: 0. 76 Stable tag: 0.8 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 21 21 22 22 == Changelog == 23 24 = 0.8.x = 25 * WP CLI interactivity for running possible repair method when inspection yields errors 26 * Completely rewritten and much improved file permissions inspection routine 27 * Added the abilitiy to define HTTPD_USER (http daemon user name) in wp-config.php 28 * Added the abilitiy to define FS_USER (file owner user name) in wp-config.php 29 * Added repair method to file permissions routine using HTTPD_USER and FS_USER for setting ownerships 30 * Added the abilitiy to define SITE_RELEASE_TIER (local/development/test/integration/stage/production) in wp-config.php 31 * Added repair method to site visibility routine using SITE_RELEASE_TIER for making the site public or private 23 32 24 33 = 0.7.x = -
angry-creative-logger/tags/0.8/routines/db_collations.php
r1171849 r1189487 87 87 88 88 if ( $proper_db_collation != $default_db_collation ) { 89 if ( $wpdb->query( $wpdb->prepare( "ALTER DATABASE ".DB_NAME."CHARACTER SET %s COLLATE %s", $proper_charset, $proper_db_collation ) ) ) {89 if ( $wpdb->query( $wpdb->prepare( "ALTER DATABASE `".DB_NAME."` CHARACTER SET %s COLLATE %s", $proper_charset, $proper_db_collation ) ) ) { 90 90 AC_Inspector::log( "Converted default table collation from $default_db_collation to $proper_db_collation.", __CLASS__, array( 'success' => true ) ); 91 91 } else { … … 105 105 106 106 if ( $proper_db_collation != $tbl_collation ) { 107 if ( $wpdb->query( $wpdb->prepare( "ALTER TABLE ".$tbl_name."CONVERT TO CHARACTER SET %s COLLATE %s", $proper_charset, $proper_db_collation ) ) ) {107 if ( $wpdb->query( $wpdb->prepare( "ALTER TABLE `".$tbl_name."` CONVERT TO CHARACTER SET %s COLLATE %s", $proper_charset, $proper_db_collation ) ) ) { 108 108 AC_Inspector::log( "Converted collation for $tbl_name from $tbl_collation to $proper_db_collation.", __CLASS__, array( 'success' => true ) ); 109 109 } else { … … 122 122 if ( $column->Collation ) { 123 123 if ( $proper_db_collation !== $column->Collation ) { 124 if ( $wpdb->query( $wpdb->prepare( "ALTER TABLE ".$tbl_name."CONVERT TO CHARACTER SET %s COLLATE %s", $proper_charset, $proper_db_collation ) ) ) {124 if ( $wpdb->query( $wpdb->prepare( "ALTER TABLE `".$tbl_name."` CONVERT TO CHARACTER SET %s COLLATE %s", $proper_charset, $proper_db_collation ) ) ) { 125 125 AC_Inspector::log( "Converted collation for $tbl_name from $tbl_collation to $proper_db_collation.", __CLASS__, array( 'success' => true ) ); 126 126 } else { -
angry-creative-logger/tags/0.8/routines/git_status.php
r1125422 r1189487 11 11 const DESCRIPTION = "Detects uncommited file changes in the site's Git-repository."; 12 12 13 private static $_default_ignore_files = array('wp-content/uploads/*'); 13 private static $_default_ignore_files = array( 14 'wp-content/uploads/*', 15 'wp-content/blogs.dir/*', 16 'wp-content/cache/*', 17 'wp-content/avatars/*', 18 'wp-content/*/LC_MESSAGES/*' 19 ); 14 20 15 21 public static function register() { -
angry-creative-logger/tags/0.8/routines/site_visibility.php
r1171849 r1189487 2 2 3 3 /* 4 * Checks site visibility4 * Checks and repairs site visibility 5 5 */ 6 6 … … 60 60 } 61 61 62 public static function repair() { 63 64 if ( !aci_release_tier_aware() ) { 65 AC_Inspector::log( 'Unable to determine the appropriate site visibility setting, please define SITE_RELEASE_TIER in your wp-config.php.', __CLASS__, array( 'error' => true ) ); 66 return; 67 } 68 69 $release_tier = aci_get_release_tier(); 70 71 if ( is_multisite() && is_plugin_active_for_network( ACI_PLUGIN_BASENAME ) ) { 72 73 global $wpdb; 74 $site_blog_ids = $wpdb->get_col("SELECT blog_id FROM ".$wpdb->prefix."blogs"); 75 76 if (is_array($site_blog_ids)) { 77 foreach( $site_blog_ids AS $site_blog_id ) { 78 79 if (intval($site_blog_id) > 0) { 80 81 $visible = get_blog_details( $site_blog_id )->public; 82 83 if ( ( !$visible && $release_tier == 'production' ) || ( $visible && $release_tier != 'production' ) ) { 84 85 $visible = $visible ? 0 : 1; 86 87 switch_to_blog( $site_blog_id ); 88 update_option( 'blog_public', $visible ); 89 restore_current_blog(); 90 91 AC_Inspector::log( 'The site visibility setting for ' . get_blog_details( $site_blog_id, true )->blogname .' is now ' . ( ( $visible ) ? ' public' : ' private' ) . '.', __CLASS__, array( 'success' => true ) ); 92 93 } else { 94 95 AC_Inspector::log( 'The site visibility setting for ' . get_blog_details( $site_blog_id, true )->blogname .' seems correct, no action taken.', __CLASS__, array( 'log_level' => 'notice' ) ); 96 97 } 98 } 99 100 } 101 } 102 103 } else { 104 105 $visible = get_option('blog_public'); 106 107 if ( ( !$visible && $release_tier == 'production' ) || ( $visible && $release_tier != 'production' ) ) { 108 109 $visible = $visible ? 0 : 1; 110 update_option( 'blog_public', $visible ); 111 112 AC_Inspector::log( 'The site visibility setting is now ' . ( ( $visible ) ? ' public' : ' private' ) . '.', __CLASS__, array( 'success' => true ) ); 113 114 } else { 115 116 AC_Inspector::log( 'The site visibility setting seems correct, no action taken.', __CLASS__, array( 'log_level' => 'notice' ) ); 117 118 } 119 120 } 121 122 } 123 62 124 } 63 125 -
angry-creative-logger/trunk/classes/inspector.php
r1171849 r1189487 2 2 /* 3 3 Class name: AC Inspector 4 Version: 0. 64 Version: 0.7 5 5 Author: Sammy Nordström, Angry Creative AB 6 6 */ … … 323 323 } 324 324 325 if ( $args['success'] ) { 326 $log_level = "success"; 327 } 328 329 if ( $args['error'] ) { 330 $log_level = "error"; 331 } 332 325 333 $output = '['.date("d M, Y H:i:s").'] ['.__CLASS__.'] [ ' .strtoupper($log_level). ' ] - '; 326 334 -
angry-creative-logger/trunk/classes/routine_handler.php
r1171849 r1189487 2 2 /* 3 3 Class name: ACI Routine Handler 4 Version: 0. 3.25 Depends: AC Inspector 0.5.x 4 Version: 0.4 5 Depends: AC Inspector 0.5.x or newer 6 6 Author: Sammy Nordström, Angry Creative AB 7 7 */ … … 195 195 self::$force_enabled = array_merge( self::$force_enabled, array( $routine ) ); 196 196 } 197 198 } 199 200 public static function release_tier_aware() { 201 202 if ( defined( 'SITE_RELEASE_TIER' ) ) { 203 return true; 204 } 205 206 return false; 207 208 } 209 210 public static function get_release_tier() { 211 212 if ( defined( 'SITE_RELEASE_TIER' ) && in_array( SITE_RELEASE_TIER, array( 'local', 'development', 'integration', 'test', 'stage', 'production' ) ) ) { 213 return SITE_RELEASE_TIER; 214 } 215 216 return false; 217 218 } 219 220 public static function is_release_tier( $tier ) { 221 222 if ( defined( 'SITE_RELEASE_TIER' ) && !empty( $tier ) && $tier == SITE_RELEASE_TIER ) { 223 return true; 224 } 225 226 return false; 197 227 198 228 } -
angry-creative-logger/trunk/classes/settings.php
r1125402 r1189487 3 3 Class name: ACI Settings 4 4 Version: 0.3.2 5 Depends: AC Inspector 0.5.x 5 Depends: AC Inspector 0.5.x or newer 6 6 Author: Sammy Nordström, Angry Creative AB 7 7 */ -
angry-creative-logger/trunk/classes/wp_cli.php
r1171849 r1189487 3 3 /* 4 4 Class name: Angry Inspector Command 5 Version: 0. 16 Depends: AC Inspector 0. 65 Version: 0.2 6 Depends: AC Inspector 0.7, ACI Routine Handler 0.4 7 7 Author: Sammy Nordström, Angry Creative AB 8 8 */ … … 20 20 * ## EXAMPLES 21 21 * 22 * wp angry-inspector inspect write-permissions22 * wp angry-inspector inspect file-permissions 23 23 * 24 24 * @synopsis [--force] [<routine>] [<other-routine>] … … 93 93 } 94 94 95 if ( AC_Inspector::$error_count ) { 96 AC_Inspector::$error_count = 0; 97 continue; 98 } 99 95 100 $routine_log_count = AC_Inspector::$log_count - $total_log_count; 96 101 97 WP_CLI::success( "Inspected $routine with $routine_log_count remark(s).\n" ); 102 WP_CLI::success( "Inspected $routine with $routine_log_count remark(s).\n" ); 103 104 if ( $routine_log_count > 0 ) { 105 106 $repair_method = ACI_Routine_Handler::get_repair_method( $all_routines[$routine_key], $routine_options ); 107 if ( !empty( $repair_method ) ) { 108 109 WP_CLI::confirm( "Routine $routine has a repair method that may or may not fix the problem for you.\n" . 110 "Have you made a backup of your website's entire source code, uploaded files and database\n" . 111 "and want me to try and run the repair method with the risk of me messing everything up?" ); 112 113 $total_log_count = AC_Inspector::$log_count; 114 $total_error_count = AC_Inspector::$error_count; 115 $total_success_count = AC_Inspector::$success_count; 116 117 call_user_func( $repair_method ); 118 119 $routine_log_count = AC_Inspector::$log_count - $total_log_count; 120 $routine_error_count = AC_Inspector::$error_count - $total_error_count; 121 $routine_success_count = AC_Inspector::$success_count - $total_success_count; 122 123 if ( $routine_error_count > 0 ) { 124 WP_CLI::error( "Repair method for routine '$routine' yielded $routine_error_count error(s).\n" ); 125 } else if ( $routine_success_count > 0 || $routine_log_count > 0 ) { 126 WP_CLI::success( "Successfully performed repair method for routine '$routine' with no errors.\n" ); 127 } else { 128 WP_CLI::success( "Nothing seems broken. If it ain't broke, don't fix it.\n" ); 129 } 130 131 } 132 133 } 98 134 99 135 } else { … … 117 153 * ## EXAMPLES 118 154 * 119 * wp angry-inspector repair write-permissions155 * wp angry-inspector repair file-permissions 120 156 * 121 157 * @synopsis [--force] [<routine>] [<other-routine>] … … 217 253 218 254 WP_CLI::add_command( 'angry-inspector', 'Angry_Inspector_Command' ); 255 -
angry-creative-logger/trunk/functions.php
r839003 r1189487 12 12 13 13 } 14 15 function aci_release_tier_aware() { 16 17 return ACI_Routine_Handler::release_tier_aware(); 18 19 } 20 21 function aci_get_release_tier() { 22 23 return ACI_Routine_Handler::get_release_tier(); 24 25 } 26 27 function aci_is_release_tier( $tier ) { 28 29 return ACI_Routine_Handler::is_release_tier( $tier ); 30 31 } -
angry-creative-logger/trunk/plugin.php
r1171849 r1189487 4 4 Plugin URI: http://angrycreative.se 5 5 Description: Inspects and logs possible issues with your Wordpress installation. 6 Version: 0. 76 Version: 0.8 7 7 Author: Robin Björklund, Sammy Nordström, Angry Creative AB 8 8 */ 9 9 10 define( 'ACI_PLUGIN_VERSION', '0. 7' );10 define( 'ACI_PLUGIN_VERSION', '0.8' ); 11 11 12 12 define( 'ACI_PLUGIN_DIR', dirname( __FILE__ ) ); -
angry-creative-logger/trunk/readme.txt
r1171849 r1189487 4 4 Requires at least: 4.0 5 5 Tested up to: 4.2.2 6 Stable tag: 0. 76 Stable tag: 0.8 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 21 21 22 22 == Changelog == 23 24 = 0.8.x = 25 * WP CLI interactivity for running possible repair method when inspection yields errors 26 * Completely rewritten and much improved file permissions inspection routine 27 * Added the abilitiy to define HTTPD_USER (http daemon user name) in wp-config.php 28 * Added the abilitiy to define FS_USER (file owner user name) in wp-config.php 29 * Added repair method to file permissions routine using HTTPD_USER and FS_USER for setting ownerships 30 * Added the abilitiy to define SITE_RELEASE_TIER (local/development/test/integration/stage/production) in wp-config.php 31 * Added repair method to site visibility routine using SITE_RELEASE_TIER for making the site public or private 23 32 24 33 = 0.7.x = -
angry-creative-logger/trunk/routines/db_collations.php
r1171849 r1189487 87 87 88 88 if ( $proper_db_collation != $default_db_collation ) { 89 if ( $wpdb->query( $wpdb->prepare( "ALTER DATABASE ".DB_NAME."CHARACTER SET %s COLLATE %s", $proper_charset, $proper_db_collation ) ) ) {89 if ( $wpdb->query( $wpdb->prepare( "ALTER DATABASE `".DB_NAME."` CHARACTER SET %s COLLATE %s", $proper_charset, $proper_db_collation ) ) ) { 90 90 AC_Inspector::log( "Converted default table collation from $default_db_collation to $proper_db_collation.", __CLASS__, array( 'success' => true ) ); 91 91 } else { … … 105 105 106 106 if ( $proper_db_collation != $tbl_collation ) { 107 if ( $wpdb->query( $wpdb->prepare( "ALTER TABLE ".$tbl_name."CONVERT TO CHARACTER SET %s COLLATE %s", $proper_charset, $proper_db_collation ) ) ) {107 if ( $wpdb->query( $wpdb->prepare( "ALTER TABLE `".$tbl_name."` CONVERT TO CHARACTER SET %s COLLATE %s", $proper_charset, $proper_db_collation ) ) ) { 108 108 AC_Inspector::log( "Converted collation for $tbl_name from $tbl_collation to $proper_db_collation.", __CLASS__, array( 'success' => true ) ); 109 109 } else { … … 122 122 if ( $column->Collation ) { 123 123 if ( $proper_db_collation !== $column->Collation ) { 124 if ( $wpdb->query( $wpdb->prepare( "ALTER TABLE ".$tbl_name."CONVERT TO CHARACTER SET %s COLLATE %s", $proper_charset, $proper_db_collation ) ) ) {124 if ( $wpdb->query( $wpdb->prepare( "ALTER TABLE `".$tbl_name."` CONVERT TO CHARACTER SET %s COLLATE %s", $proper_charset, $proper_db_collation ) ) ) { 125 125 AC_Inspector::log( "Converted collation for $tbl_name from $tbl_collation to $proper_db_collation.", __CLASS__, array( 'success' => true ) ); 126 126 } else { -
angry-creative-logger/trunk/routines/git_status.php
r1125422 r1189487 11 11 const DESCRIPTION = "Detects uncommited file changes in the site's Git-repository."; 12 12 13 private static $_default_ignore_files = array('wp-content/uploads/*'); 13 private static $_default_ignore_files = array( 14 'wp-content/uploads/*', 15 'wp-content/blogs.dir/*', 16 'wp-content/cache/*', 17 'wp-content/avatars/*', 18 'wp-content/*/LC_MESSAGES/*' 19 ); 14 20 15 21 public static function register() { -
angry-creative-logger/trunk/routines/site_visibility.php
r1171849 r1189487 2 2 3 3 /* 4 * Checks site visibility4 * Checks and repairs site visibility 5 5 */ 6 6 … … 60 60 } 61 61 62 public static function repair() { 63 64 if ( !aci_release_tier_aware() ) { 65 AC_Inspector::log( 'Unable to determine the appropriate site visibility setting, please define SITE_RELEASE_TIER in your wp-config.php.', __CLASS__, array( 'error' => true ) ); 66 return; 67 } 68 69 $release_tier = aci_get_release_tier(); 70 71 if ( is_multisite() && is_plugin_active_for_network( ACI_PLUGIN_BASENAME ) ) { 72 73 global $wpdb; 74 $site_blog_ids = $wpdb->get_col("SELECT blog_id FROM ".$wpdb->prefix."blogs"); 75 76 if (is_array($site_blog_ids)) { 77 foreach( $site_blog_ids AS $site_blog_id ) { 78 79 if (intval($site_blog_id) > 0) { 80 81 $visible = get_blog_details( $site_blog_id )->public; 82 83 if ( ( !$visible && $release_tier == 'production' ) || ( $visible && $release_tier != 'production' ) ) { 84 85 $visible = $visible ? 0 : 1; 86 87 switch_to_blog( $site_blog_id ); 88 update_option( 'blog_public', $visible ); 89 restore_current_blog(); 90 91 AC_Inspector::log( 'The site visibility setting for ' . get_blog_details( $site_blog_id, true )->blogname .' is now ' . ( ( $visible ) ? ' public' : ' private' ) . '.', __CLASS__, array( 'success' => true ) ); 92 93 } else { 94 95 AC_Inspector::log( 'The site visibility setting for ' . get_blog_details( $site_blog_id, true )->blogname .' seems correct, no action taken.', __CLASS__, array( 'log_level' => 'notice' ) ); 96 97 } 98 } 99 100 } 101 } 102 103 } else { 104 105 $visible = get_option('blog_public'); 106 107 if ( ( !$visible && $release_tier == 'production' ) || ( $visible && $release_tier != 'production' ) ) { 108 109 $visible = $visible ? 0 : 1; 110 update_option( 'blog_public', $visible ); 111 112 AC_Inspector::log( 'The site visibility setting is now ' . ( ( $visible ) ? ' public' : ' private' ) . '.', __CLASS__, array( 'success' => true ) ); 113 114 } else { 115 116 AC_Inspector::log( 'The site visibility setting seems correct, no action taken.', __CLASS__, array( 'log_level' => 'notice' ) ); 117 118 } 119 120 } 121 122 } 123 62 124 } 63 125
Note: See TracChangeset
for help on using the changeset viewer.