From 701acf59e2b2264f7afec9fdfab4d554193fd0b3 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 31 May 2016 13:22:47 -0700 Subject: don't remove missing hooks while update_r1169 is happpening - temp fix --- include/plugin.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/plugin.php b/include/plugin.php index 5dbfc218a..96ae0e543 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -301,11 +301,14 @@ function call_hooks($name, &$data = null) { else $func($a, $data); } else { - q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'", - dbesc($name), - dbesc($hook[0]), - dbesc($origfn) - ); + // The hook should be removed so we don't process it. + // But not until everybody gets through a timing issue + // related to git pull and update_r1169 + // q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'", + // dbesc($name), + // dbesc($hook[0]), + // dbesc($origfn) + // ); } } } -- cgit v1.2.3 From 00b4843425371e4ff55c82be577a279e248c29fc Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 31 May 2016 16:16:54 -0700 Subject: provide a sort of mutex lock around db logging so it can't possibly recurse. Previous attempts to do something similar using other methods haven't worked out satisfactorily. --- include/dba/dba_driver.php | 7 ++++++- include/plugin.php | 21 ++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php index 0ab5830ed..df072ed76 100755 --- a/include/dba/dba_driver.php +++ b/include/dba/dba_driver.php @@ -12,7 +12,7 @@ class DBA { static public $dba = null; static public $dbtype = null; - + static public $logging = false; /** * @brief Returns the database driver object. @@ -421,8 +421,13 @@ function db_getfunc($f) { function db_logger($s,$level = LOGGER_NORMAL,$syslog = LOG_INFO) { + if(\DBA::$logging) + return; + $saved = \DBA::$dba->debug; \DBA::$dba->debug = false; + \DBA::$logging = true; logger($s,$level,$syslog); + \DBA::$logging = false; \DBA::$dba->debug = $saved; } \ No newline at end of file diff --git a/include/plugin.php b/include/plugin.php index 96ae0e543..be4e92f03 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -300,15 +300,18 @@ function call_hooks($name, &$data = null) { $func($data); else $func($a, $data); - } else { - // The hook should be removed so we don't process it. - // But not until everybody gets through a timing issue - // related to git pull and update_r1169 - // q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'", - // dbesc($name), - // dbesc($hook[0]), - // dbesc($origfn) - // ); + } + else { + + // Don't do any DB write calls if we're currently logging a possibly failed DB call. + if(! DBA::$logging) { + // The hook should be removed so we don't process it. + q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s'", + dbesc($name), + dbesc($hook[0]), + dbesc($origfn) + ); + } } } } -- cgit v1.2.3 From dfb6255f59980835d364402b372dd39f2b41ee7c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 31 May 2016 17:50:47 -0700 Subject: more removal of reserved words from DB schemas --- include/account.php | 6 +++--- include/api.php | 2 +- include/oauth.php | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/account.php b/include/account.php index a442f3073..caf12878e 100644 --- a/include/account.php +++ b/include/account.php @@ -229,7 +229,7 @@ function verify_email_address($arr) { $hash = random_string(); - $r = q("INSERT INTO register ( hash, created, uid, password, language ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", + $r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", dbesc($hash), dbesc(datetime_convert()), intval($arr['account']['account_id']), @@ -283,7 +283,7 @@ function send_reg_approval_email($arr) { $hash = random_string(); - $r = q("INSERT INTO register ( hash, created, uid, password, language ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", + $r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ", dbesc($hash), dbesc(datetime_convert()), intval($arr['account']['account_id']), @@ -387,7 +387,7 @@ function account_allow($hash) { intval($register[0]['uid']) ); - push_lang($register[0]['language']); + push_lang($register[0]['lang']); $email_tpl = get_intltext_template("register_open_eml.tpl"); $email_tpl = replace_macros($email_tpl, array( diff --git a/include/api.php b/include/api.php index af5a22a74..0833ae7b9 100644 --- a/include/api.php +++ b/include/api.php @@ -368,7 +368,7 @@ require_once('include/api_auth.php'); else $redirect = trim($_REQUEST['redirect_uris']); $icon = trim($_REQUEST['logo_uri']); - $r = q("INSERT INTO clients (client_id, pw, name, redirect_uri, icon, uid) + $r = q("INSERT INTO clients (client_id, pw, clname, redirect_uri, icon, uid) VALUES ('%s','%s','%s','%s','%s',%d)", dbesc($key), dbesc($secret), diff --git a/include/oauth.php b/include/oauth.php index ec41a5dd2..984e0e6c6 100644 --- a/include/oauth.php +++ b/include/oauth.php @@ -37,7 +37,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore { logger(__function__.":".$consumer.", ". $token_type.", ".$token, LOGGER_DEBUG); - $r = q("SELECT id, secret, scope, expires, uid FROM tokens WHERE client_id = '%s' AND scope = '%s' AND id = '%s'", + $r = q("SELECT id, secret, auth_scope, expires, uid FROM tokens WHERE client_id = '%s' AND auth_scope = '%s' AND id = '%s'", dbesc($consumer->key), dbesc($token_type), dbesc($token) @@ -45,7 +45,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore { if (count($r)){ $ot=new OAuth1Token($r[0]['id'],$r[0]['secret']); - $ot->scope=$r[0]['scope']; + $ot->scope=$r[0]['auth_scope']; $ot->expires = $r[0]['expires']; $ot->uid = $r[0]['uid']; return $ot; @@ -79,7 +79,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore { $k = $consumer; } - $r = q("INSERT INTO tokens (id, secret, client_id, scope, expires) VALUES ('%s','%s','%s','%s', %d)", + $r = q("INSERT INTO tokens (id, secret, client_id, auth_scope, expires) VALUES ('%s','%s','%s','%s', %d)", dbesc($key), dbesc($sec), dbesc($k), @@ -110,7 +110,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore { $key = $this->gen_token(); $sec = $this->gen_token(); - $r = q("INSERT INTO tokens (id, secret, client_id, scope, expires, uid) VALUES ('%s','%s','%s','%s', %d, %d)", + $r = q("INSERT INTO tokens (id, secret, client_id, auth_scope, expires, uid) VALUES ('%s','%s','%s','%s', %d, %d)", dbesc($key), dbesc($sec), dbesc($consumer->key), @@ -249,7 +249,7 @@ class FKOAuth2 extends OAuth2 { protected function getAuthCode($code) { - $r = q("SELECT id, client_id, redirect_uri, expires, scope FROM auth_codes WHERE id = '%s'", + $r = q("SELECT id, client_id, redirect_uri, expires, auth_scope FROM auth_codes WHERE id = '%s'", dbesc($code)); if (count($r)) @@ -259,7 +259,7 @@ class FKOAuth2 extends OAuth2 { protected function setAuthCode($code, $client_id, $redirect_uri, $expires, $scope = NULL) { $r = q("INSERT INTO auth_codes - (id, client_id, redirect_uri, expires, scope) VALUES + (id, client_id, redirect_uri, expires, auth_scope) VALUES ('%s', '%s', '%s', %d, '%s')", dbesc($code), dbesc($client_id), -- cgit v1.2.3 From b1259876bf398880e7b0c1b44d90f94983243e72 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 31 May 2016 21:45:33 -0700 Subject: more db column renames --- include/acl_selectors.php | 4 ++-- include/channel.php | 20 ++++++++--------- include/contact_widgets.php | 4 ++-- include/event.php | 4 ++-- include/feedutils.php | 2 +- include/group.php | 20 ++++++++--------- include/import.php | 12 +++++++--- include/items.php | 54 +++++++++++++++++++++++---------------------- include/taxonomy.php | 18 +++++++-------- include/text.php | 2 +- include/widgets.php | 10 ++++----- include/zot.php | 25 ++++++++++++++------- 12 files changed, 96 insertions(+), 79 deletions(-) (limited to 'include') diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 54ea0304b..89d054e3b 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -15,7 +15,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) { $o .= "