-
-
Notifications
You must be signed in to change notification settings - Fork 61
Improve installation #1598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Improve installation #1598
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -254,6 +254,7 @@ public function insert($object, $force = true) | |
|
|
||
| if ($object->isNew()) { | ||
| $sql = 'INSERT INTO `' . $this->handler->table . '`'; | ||
| $queryFunc = 'exec'; | ||
| if (!empty($object->cleanVars)) { | ||
| $keys = array_keys($object->cleanVars); | ||
| $vals = array_values($object->cleanVars); | ||
|
|
@@ -275,6 +276,7 @@ public function insert($object, $force = true) | |
| $keys[] = " `{$k}` = {$v}"; | ||
| } | ||
| $sql = 'UPDATE `' . $this->handler->table . '` SET ' . implode(',', $keys) . ' WHERE `' . $this->handler->keyName . '` = ' . $this->handler->db->quote($object->getVar($this->handler->keyName)); | ||
| $queryFunc = 'exec'; | ||
| if (!$result = $this->handler->db->{$queryFunc}($sql)) { | ||
| return false; | ||
| } | ||
|
|
@@ -303,7 +305,8 @@ public function delete($object, $force = false) | |
| $whereclause = '`' . $this->handler->keyName . '` = ' . $this->handler->db->quote($object->getVar($this->handler->keyName)); | ||
| } | ||
| $sql = 'DELETE FROM `' . $this->handler->table . '` WHERE ' . $whereclause; | ||
| $queryFunc = empty($force) ? 'query' : 'exec'; | ||
| // $queryFunc = empty($force) ? 'query' : 'exec'; | ||
| $queryFunc = 'exec'; | ||
| $result = $this->handler->db->{$queryFunc}($sql); | ||
|
|
||
| return empty($result) ? false : true; | ||
|
|
@@ -329,7 +332,8 @@ public function deleteAll(?CriteriaElement $criteria = null, $force = true, $asO | |
|
|
||
| return $num; | ||
| } | ||
| $queryFunc = empty($force) ? 'query' : 'exec'; | ||
| // $queryFunc = empty($force) ? 'query' : 'exec'; | ||
| $queryFunc = 'exec'; | ||
|
Comment on lines
+335
to
+336
|
||
| $sql = 'DELETE FROM ' . $this->handler->table; | ||
| if (!empty($criteria)) { | ||
| if (is_subclass_of($criteria, 'CriteriaElement')) { | ||
|
|
@@ -368,7 +372,8 @@ public function updateAll($fieldname, $fieldvalue, ?CriteriaElement $criteria = | |
| if (isset($criteria) && \method_exists($criteria, 'renderWhere')) { | ||
| $sql .= ' ' . $criteria->renderWhere(); | ||
| } | ||
| $queryFunc = empty($force) ? 'query' : 'exec'; | ||
| // $queryFunc = empty($force) ? 'query' : 'exec'; | ||
| $queryFunc = 'exec'; | ||
|
Comment on lines
+375
to
+376
|
||
| $result = $this->handler->db->{$queryFunc}($sql); | ||
|
|
||
| return empty($result) ? false : true; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -42,8 +42,8 @@ | |||||
| $modversion['release_date'] = '2019/02/18'; | ||||||
| $modversion['module_website_url'] = 'https://xoops.org/'; | ||||||
| $modversion['module_website_name'] = 'XOOPS'; | ||||||
| $modversion['min_php'] = '5.6.0'; | ||||||
| $modversion['min_xoops'] = '2.5.11'; | ||||||
| $modversion['min_php'] = '7.4'; | ||||||
|
||||||
| $modversion['min_php'] = '7.4'; | |
| $modversion['min_php'] = '7.4.0'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These commented-out lines should be removed rather than kept as comments. The old logic that conditionally chose between 'query' and 'exec' based on the $force parameter has been replaced with always using 'exec', which is the correct approach for DELETE operations. Leaving commented code reduces maintainability.