aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-15 14:55:00 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-15 14:55:00 -0300
commit912fa61a7f5bbeb68c575089333df9b208627aa4 (patch)
tree958679c0c0be9e73d3db71d8c3be0941ba309a05
downloadelgg-912fa61a7f5bbeb68c575089333df9b208627aa4.tar.gz
elgg-912fa61a7f5bbeb68c575089333df9b208627aa4.tar.bz2
Squashed 'mod/upgrade-tools/' content from commit 862658a
git-subtree-dir: mod/upgrade-tools git-subtree-split: 862658a7512afda1910f600169cc7cd970bd593f
-rw-r--r--fixicons.php83
-rw-r--r--lib/upgrade_tools.php25
-rw-r--r--manifest.xml17
-rw-r--r--start.php1
4 files changed, 126 insertions, 0 deletions
diff --git a/fixicons.php b/fixicons.php
new file mode 100644
index 000000000..f233cfa0d
--- /dev/null
+++ b/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/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 @@
+<?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/manifest.xml b/manifest.xml
new file mode 100644
index 000000000..5f875975b
--- /dev/null
+++ b/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/start.php b/start.php
new file mode 100644
index 000000000..b3d9bbc7f
--- /dev/null
+++ b/start.php
@@ -0,0 +1 @@
+<?php