diff options
author | Zach Prezkuta <fermion@gmx.com> | 2012-06-17 11:25:36 -0600 |
---|---|---|
committer | Zach Prezkuta <fermion@gmx.com> | 2012-07-05 14:27:29 -0600 |
commit | 75ed37fb3d17d97d73a53a62c10caa3a4d11c632 (patch) | |
tree | e4133f6389d4b9c70604a1e11e50b99977c7a65d /include/lock.php | |
parent | 46068935d0c45a63cf34979859063a23314d18b7 (diff) | |
download | volse-hubzilla-75ed37fb3d17d97d73a53a62c10caa3a4d11c632.tar.gz volse-hubzilla-75ed37fb3d17d97d73a53a62c10caa3a4d11c632.tar.bz2 volse-hubzilla-75ed37fb3d17d97d73a53a62c10caa3a4d11c632.zip |
"lock" is a reserved MySQL keyword
Diffstat (limited to 'include/lock.php')
-rw-r--r-- | include/lock.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/lock.php b/include/lock.php index cc2888c0a..e7e176eee 100644 --- a/include/lock.php +++ b/include/lock.php @@ -10,19 +10,19 @@ function lock_function($fn_name, $block = true, $wait_sec = 2) { $got_lock = false; do { - q("LOCK TABLE lock WRITE"); - $r = q("SELECT locked FROM lock WHERE name = '%s' LIMIT 1", + q("LOCK TABLE locks WRITE"); + $r = q("SELECT locked FROM locks WHERE name = '%s' LIMIT 1", dbesc($fn_name) ); if((count($r)) && (! $r[0]['locked'])) { - q("UPDATE lock SET locked = 1 WHERE name = '%s' LIMIT 1", + q("UPDATE locks SET locked = 1 WHERE name = '%s' LIMIT 1", dbesc($fn_name) ); $got_lock = true; } elseif(! $r) { // the Boolean value for count($r) should be equivalent to the Boolean value of $r - q("INSERT INTO lock ( name, locked ) VALUES ( '%s', 1 )", + q("INSERT INTO locks ( name, locked ) VALUES ( '%s', 1 )", dbesc($fn_name) ); $got_lock = true; @@ -47,7 +47,7 @@ function block_on_function_lock($fn_name, $wait_sec = 2) { $wait_sec = 2; // don't let the user pick a value that's likely to crash the system do { - $r = q("SELECT locked FROM lock WHERE name = '%s' LIMIT 1", + $r = q("SELECT locked FROM locks WHERE name = '%s' LIMIT 1", dbesc(fn_name) ); @@ -63,7 +63,7 @@ function block_on_function_lock($fn_name, $wait_sec = 2) { if(! function_exists('unlock_function')) { function unlock_function(fn_name) { //$r = q("LOCK TABLE lock WRITE"); - $r = q("UPDATE lock SET locked = 0 WHERE name = '%s' LIMIT 1", + $r = q("UPDATE locks SET locked = 0 WHERE name = '%s' LIMIT 1", dbesc(fn_name) ); //$r = q("UNLOCK TABLES"); |