aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Admin/Dbsync.php
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2019-05-04 22:37:21 +0200
committerMax Kostikov <max@kostikov.co>2019-05-04 22:37:21 +0200
commit2aa76d257ccd29144234408563c46d5af10a83c0 (patch)
tree33390ef8c49a2fe1695841d5123dfaccfd50f68a /Zotlabs/Module/Admin/Dbsync.php
parent32c0be8bde0f59f23231b0094163a1c4295d4fc8 (diff)
parent1da46025676d2aae84e4f90e8f6fef733ff156eb (diff)
downloadvolse-hubzilla-2aa76d257ccd29144234408563c46d5af10a83c0.tar.gz
volse-hubzilla-2aa76d257ccd29144234408563c46d5af10a83c0.tar.bz2
volse-hubzilla-2aa76d257ccd29144234408563c46d5af10a83c0.zip
Merge branch 'db_update' into 'dev'
port db update improvements from zap See merge request hubzilla/core!1628
Diffstat (limited to 'Zotlabs/Module/Admin/Dbsync.php')
-rw-r--r--Zotlabs/Module/Admin/Dbsync.php45
1 files changed, 43 insertions, 2 deletions
diff --git a/Zotlabs/Module/Admin/Dbsync.php b/Zotlabs/Module/Admin/Dbsync.php
index 469af2aa5..183834301 100644
--- a/Zotlabs/Module/Admin/Dbsync.php
+++ b/Zotlabs/Module/Admin/Dbsync.php
@@ -19,7 +19,47 @@ class Dbsync {
info( t('Update has been marked successful') . EOL);
goaway(z_root() . '/admin/dbsync');
}
+
+ if(argc() > 3 && intval(argv(3)) && argv(2) === 'verify') {
+
+ $s = '_' . intval(argv(3));
+ $cls = '\\Zotlabs\Update\\' . $s ;
+ if(class_exists($cls)) {
+ $c = new $cls();
+ if(method_exists($c,'verify')) {
+ $retval = $c->verify();
+ if($retval === UPDATE_FAILED) {
+ $o .= sprintf( t('Verification of update %s failed. Check system logs.'), $s);
+ }
+ elseif($retval === UPDATE_SUCCESS) {
+ $o .= sprintf( t('Update %s was successfully applied.'), $s);
+ set_config('database',$s, 'success');
+ }
+ else
+ $o .= sprintf( t('Verifying update %s did not return a status. Unknown if it succeeded.'), $s);
+ }
+ else {
+ $o .= sprintf( t('Update %s does not contain a verification function.'), $s );
+ }
+ }
+ else
+ $o .= sprintf( t('Update function %s could not be found.'), $s);
+ return $o;
+
+
+
+
+
+ // remove the old style config if it exists
+ del_config('database', 'update_r' . intval(argv(3)));
+ set_config('database', '_' . intval(argv(3)), 'success');
+ if(intval(get_config('system','db_version')) < intval(argv(3)))
+ set_config('system','db_version',intval(argv(3)));
+ info( t('Update has been marked successful') . EOL);
+ goaway(z_root() . '/admin/dbsync');
+ }
+
if(argc() > 2 && intval(argv(2))) {
$x = intval(argv(2));
$s = '_' . $x;
@@ -28,14 +68,14 @@ class Dbsync {
$c = new $cls();
$retval = $c->run();
if($retval === UPDATE_FAILED) {
- $o .= sprintf( t('Executing %s failed. Check system logs.'), $s);
+ $o .= sprintf( t('Executing update procedure %s failed. Check system logs.'), $s);
}
elseif($retval === UPDATE_SUCCESS) {
$o .= sprintf( t('Update %s was successfully applied.'), $s);
set_config('database',$s, 'success');
}
else
- $o .= sprintf( t('Update %s did not return a status. Unknown if it succeeded.'), $s);
+ $o .= sprintf( t('Update %s did not return a status. It cannot be determined if it was successful.'), $s);
}
else
$o .= sprintf( t('Update function %s could not be found.'), $s);
@@ -59,6 +99,7 @@ class Dbsync {
'$banner' => t('Failed Updates'),
'$desc' => '',
'$mark' => t('Mark success (if update was manually applied)'),
+ '$verify' => t('Attempt to verify this update if a verification procedure exists'),
'$apply' => t('Attempt to execute this update step automatically'),
'$failed' => $failed
));