| @@ 154-164 (lines=11) @@ | ||
| 151 | WHERE date = '$date' |
|
| 152 | AND tool = '$tool'"; |
|
| 153 | ||
| 154 | if (count($conn->query($existsSql)->fetchAll()) === 0) { |
|
| 155 | $createSql = "INSERT INTO usage_timeline |
|
| 156 | VALUES(NULL, '$date', '$tool', 1)"; |
|
| 157 | $conn->query($createSql); |
|
| 158 | } else { |
|
| 159 | $updateSql = "UPDATE usage_timeline |
|
| 160 | SET count = count + 1 |
|
| 161 | WHERE tool = '$tool' |
|
| 162 | AND date = '$date'"; |
|
| 163 | $conn->query($updateSql); |
|
| 164 | } |
|
| 165 | ||
| 166 | // Update per-project usage, if applicable |
|
| 167 | if (!$this->container->getParameter('app.single_wiki')) { |
|
| @@ 172-182 (lines=11) @@ | ||
| 169 | WHERE tool = '$tool' |
|
| 170 | AND project = '$project'"; |
|
| 171 | ||
| 172 | if (count($conn->query($existsSql)->fetchAll()) === 0) { |
|
| 173 | $createSql = "INSERT INTO usage_projects |
|
| 174 | VALUES(NULL, '$tool', '$project', 1)"; |
|
| 175 | $conn->query($createSql); |
|
| 176 | } else { |
|
| 177 | $updateSql = "UPDATE usage_projects |
|
| 178 | SET count = count + 1 |
|
| 179 | WHERE tool = '$tool' |
|
| 180 | AND project = '$project'"; |
|
| 181 | $conn->query($updateSql); |
|
| 182 | } |
|
| 183 | } |
|
| 184 | ||
| 185 | $response->setStatusCode(Response::HTTP_NO_CONTENT); |
|
| @@ 340-350 (lines=11) @@ | ||
| 337 | WHERE date = '$date' |
|
| 338 | AND endpoint = '$endpoint'"; |
|
| 339 | ||
| 340 | if (count($conn->query($existsSql)->fetchAll()) === 0) { |
|
| 341 | $createSql = "INSERT INTO usage_api_timeline |
|
| 342 | VALUES(NULL, '$date', '$endpoint', 1)"; |
|
| 343 | $conn->query($createSql); |
|
| 344 | } else { |
|
| 345 | $updateSql = "UPDATE usage_api_timeline |
|
| 346 | SET count = count + 1 |
|
| 347 | WHERE endpoint = '$endpoint' |
|
| 348 | AND date = '$date'"; |
|
| 349 | $conn->query($updateSql); |
|
| 350 | } |
|
| 351 | } |
|
| 352 | } |
|
| 353 | ||