| @@ 58-71 (lines=14) @@ | ||
| 55 | * @param value string Variable value |
|
| 56 | * @return bool |
|
| 57 | **/ |
|
| 58 | public function setValue($name, $value) { |
|
| 59 | // Update local cache too |
|
| 60 | $this->cache[$name] = $value; |
|
| 61 | $stmt = $this->mysqli->prepare(" |
|
| 62 | INSERT INTO $this->table (name, value) |
|
| 63 | VALUES (?, ?) |
|
| 64 | ON DUPLICATE KEY UPDATE value = ?"); |
|
| 65 | if ($stmt && $stmt->bind_param('sss', $name, $value, $value) && $stmt->execute()) |
|
| 66 | return true; |
|
| 67 | return $this->sqlError(); |
|
| 68 | } |
|
| 69 | } |
|
| 70 | ||
| 71 | $setting = new Setting($debug, $mysqli); |
|
| 72 | $setting->setDebug($debug); |
|
| 73 | $setting->setMysql($mysqli); |
|
| 74 | $setting->setErrorCodes($aErrorCodes); |
|
| @@ 93-106 (lines=14) @@ | ||
| 90 | * @param value string Variable value |
|
| 91 | * @return bool |
|
| 92 | **/ |
|
| 93 | public function setStatus($name, $type, $value) { |
|
| 94 | $stmt = $this->mysqli->prepare(" |
|
| 95 | INSERT INTO $this->table (name, type, value) |
|
| 96 | VALUES (?, ?, ?) |
|
| 97 | ON DUPLICATE KEY UPDATE value = ? |
|
| 98 | "); |
|
| 99 | if ($stmt && $stmt->bind_param('ssss', $name, $type, $value, $value) && $stmt->execute()) |
|
| 100 | return true; |
|
| 101 | $this->debug->append("Failed to set $name to $value"); |
|
| 102 | return false; |
|
| 103 | } |
|
| 104 | ||
| 105 | /** |
|
| 106 | * Start a cronjob, mark various fields properly |
|
| 107 | * @param cron_name string Cronjob name |
|
| 108 | **/ |
|
| 109 | public function startCronjob($cron_name) { |
|