aboutsummaryrefslogtreecommitdiff
path: root/mod/upgrade-tools
diff options
context:
space:
mode:
Diffstat (limited to 'mod/upgrade-tools')
-rw-r--r--mod/upgrade-tools/fixicons.php83
-rw-r--r--mod/upgrade-tools/lib/upgrade_tools.php25
-rw-r--r--mod/upgrade-tools/manifest.xml17
-rw-r--r--mod/upgrade-tools/start.php1
4 files changed, 126 insertions, 0 deletions
diff --git a/mod/upgrade-tools/fixicons.php b/mod/upgrade-tools/fixicons.php
new file mode 100644
index 000000000..f233cfa0d
--- /dev/null
+++ b/mod/upgrade-tools/fixicons.php
@@ -0,0 +1,83 @@
+<?php
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+admin_gatekeeper();
+set_time_limit(0);
+
+$options = array(
+ 'type' => '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/mod/upgrade-tools/lib/upgrade_tools.php b/mod/upgrade-tools/lib/upgrade_tools.php
new file mode 100644
index 000000000..20badf9be
--- /dev/null
+++ b/mod/upgrade-tools/lib/upgrade_tools.php
@@ -0,0 +1,25 @@
+<?php
+
+/**
+ * Process upgrades for the videolist plugin
+ */
+function upgrade_module_run($module) {
+ $path = elgg_get_plugins_path() . "$module/upgrades/";
+ $files = elgg_get_upgrade_files($path);
+ foreach ($files as $file) {
+ include "$path{$file}";
+ }
+}
+
+function upgrade_change_subtype($entity, $subtype) {
+ $dbprefix = elgg_get_config('dbprefix');
+ $subtype_id = add_subtype('object', $subtype);
+ update_data("UPDATE {$dbprefix}entities set subtype=$subtype_id WHERE guid=$entity->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/mod/upgrade-tools/manifest.xml b/mod/upgrade-tools/manifest.xml
new file mode 100644
index 000000000..5f875975b
--- /dev/null
+++ b/mod/upgrade-tools/manifest.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
+ <name>Upgrade Tools</name>
+ <author>Lorea Developers</author>
+ <version>1.8.1</version>
+ <category>bundled</category>
+ <category>content</category>
+ <category>widget</category>
+ <description>Upgrade tools</description>
+ <website>http://lorea.org/</website>
+ <copyright>See COPYRIGHT.txt</copyright>
+ <license>GNU General Public License version 2</license>
+ <requires>
+ <type>elgg_release</type>
+ <version>1.8</version>
+ </requires>
+</plugin_manifest>
diff --git a/mod/upgrade-tools/start.php b/mod/upgrade-tools/start.php
new file mode 100644
index 000000000..b3d9bbc7f
--- /dev/null
+++ b/mod/upgrade-tools/start.php
@@ -0,0 +1 @@
+<?php