aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db/migration/helper.php
diff options
context:
space:
mode:
authorOliver Schramm <oliver.schramm97@gmail.com>2016-08-11 01:20:59 +0200
committerOliver Schramm <oliver.schramm97@gmail.com>2016-08-11 01:20:59 +0200
commit4938887e5d446637aac9a36f87ea26898dc31b80 (patch)
tree9a0ae35f9ac8a7f147b3806236c0a7c501b8f483 /phpBB/phpbb/db/migration/helper.php
parent55f98d0941e17b473015baf07026efabaf676916 (diff)
parent2ee8bd0c4a0379961c7ec00376c216822672057f (diff)
downloadforums-4938887e5d446637aac9a36f87ea26898dc31b80.tar
forums-4938887e5d446637aac9a36f87ea26898dc31b80.tar.gz
forums-4938887e5d446637aac9a36f87ea26898dc31b80.tar.bz2
forums-4938887e5d446637aac9a36f87ea26898dc31b80.tar.xz
forums-4938887e5d446637aac9a36f87ea26898dc31b80.zip
Merge branch 'ticket/14742' into ticket/14742-32x
Diffstat (limited to 'phpBB/phpbb/db/migration/helper.php')
-rw-r--r--phpBB/phpbb/db/migration/helper.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/phpBB/phpbb/db/migration/helper.php b/phpBB/phpbb/db/migration/helper.php
index e40deeb37b..bce2efff51 100644
--- a/phpBB/phpbb/db/migration/helper.php
+++ b/phpBB/phpbb/db/migration/helper.php
@@ -81,4 +81,36 @@ class helper
return $steps;
}
+
+ /**
+ * Reverse the update steps from an array of data changes
+ *
+ * 'If' statements and custom methods will be skipped, for all
+ * other calls the reverse method of the tool class will be called
+ *
+ * @param array $steps Update changes from migration
+ *
+ * @return array
+ */
+ public function reverse_update_data($steps)
+ {
+ $reversed_array = array();
+
+ foreach ($steps as $step)
+ {
+ $parts = explode('.', $step[0]);
+ $parameters = $step[1];
+
+ $class = $parts[0];
+ $method = isset($parts[1]) ? $parts[1] : false;
+
+ if ($class !== 'if' && $class !== 'custom')
+ {
+ array_unshift($parameters, $method);
+ $reversed_array[] = array($class . '.reverse', $parameters);
+ }
+ }
+
+ return array_reverse($reversed_array);
+ }
}