@@ -23,8 +23,6 @@ class save extends \core\AbstractAction {
23
23
public $ description = 'If no id is passed a new pattern is saved. If id is passed, and the user has access, the existing pattern is updated. ' ;
24
24
25
25
public function execute () {
26
- $ result = null ;
27
-
28
26
$ userProfile = $ this ->getUserProfile ();
29
27
30
28
return $ this ->savePattern ($ userProfile );
@@ -37,7 +35,6 @@ function savePattern($userProfile) {
37
35
$ content = $ this ->getValue ('text ' );
38
36
$ description = $ this ->getValue ('description ' );
39
37
$ id = $ this ->getValue ('id ' );
40
- $ token = $ this ->getValue ('token ' );
41
38
$ tool = $ this ->getValue ('tool ' );
42
39
$ flavor = $ this ->getValue ('flavor ' );
43
40
$ savedAuthor = $ this ->getValue ('author ' );
@@ -52,7 +49,7 @@ function savePattern($userProfile) {
52
49
$ author = empty ($ savedAuthor )?$ userProfile ->username :$ savedAuthor ;
53
50
54
51
// Check to see if the user wants to edit this pattern.
55
- if (!empty ($ id )) { // Update
52
+ if (!empty ($ id )) {
56
53
// Make sure the user has access to edit this pattern.
57
54
$ protectedState = \core \PatternVisibility::PROTECTED ;
58
55
$ privateState = \core \PatternVisibility::PRIVATE ;
@@ -108,9 +105,9 @@ function savePattern($userProfile) {
108
105
109
106
$ this ->db ->execute ($ sql , $ sqlParams );
110
107
}
111
- } else if (is_null ($ parentId )) { // Not a fork
108
+ } else if (is_null ($ parentId )) {
112
109
$ patternId = savePattern ($ this ->db , $ name , $ content , $ pattern , $ author , $ description , $ keywords , $ tool , $ flavor , $ userProfile ->userId , $ access , $ mode , $ tests );
113
- } else { // Fork
110
+ } else {
114
111
$ existingPattern = $ this ->db ->execute ("SELECT visibility, owner FROM patterns WHERE id=? LIMIT 1 " , [
115
112
["s " , $ patternId ]
116
113
], true );
@@ -121,7 +118,7 @@ function savePattern($userProfile) {
121
118
}
122
119
}
123
120
124
- $ patternId = savePattern ($ this ->db , $ name , $ content , $ pattern , $ author , $ description , $ keywords , $ tool , $ flavor , $ userProfile ->userId , $ access );
121
+ $ patternId = savePattern ($ this ->db , $ name , $ content , $ pattern , $ author , $ description , $ keywords , $ tool , $ flavor , $ userProfile ->userId , $ access, $ mode , $ tests );
125
122
126
123
$ sql = "INSERT INTO patternLink (patternId, parentId, userId) VALUES (?, ?, ?) " ;
127
124
$ this ->db ->execute ($ sql , [
@@ -181,7 +178,6 @@ public function getSchema() {
181
178
"expression " => array ("type " =>self ::STRING , "required " =>false , "length " =>2048 ),
182
179
"text " => array ("type " =>self ::STRING , "required " =>false ),
183
180
"description " => array ("type " =>self ::STRING , "required " =>false , "length " =>250 ),
184
- "token " => array ("type " =>self ::STRING , "required " =>false ),
185
181
"tool " => array ("type " =>self ::STRING , "required " =>false , "length " =>1024 ),
186
182
"tests " => array ("type " =>self ::STRING , "required " =>false ),
187
183
"flavor " => array ("type " =>self ::ENUM , "values " =>$ this ->getTypeValues (), "required " =>false ),
0 commit comments