From 912fa61a7f5bbeb68c575089333df9b208627aa4 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 15 Mar 2014 14:55:00 -0300 Subject: Squashed 'mod/upgrade-tools/' content from commit 862658a git-subtree-dir: mod/upgrade-tools git-subtree-split: 862658a7512afda1910f600169cc7cd970bd593f --- fixicons.php | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++ lib/upgrade_tools.php | 25 ++++++++++++++++ manifest.xml | 17 +++++++++++ start.php | 1 + 4 files changed, 126 insertions(+) create mode 100644 fixicons.php create mode 100644 lib/upgrade_tools.php create mode 100644 manifest.xml create mode 100644 start.php diff --git a/fixicons.php b/fixicons.php new file mode 100644 index 000000000..f233cfa0d --- /dev/null +++ b/fixicons.php @@ -0,0 +1,83 @@ + 'user', + 'limit' => 0, +); +$MIGRATED = 0; + +function copyr($source, $dest) +{ + // recursive function to copy + // all subdirectories and contents: + if(is_dir($source)) { + $dir_handle=opendir($source); + $sourcefolder = basename($source); + if (!file_exists($dest."/".$sourcefolder)) + mkdir($dest."/".$sourcefolder, 0700, true); + while($file=readdir($dir_handle)){ + if($file!="." && $file!=".."){ + if(is_dir($source."/".$file)){ + copyr($source."/".$file, $dest."/".$sourcefolder); + } else { + if (!file_exists($dest."/$sourcefolder/".$file)) { + copy($source."/".$file, $dest."/$sourcefolder/".$file); + } + } + } + } + closedir($dir_handle); + } else { + // can also handle simple copy commands + if (!file_exists($dest)) { + error_log("copy $source $dest"); + copy($source, $dest); + } + } +} + +function profile_2012100501($user) { + global $CONFIG; + $data_root = $CONFIG->dataroot; + $join_date = $user->getTimeCreated(); + + date_default_timezone_set('UTC'); + $user_path_utc = date('Y/m/d/', $join_date) . $user->guid; + $user_path_utc = "$data_root$user_path_utc"; + + date_default_timezone_set('Europe/Berlin'); + $user_path = date('Y/m/d/', $join_date) . $user->guid; + $user_path = "$data_root$user_path"; + $user_path2 = date('Y/m/d', $join_date); + $user_path2 = "$data_root$user_path2"; + if ($user_path == $user_path_utc) { + return true; + } + + // error_log("check $user_path_utc"); + if (file_exists($user_path_utc)) { + if (!file_exists($user_path)) { + mkdir($user_path, 0700, true); + } + error_log("merge files: $user_path_utc, $user_path"); + copyr($user_path_utc, $user_path2); + } + return true; +} + +$previous_access = elgg_set_ignore_access(true); +$batch = new ElggBatch('elgg_get_entities', $options, "profile_2012100501", 100); +elgg_set_ignore_access($previous_access); + +if ($batch->callbackResult) { + error_log("Elgg user files merge upgrade (201210050) succeeded"); +} else { + error_log("Elgg user files merge upgrade (201210050) failed"); +} + + +?> diff --git a/lib/upgrade_tools.php b/lib/upgrade_tools.php new file mode 100644 index 000000000..20badf9be --- /dev/null +++ b/lib/upgrade_tools.php @@ -0,0 +1,25 @@ +guid"); + return true; +} + +function upgrade_update_river($id, $view, $object_guid, $annotation_id) { + $dbprefix = elgg_get_config('dbprefix'); + update_data("UPDATE {$dbprefix}river set view='$view', object_guid=$object_guid, annotation_id=$annotation_id WHERE id=$id"); + return true; +} diff --git a/manifest.xml b/manifest.xml new file mode 100644 index 000000000..5f875975b --- /dev/null +++ b/manifest.xml @@ -0,0 +1,17 @@ + + + Upgrade Tools + Lorea Developers + 1.8.1 + bundled + content + widget + Upgrade tools + http://lorea.org/ + See COPYRIGHT.txt + GNU General Public License version 2 + + elgg_release + 1.8 + + diff --git a/start.php b/start.php new file mode 100644 index 000000000..b3d9bbc7f --- /dev/null +++ b/start.php @@ -0,0 +1 @@ +