aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-06-29 22:37:18 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-06-29 22:37:18 -0700
commit22cb09f537118f87c8e61cce51c0a35b9713e457 (patch)
tree49b4545118a1b3e3a856de65f442659a61e7d8b3 /mod
parent0b347ccc14a384bfcbda343aacc1dfa1b7ddd740 (diff)
downloadvolse-hubzilla-22cb09f537118f87c8e61cce51c0a35b9713e457.tar.gz
volse-hubzilla-22cb09f537118f87c8e61cce51c0a35b9713e457.tar.bz2
volse-hubzilla-22cb09f537118f87c8e61cce51c0a35b9713e457.zip
warn if export data file is from an incompatible project or if the DB version differs significantly from the current DB. This is to avoid people cloning a hubzilla channel back to red and potentially stuffing up the works. Hopefully we can migrate upwards someday. Downwards is always going to be an issue.
Diffstat (limited to 'mod')
-rw-r--r--mod/import.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/mod/import.php b/mod/import.php
index 12d44659d..9877ce9f3 100644
--- a/mod/import.php
+++ b/mod/import.php
@@ -103,6 +103,20 @@ function import_post(&$a) {
return;
}
+ if(array_key_exists('compatibility',$data) && array_key_exists('database',$data['compatibility'])) {
+ $v1 = substr($data['compatibility']['database'],-4);
+ $v2 = substr(DB_UPDATE_VERSION,-4);
+ if($data['compatibility']['project'] !== PLATFORM_NAME) {
+ notice( t('The data provided is not compatible with this project.') );
+ return;
+ }
+ }
+ if($v2 > $v1) {
+ $t = sprintf( t('Warning: Database versions differ by %1$d updates.'), $v2 - $v1 );
+ notice($t);
+ }
+
+
// import channel
$channel = $data['channel'];