From a2e101997836ebd904e94aa896a1bcc2e2c70f01 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 23 Mar 2017 21:49:20 -0700 Subject: move db_upgrade to zlib --- Zotlabs/Lib/DB_Upgrade.php | 105 +++++++++++++++++++++++++++++++++++++++++++++ Zotlabs/Lib/ThreadItem.php | 1 - Zotlabs/Web/WebServer.php | 17 +++++--- 3 files changed, 115 insertions(+), 8 deletions(-) create mode 100644 Zotlabs/Lib/DB_Upgrade.php (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/DB_Upgrade.php b/Zotlabs/Lib/DB_Upgrade.php new file mode 100644 index 000000000..13adaced5 --- /dev/null +++ b/Zotlabs/Lib/DB_Upgrade.php @@ -0,0 +1,105 @@ + (time() - 86400))) + return; + @unlink($lockfile); + //send the administrator an e-mail + file_put_contents($lockfile, $x); + + $r = q("select account_language from account where account_email = '%s' limit 1", + dbesc(App::$config['system']['admin_email']) + ); + push_lang(($r) ? $r[0]['account_language'] : 'en'); + + z_mail( + [ + 'toEmail' => \App::$config['system']['admin_email'], + 'messageSubject' => sprintf( t('Update Error at %s'), z_root()), + 'textVersion' => replace_macros(get_intltext_template('update_fail_eml.tpl'), + [ + '$sitename' => \App::$config['system']['sitename'], + '$siteurl' => z_root(), + '$update' => $x, + '$error' => sprintf( t('Update %s failed. See error logs.'), $x) + ] + ) + ] + ); + + //try the logger + logger('CRITICAL: Update Failed: ' . $x); + pop_lang(); + } + else { + set_config('database','update_r' . $x, 'success'); + } + } + } + set_config('system','db_version', $db_revision); + } + } + } + } +} \ No newline at end of file diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 799a606d6..b692224b0 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -337,7 +337,6 @@ class ThreadItem { 'profile_url' => $profile_link, 'thread_action_menu' => thread_action_menu($item,$conv->get_mode()), 'thread_author_menu' => thread_author_menu($item,$conv->get_mode()), - 'item_photo_menu' => item_photo_menu($item), 'dreport' => $dreport, 'name' => $profile_name, 'thumb' => $profile_avatar, diff --git a/Zotlabs/Web/WebServer.php b/Zotlabs/Web/WebServer.php index 5bb0e08e8..9c9f0483a 100644 --- a/Zotlabs/Web/WebServer.php +++ b/Zotlabs/Web/WebServer.php @@ -79,11 +79,6 @@ class WebServer { if(! x($_SESSION, 'sysmsg_info')) $_SESSION['sysmsg_info'] = array(); - /* - * check_config() is responsible for running update scripts. These automatically - * update the DB schema whenever we push a new one out. It also checks to see if - * any plugins have been added or removed and reacts accordingly. - */ if(\App::$install) { @@ -91,8 +86,16 @@ class WebServer { if(\App::$module != 'view') \App::$module = 'setup'; } - else - check_config($a); + else { + + /* + * check_config() is responsible for running update scripts. These automatically + * update the DB schema whenever we push a new one out. It also checks to see if + * any plugins have been added or removed and reacts accordingly. + */ + + check_config(); + } nav_set_selected('nothing'); -- cgit v1.2.3