5
5
*/
6
6
7
7
declare (strict_types=1 );
8
- namespace Magento \Framework \lock \Backend ;
8
+ namespace Magento \Framework \Lock \Backend ;
9
9
10
10
use Magento \Framework \App \ResourceConnection ;
11
11
use Magento \Framework \Exception \InputException ;
@@ -33,7 +33,7 @@ public function setLock(string $name, int $timeout = -1): bool
33
33
{
34
34
$ this ->checkLength ($ name );
35
35
36
- return (bool )$ this ->resource ->getConnection ()->query ("SELECT GET_LOCK(?, ?); " , array (( string )$ name , (int )$ timeout) )
36
+ return (bool )$ this ->resource ->getConnection ()->query ("SELECT GET_LOCK(?, ?); " , [( string )$ name , (int )$ timeout] )
37
37
->fetchColumn ();
38
38
}
39
39
@@ -47,7 +47,7 @@ public function releaseLock(string $name): bool
47
47
{
48
48
$ this ->checkLength ($ name );
49
49
50
- return (bool )$ this ->resource ->getConnection ()->query ("SELECT RELEASE_LOCK(?); " , array (( string )$ name) )->fetchColumn ();
50
+ return (bool )$ this ->resource ->getConnection ()->query ("SELECT RELEASE_LOCK(?); " , [( string )$ name] )->fetchColumn ();
51
51
}
52
52
53
53
/**
@@ -60,9 +60,17 @@ public function isLocked(string $name): bool
60
60
{
61
61
$ this ->checkLength ($ name );
62
62
63
- return (bool )$ this ->resource ->getConnection ()->query ("SELECT IS_USED_LOCK(?); " , array (( string )$ name) )->fetchColumn ();
63
+ return (bool )$ this ->resource ->getConnection ()->query ("SELECT IS_USED_LOCK(?); " , [( string )$ name] )->fetchColumn ();
64
64
}
65
65
66
+ /**
67
+ * Checks for max length of lock name
68
+ *
69
+ * Limited to 64 characters in MySQL.
70
+ *
71
+ * @param string $name
72
+ * @throws InputException
73
+ */
66
74
private function checkLength (string $ name )
67
75
{
68
76
if (strlen ($ name ) > 64 ) {
0 commit comments