fixicons.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
  3. admin_gatekeeper();
  4. set_time_limit(0);
  5. $options = array(
  6. 'type' => 'user',
  7. 'limit' => 0,
  8. );
  9. $MIGRATED = 0;
  10. function copyr($source, $dest)
  11. {
  12. // recursive function to copy
  13. // all subdirectories and contents:
  14. if(is_dir($source)) {
  15. $dir_handle=opendir($source);
  16. $sourcefolder = basename($source);
  17. if (!file_exists($dest."/".$sourcefolder))
  18. mkdir($dest."/".$sourcefolder, 0700, true);
  19. while($file=readdir($dir_handle)){
  20. if($file!="." && $file!=".."){
  21. if(is_dir($source."/".$file)){
  22. copyr($source."/".$file, $dest."/".$sourcefolder);
  23. } else {
  24. if (!file_exists($dest."/$sourcefolder/".$file)) {
  25. copy($source."/".$file, $dest."/$sourcefolder/".$file);
  26. }
  27. }
  28. }
  29. }
  30. closedir($dir_handle);
  31. } else {
  32. // can also handle simple copy commands
  33. if (!file_exists($dest)) {
  34. error_log("copy $source $dest");
  35. copy($source, $dest);
  36. }
  37. }
  38. }
  39. function profile_2012100501($user) {
  40. global $CONFIG;
  41. $data_root = $CONFIG->dataroot;
  42. $join_date = $user->getTimeCreated();
  43. date_default_timezone_set('UTC');
  44. $user_path_utc = date('Y/m/d/', $join_date) . $user->guid;
  45. $user_path_utc = "$data_root$user_path_utc";
  46. date_default_timezone_set('Europe/Berlin');
  47. $user_path = date('Y/m/d/', $join_date) . $user->guid;
  48. $user_path = "$data_root$user_path";
  49. $user_path2 = date('Y/m/d', $join_date);
  50. $user_path2 = "$data_root$user_path2";
  51. if ($user_path == $user_path_utc) {
  52. return true;
  53. }
  54. // error_log("check $user_path_utc");
  55. if (file_exists($user_path_utc)) {
  56. if (!file_exists($user_path)) {
  57. mkdir($user_path, 0700, true);
  58. }
  59. error_log("merge files: $user_path_utc, $user_path");
  60. copyr($user_path_utc, $user_path2);
  61. }
  62. return true;
  63. }
  64. $previous_access = elgg_set_ignore_access(true);
  65. $batch = new ElggBatch('elgg_get_entities', $options, "profile_2012100501", 100);
  66. elgg_set_ignore_access($previous_access);
  67. if ($batch->callbackResult) {
  68. error_log("Elgg user files merge upgrade (201210050) succeeded");
  69. } else {
  70. error_log("Elgg user files merge upgrade (201210050) failed");
  71. }
  72. ?>