Skip to content

Commit 9b955f4

Browse files
committed
Merge branch 'testmode' of github.com:gskinner/regexr into testmode
2 parents 3305feb + e34b17b commit 9b955f4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

server/actions/patterns/save.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ class save extends \core\AbstractAction {
2323
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.';
2424

2525
public function execute() {
26-
$result = null;
27-
2826
$userProfile = $this->getUserProfile();
2927

3028
return $this->savePattern($userProfile);
@@ -37,7 +35,6 @@ function savePattern($userProfile) {
3735
$content = $this->getValue('text');
3836
$description = $this->getValue('description');
3937
$id = $this->getValue('id');
40-
$token = $this->getValue('token');
4138
$tool = $this->getValue('tool');
4239
$flavor = $this->getValue('flavor');
4340
$savedAuthor = $this->getValue('author');
@@ -52,7 +49,7 @@ function savePattern($userProfile) {
5249
$author = empty($savedAuthor)?$userProfile->username:$savedAuthor;
5350

5451
// Check to see if the user wants to edit this pattern.
55-
if (!empty($id)) { // Update
52+
if (!empty($id)) {
5653
// Make sure the user has access to edit this pattern.
5754
$protectedState = \core\PatternVisibility::PROTECTED;
5855
$privateState = \core\PatternVisibility::PRIVATE;
@@ -108,9 +105,9 @@ function savePattern($userProfile) {
108105

109106
$this->db->execute($sql, $sqlParams);
110107
}
111-
} else if (is_null($parentId)) { // Not a fork
108+
} else if (is_null($parentId)) {
112109
$patternId = savePattern($this->db, $name, $content, $pattern, $author, $description, $keywords, $tool, $flavor, $userProfile->userId, $access, $mode, $tests);
113-
} else { // Fork
110+
} else {
114111
$existingPattern = $this->db->execute("SELECT visibility, owner FROM patterns WHERE id=? LIMIT 1", [
115112
["s", $patternId]
116113
], true);
@@ -121,7 +118,7 @@ function savePattern($userProfile) {
121118
}
122119
}
123120

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);
125122

126123
$sql = "INSERT INTO patternLink (patternId, parentId, userId) VALUES (?, ?, ?)";
127124
$this->db->execute($sql, [
@@ -181,7 +178,6 @@ public function getSchema() {
181178
"expression" => array("type"=>self::STRING, "required"=>false, "length"=>2048),
182179
"text" => array("type"=>self::STRING, "required"=>false),
183180
"description" => array("type"=>self::STRING, "required"=>false, "length"=>250),
184-
"token" => array("type"=>self::STRING, "required"=>false),
185181
"tool" => array("type"=>self::STRING, "required"=>false, "length"=>1024),
186182
"tests" => array("type"=>self::STRING, "required"=>false),
187183
"flavor" => array("type"=>self::ENUM, "values"=>$this->getTypeValues(), "required"=>false),

0 commit comments

Comments
 (0)