aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-10-30 20:25:10 -0700
committerfriendica <info@friendica.com>2013-10-30 20:25:10 -0700
commit39318e299ee36f4c14314b38238390e9b6e007bc (patch)
tree4e0b18fafb36073ccc4da9d10a56510e764cbeb3
parentbba188eae3f1286910e8c57d304f72eab8e0ea14 (diff)
downloadvolse-hubzilla-39318e299ee36f4c14314b38238390e9b6e007bc.tar.gz
volse-hubzilla-39318e299ee36f4c14314b38238390e9b6e007bc.tar.bz2
volse-hubzilla-39318e299ee36f4c14314b38238390e9b6e007bc.zip
allow mailsent update locking to unlock after 24 hours. Also don't even try to do a DB update if the build number is 0. Something else will likely fail and likely in some horrible way, but we shouldn't try and update the DB - something is clearly wrong with it.
-rwxr-xr-xboot.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/boot.php b/boot.php
index e97d59f87..aa56aff3d 100755
--- a/boot.php
+++ b/boot.php
@@ -1174,7 +1174,7 @@ function is_ajax() {
function check_config(&$a) {
$build = get_config('system','db_version');
- if(! x($build))
+ if(! intval($build))
$build = set_config('system','db_version',DB_UPDATE_VERSION);
$saved = get_config('system','urlverify');
@@ -1207,6 +1207,10 @@ function check_config(&$a) {
if($build != DB_UPDATE_VERSION) {
$stored = intval($build);
+ if(! $stored) {
+ logger('Critical: check_config unable to determine database schema version');
+ return;
+ }
$current = intval(DB_UPDATE_VERSION);
if(($stored < $current) && file_exists('install/update.php')) {
@@ -1242,10 +1246,13 @@ function check_config(&$a) {
// Prevent sending hundreds of thousands of emails by creating
// a lockfile. view/tpl/smarty3 is the only place we can
// guarantee the server can write to.
- if (file_exists('view/tpl/smarty3/mailsent'))
+ $lockfile = 'view/tpl/smarty3/mailsent';
+
+ if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 86400)))
return;
+ @unlink($lockfile);
//send the administrator an e-mail
- file_put_contents('view/tpl/smarty3/mailsent', $x);
+ file_put_contents($lockfile, $x);
$email_tpl = get_intltext_template("update_fail_eml.tpl");
$email_msg = replace_macros($email_tpl, array(