From 62fb12b369bbcb4584ff9972074314ac72dd63b8 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 11 Nov 2011 12:35:00 -0500 Subject: [PATCH 1/5] use HTTPS for JSON if necessary --- lib/action.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/action.php b/lib/action.php index 7d4e03915c..4611210422 100644 --- a/lib/action.php +++ b/lib/action.php @@ -302,7 +302,7 @@ class Action extends HTMLOutputter // lawsuit $this->script('jquery.form.min.js'); $this->script('jquery-ui.min.js'); $this->script('jquery.cookie.min.js'); - $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/json2.min.js').'"); }'); + $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/json2.min.js', StatusNet::isHTTP()).'"); }'); $this->script('jquery.joverlay.min.js'); $this->script('jquery.infieldlabel.min.js'); } else { @@ -310,7 +310,7 @@ class Action extends HTMLOutputter // lawsuit $this->script('jquery.form.js'); $this->script('jquery-ui.min.js'); $this->script('jquery.cookie.js'); - $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/json2.js').'"); }'); + $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/json2.js', StatusNet::isHTTP()).'"); }'); $this->script('jquery.joverlay.js'); $this->script('jquery.infieldlabel.js'); } From cab76836cb97c3bc36f6efa74c045f0c2d12c49e Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 11 Nov 2011 12:44:42 -0500 Subject: [PATCH 2/5] isHTTP() -> isHTTPS() --- lib/action.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/action.php b/lib/action.php index 4611210422..0563fe2163 100644 --- a/lib/action.php +++ b/lib/action.php @@ -302,7 +302,7 @@ class Action extends HTMLOutputter // lawsuit $this->script('jquery.form.min.js'); $this->script('jquery-ui.min.js'); $this->script('jquery.cookie.min.js'); - $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/json2.min.js', StatusNet::isHTTP()).'"); }'); + $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/json2.min.js', StatusNet::isHTTPS()).'"); }'); $this->script('jquery.joverlay.min.js'); $this->script('jquery.infieldlabel.min.js'); } else { @@ -310,7 +310,7 @@ class Action extends HTMLOutputter // lawsuit $this->script('jquery.form.js'); $this->script('jquery-ui.min.js'); $this->script('jquery.cookie.js'); - $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/json2.js', StatusNet::isHTTP()).'"); }'); + $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/json2.js', StatusNet::isHTTPS()).'"); }'); $this->script('jquery.joverlay.js'); $this->script('jquery.infieldlabel.js'); } From 8cdbef098bf0a5057619ced522f8b2e63d78fbc1 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 26 Nov 2011 09:54:41 -0500 Subject: [PATCH 4/5] die when we get a bad connection error --- lib/framework.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/framework.php b/lib/framework.php index 4458313eb9..5d163547f7 100644 --- a/lib/framework.php +++ b/lib/framework.php @@ -160,6 +160,15 @@ function PEAR_ErrorToPEAR_Exception($err) common_log(LOG_ERR, "PEAR Error: $msg ($userInfo)"); + // HACK: queue handlers get kicked by the long-query killer, and + // keep the same broken connection. We die here to get a new + // process started. + + if (php_sapi_name() == 'cli' && preg_match('/nativecode=2006/', $msg)) { + common_log(LOG_ERR, "Lost DB connection; dying."); + exit(100); + } + if ($err->getCode()) { throw new PEAR_Exception($msg, $err, $err->getCode()); } else { From 7af29bf0d28d363ff199e1aea199531d9881bc60 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 26 Nov 2011 10:20:32 -0500 Subject: [PATCH 5/5] nativecode shows up in userinfo --- lib/framework.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/framework.php b/lib/framework.php index 5d163547f7..e7a1829bc6 100644 --- a/lib/framework.php +++ b/lib/framework.php @@ -164,7 +164,7 @@ function PEAR_ErrorToPEAR_Exception($err) // keep the same broken connection. We die here to get a new // process started. - if (php_sapi_name() == 'cli' && preg_match('/nativecode=2006/', $msg)) { + if (php_sapi_name() == 'cli' && preg_match('/nativecode=2006/', $userInfo)) { common_log(LOG_ERR, "Lost DB connection; dying."); exit(100); }