Advertisement
Guest User

Untitled

a guest
Sep 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. echo "memory use: " . memory_get_usage() . "\n";
  5.  
  6. $configdir = __FILE__;
  7. $configdir = preg_replace('|wp-content\/.*|','',$configdir);
  8. $configdir .= 'wp-load.php';
  9.  
  10. error_reporting(E_ALL);
  11. ini_set('display_errors','On');
  12. ini_set('display_startup_errors','On');
  13.  
  14. // set some required variables if running from cli
  15. if (empty($_SERVER['HTTP_HOST']))
  16. {
  17. $_SERVER["SERVER_NAME"] = "localhost";
  18. $_SERVER["HTTP_HOST"] = '127.0.0.1';
  19. $_SERVER["SERVER_PROTOCOL"] = 'HTTP/1.1';
  20. $_SERVER["HTTP_USER_AGENT"] = "fake agent";
  21. $_SERVER["HTTP_ACCEPT"] = "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1";
  22. }
  23. echo "Loading: $configdir\n";
  24.  
  25. if (file_exists($configdir))
  26. include("$configdir");
  27. else
  28. die ("Can not load $configdir\n");
  29.  
  30. if (function_exists('switch_to_blog'))
  31. {
  32. global $wpdb;
  33. $blogs = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs ORDER BY blog_id DESC LIMIT %d,5", $c ) );
  34.  
  35. foreach( $blogs as $blog ) {
  36. if( $blog != $tags_blog_id ) {
  37. $details = get_blog_details( $blog );
  38. print_r($details);
  39. switch_to_blog($details->blog_id);
  40.  
  41. if ( get_option( 'timezone_string' ) != 'Europe/Stockholm' ) {
  42. update_option( 'timezone_string', 'Europe/Stockholm' );
  43. } else {
  44. $deprecated = ' ';
  45. $autoload = 'yes';
  46. add_option( 'timezone_string', 'Europe/Stockholm', $deprecated, $autoload );
  47. }
  48.  
  49. if ( get_option( 'gmt_offset' ) != '' ) {
  50. update_option( 'gmt_offset', '' );
  51. } else {
  52. $deprecated = ' ';
  53. $autoload = 'yes';
  54. add_option( 'gmt_offset', '', $deprecated, $autoload );
  55. }
  56.  
  57. }
  58. $c++;
  59. }
  60.  
  61.  
  62. }
  63.  
  64. echo "memory use: " . memory_get_usage() . "\n";
  65.  
  66. echo "Done!";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement