@@ -19,267 +19,267 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class Ban extends DataObject |
| 21 | 21 | { |
| 22 | - private $type; |
|
| 23 | - private $target; |
|
| 24 | - private $user; |
|
| 25 | - private $reason; |
|
| 26 | - private $date; |
|
| 27 | - private $duration; |
|
| 28 | - private $active; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * Gets all active bans, filtered by the optional target. |
|
| 32 | - * |
|
| 33 | - * @param string|null $target |
|
| 34 | - * @param PdoDatabase $database |
|
| 35 | - * |
|
| 36 | - * @return Ban[] |
|
| 37 | - */ |
|
| 38 | - public static function getActiveBans($target, PdoDatabase $database) |
|
| 39 | - { |
|
| 40 | - if ($target !== null) { |
|
| 41 | - $query = <<<SQL |
|
| 22 | + private $type; |
|
| 23 | + private $target; |
|
| 24 | + private $user; |
|
| 25 | + private $reason; |
|
| 26 | + private $date; |
|
| 27 | + private $duration; |
|
| 28 | + private $active; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * Gets all active bans, filtered by the optional target. |
|
| 32 | + * |
|
| 33 | + * @param string|null $target |
|
| 34 | + * @param PdoDatabase $database |
|
| 35 | + * |
|
| 36 | + * @return Ban[] |
|
| 37 | + */ |
|
| 38 | + public static function getActiveBans($target, PdoDatabase $database) |
|
| 39 | + { |
|
| 40 | + if ($target !== null) { |
|
| 41 | + $query = <<<SQL |
|
| 42 | 42 | SELECT * FROM ban WHERE target = :target AND (duration > UNIX_TIMESTAMP() OR duration = -1) AND active = 1; |
| 43 | 43 | SQL; |
| 44 | - $statement = $database->prepare($query); |
|
| 45 | - $statement->bindValue(":target", $target); |
|
| 46 | - } |
|
| 47 | - else { |
|
| 48 | - $query = "SELECT * FROM ban WHERE (duration > UNIX_TIMESTAMP() OR duration = -1) AND active = 1;"; |
|
| 49 | - $statement = $database->prepare($query); |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - $statement->execute(); |
|
| 53 | - |
|
| 54 | - $result = array(); |
|
| 55 | - |
|
| 56 | - /** @var Ban $v */ |
|
| 57 | - foreach ($statement->fetchAll(PDO::FETCH_CLASS, get_called_class()) as $v) { |
|
| 58 | - $v->setDatabase($database); |
|
| 59 | - $result[] = $v; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - return $result; |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Gets a ban by it's ID if it's currently active. |
|
| 67 | - * |
|
| 68 | - * @param integer $id |
|
| 69 | - * @param PdoDatabase $database |
|
| 70 | - * |
|
| 71 | - * @return Ban |
|
| 72 | - */ |
|
| 73 | - public static function getActiveId($id, PdoDatabase $database) |
|
| 74 | - { |
|
| 75 | - $statement = $database->prepare(<<<SQL |
|
| 44 | + $statement = $database->prepare($query); |
|
| 45 | + $statement->bindValue(":target", $target); |
|
| 46 | + } |
|
| 47 | + else { |
|
| 48 | + $query = "SELECT * FROM ban WHERE (duration > UNIX_TIMESTAMP() OR duration = -1) AND active = 1;"; |
|
| 49 | + $statement = $database->prepare($query); |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + $statement->execute(); |
|
| 53 | + |
|
| 54 | + $result = array(); |
|
| 55 | + |
|
| 56 | + /** @var Ban $v */ |
|
| 57 | + foreach ($statement->fetchAll(PDO::FETCH_CLASS, get_called_class()) as $v) { |
|
| 58 | + $v->setDatabase($database); |
|
| 59 | + $result[] = $v; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + return $result; |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Gets a ban by it's ID if it's currently active. |
|
| 67 | + * |
|
| 68 | + * @param integer $id |
|
| 69 | + * @param PdoDatabase $database |
|
| 70 | + * |
|
| 71 | + * @return Ban |
|
| 72 | + */ |
|
| 73 | + public static function getActiveId($id, PdoDatabase $database) |
|
| 74 | + { |
|
| 75 | + $statement = $database->prepare(<<<SQL |
|
| 76 | 76 | SELECT * |
| 77 | 77 | FROM ban |
| 78 | 78 | WHERE id = :id AND (duration > UNIX_TIMESTAMP() OR duration = -1) AND active = 1; |
| 79 | 79 | SQL |
| 80 | - ); |
|
| 81 | - $statement->bindValue(":id", $id); |
|
| 82 | - |
|
| 83 | - $statement->execute(); |
|
| 84 | - |
|
| 85 | - $resultObject = $statement->fetchObject(get_called_class()); |
|
| 86 | - |
|
| 87 | - if ($resultObject != false) { |
|
| 88 | - $resultObject->setDatabase($database); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - return $resultObject; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * Get all active bans for a target and type. |
|
| 96 | - * |
|
| 97 | - * @param string $target |
|
| 98 | - * @param string $type |
|
| 99 | - * @param PdoDatabase $database |
|
| 100 | - * |
|
| 101 | - * @return Ban |
|
| 102 | - */ |
|
| 103 | - public static function getBanByTarget($target, $type, PdoDatabase $database) |
|
| 104 | - { |
|
| 105 | - $query = <<<SQL |
|
| 80 | + ); |
|
| 81 | + $statement->bindValue(":id", $id); |
|
| 82 | + |
|
| 83 | + $statement->execute(); |
|
| 84 | + |
|
| 85 | + $resultObject = $statement->fetchObject(get_called_class()); |
|
| 86 | + |
|
| 87 | + if ($resultObject != false) { |
|
| 88 | + $resultObject->setDatabase($database); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + return $resultObject; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * Get all active bans for a target and type. |
|
| 96 | + * |
|
| 97 | + * @param string $target |
|
| 98 | + * @param string $type |
|
| 99 | + * @param PdoDatabase $database |
|
| 100 | + * |
|
| 101 | + * @return Ban |
|
| 102 | + */ |
|
| 103 | + public static function getBanByTarget($target, $type, PdoDatabase $database) |
|
| 104 | + { |
|
| 105 | + $query = <<<SQL |
|
| 106 | 106 | SELECT * FROM ban |
| 107 | 107 | WHERE type = :type |
| 108 | 108 | AND target = :target |
| 109 | 109 | AND (duration > UNIX_TIMESTAMP() OR duration = -1) |
| 110 | 110 | AND active = 1; |
| 111 | 111 | SQL; |
| 112 | - $statement = $database->prepare($query); |
|
| 113 | - $statement->bindValue(":target", $target); |
|
| 114 | - $statement->bindValue(":type", $type); |
|
| 112 | + $statement = $database->prepare($query); |
|
| 113 | + $statement->bindValue(":target", $target); |
|
| 114 | + $statement->bindValue(":type", $type); |
|
| 115 | 115 | |
| 116 | - $statement->execute(); |
|
| 116 | + $statement->execute(); |
|
| 117 | 117 | |
| 118 | - $resultObject = $statement->fetchObject(get_called_class()); |
|
| 118 | + $resultObject = $statement->fetchObject(get_called_class()); |
|
| 119 | 119 | |
| 120 | - if ($resultObject != false) { |
|
| 121 | - $resultObject->setDatabase($database); |
|
| 122 | - } |
|
| 120 | + if ($resultObject != false) { |
|
| 121 | + $resultObject->setDatabase($database); |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - return $resultObject; |
|
| 125 | - } |
|
| 124 | + return $resultObject; |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * @throws Exception |
|
| 129 | - */ |
|
| 130 | - public function save() |
|
| 131 | - { |
|
| 132 | - if ($this->isNew()) { |
|
| 133 | - // insert |
|
| 134 | - $statement = $this->dbObject->prepare(<<<SQL |
|
| 127 | + /** |
|
| 128 | + * @throws Exception |
|
| 129 | + */ |
|
| 130 | + public function save() |
|
| 131 | + { |
|
| 132 | + if ($this->isNew()) { |
|
| 133 | + // insert |
|
| 134 | + $statement = $this->dbObject->prepare(<<<SQL |
|
| 135 | 135 | INSERT INTO `ban` (type, target, user, reason, date, duration, active) |
| 136 | 136 | VALUES (:type, :target, :user, :reason, CURRENT_TIMESTAMP(), :duration, :active); |
| 137 | 137 | SQL |
| 138 | - ); |
|
| 139 | - $statement->bindValue(":type", $this->type); |
|
| 140 | - $statement->bindValue(":target", $this->target); |
|
| 141 | - $statement->bindValue(":user", $this->user); |
|
| 142 | - $statement->bindValue(":reason", $this->reason); |
|
| 143 | - $statement->bindValue(":duration", $this->duration); |
|
| 144 | - $statement->bindValue(":active", $this->active); |
|
| 145 | - |
|
| 146 | - if ($statement->execute()) { |
|
| 147 | - $this->id = (int)$this->dbObject->lastInsertId(); |
|
| 148 | - } |
|
| 149 | - else { |
|
| 150 | - throw new Exception($statement->errorInfo()); |
|
| 151 | - } |
|
| 152 | - } |
|
| 153 | - else { |
|
| 154 | - // update |
|
| 155 | - $statement = $this->dbObject->prepare(<<<SQL |
|
| 138 | + ); |
|
| 139 | + $statement->bindValue(":type", $this->type); |
|
| 140 | + $statement->bindValue(":target", $this->target); |
|
| 141 | + $statement->bindValue(":user", $this->user); |
|
| 142 | + $statement->bindValue(":reason", $this->reason); |
|
| 143 | + $statement->bindValue(":duration", $this->duration); |
|
| 144 | + $statement->bindValue(":active", $this->active); |
|
| 145 | + |
|
| 146 | + if ($statement->execute()) { |
|
| 147 | + $this->id = (int)$this->dbObject->lastInsertId(); |
|
| 148 | + } |
|
| 149 | + else { |
|
| 150 | + throw new Exception($statement->errorInfo()); |
|
| 151 | + } |
|
| 152 | + } |
|
| 153 | + else { |
|
| 154 | + // update |
|
| 155 | + $statement = $this->dbObject->prepare(<<<SQL |
|
| 156 | 156 | UPDATE `ban` |
| 157 | 157 | SET duration = :duration, active = :active, user = :user, updateversion = updateversion + 1 |
| 158 | 158 | WHERE id = :id AND updateversion = :updateversion; |
| 159 | 159 | SQL |
| 160 | - ); |
|
| 161 | - $statement->bindValue(':id', $this->id); |
|
| 162 | - $statement->bindValue(':updateversion', $this->updateversion); |
|
| 163 | - |
|
| 164 | - $statement->bindValue(':duration', $this->duration); |
|
| 165 | - $statement->bindValue(':active', $this->active); |
|
| 166 | - $statement->bindValue(':user', $this->user); |
|
| 167 | - |
|
| 168 | - if (!$statement->execute()) { |
|
| 169 | - throw new Exception($statement->errorInfo()); |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - if ($statement->rowCount() !== 1) { |
|
| 173 | - throw new OptimisticLockFailedException(); |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - $this->updateversion++; |
|
| 177 | - } |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - /** |
|
| 181 | - * @return string |
|
| 182 | - */ |
|
| 183 | - public function getType() |
|
| 184 | - { |
|
| 185 | - return $this->type; |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * @param string $type |
|
| 190 | - */ |
|
| 191 | - public function setType($type) |
|
| 192 | - { |
|
| 193 | - $this->type = $type; |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * @return string |
|
| 198 | - */ |
|
| 199 | - public function getTarget() |
|
| 200 | - { |
|
| 201 | - return $this->target; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * @param string $target |
|
| 206 | - */ |
|
| 207 | - public function setTarget($target) |
|
| 208 | - { |
|
| 209 | - $this->target = $target; |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * @return string |
|
| 214 | - */ |
|
| 215 | - public function getReason() |
|
| 216 | - { |
|
| 217 | - return $this->reason; |
|
| 218 | - } |
|
| 219 | - |
|
| 220 | - /** |
|
| 221 | - * @param string $reason |
|
| 222 | - */ |
|
| 223 | - public function setReason($reason) |
|
| 224 | - { |
|
| 225 | - $this->reason = $reason; |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - /** |
|
| 229 | - * @return mixed |
|
| 230 | - */ |
|
| 231 | - public function getDate() |
|
| 232 | - { |
|
| 233 | - return $this->date; |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * @return mixed |
|
| 238 | - */ |
|
| 239 | - public function getDuration() |
|
| 240 | - { |
|
| 241 | - return $this->duration; |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - /** |
|
| 245 | - * @param mixed $duration |
|
| 246 | - */ |
|
| 247 | - public function setDuration($duration) |
|
| 248 | - { |
|
| 249 | - $this->duration = $duration; |
|
| 250 | - } |
|
| 251 | - |
|
| 252 | - /** |
|
| 253 | - * @return bool |
|
| 254 | - */ |
|
| 255 | - public function isActive() |
|
| 256 | - { |
|
| 257 | - return $this->active == 1; |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - /** |
|
| 261 | - * @param bool $active |
|
| 262 | - */ |
|
| 263 | - public function setActive($active) |
|
| 264 | - { |
|
| 265 | - $this->active = $active ? 1 : 0; |
|
| 266 | - } |
|
| 267 | - |
|
| 268 | - /** |
|
| 269 | - * @return int |
|
| 270 | - */ |
|
| 271 | - public function getUser() |
|
| 272 | - { |
|
| 273 | - return $this->user; |
|
| 274 | - } |
|
| 275 | - |
|
| 276 | - /** |
|
| 277 | - * @param int $user UserID of user who is setting the ban |
|
| 278 | - * |
|
| 279 | - * @throws Exception |
|
| 280 | - */ |
|
| 281 | - public function setUser($user) |
|
| 282 | - { |
|
| 283 | - $this->user = $user; |
|
| 284 | - } |
|
| 160 | + ); |
|
| 161 | + $statement->bindValue(':id', $this->id); |
|
| 162 | + $statement->bindValue(':updateversion', $this->updateversion); |
|
| 163 | + |
|
| 164 | + $statement->bindValue(':duration', $this->duration); |
|
| 165 | + $statement->bindValue(':active', $this->active); |
|
| 166 | + $statement->bindValue(':user', $this->user); |
|
| 167 | + |
|
| 168 | + if (!$statement->execute()) { |
|
| 169 | + throw new Exception($statement->errorInfo()); |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + if ($statement->rowCount() !== 1) { |
|
| 173 | + throw new OptimisticLockFailedException(); |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + $this->updateversion++; |
|
| 177 | + } |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + /** |
|
| 181 | + * @return string |
|
| 182 | + */ |
|
| 183 | + public function getType() |
|
| 184 | + { |
|
| 185 | + return $this->type; |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * @param string $type |
|
| 190 | + */ |
|
| 191 | + public function setType($type) |
|
| 192 | + { |
|
| 193 | + $this->type = $type; |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * @return string |
|
| 198 | + */ |
|
| 199 | + public function getTarget() |
|
| 200 | + { |
|
| 201 | + return $this->target; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * @param string $target |
|
| 206 | + */ |
|
| 207 | + public function setTarget($target) |
|
| 208 | + { |
|
| 209 | + $this->target = $target; |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * @return string |
|
| 214 | + */ |
|
| 215 | + public function getReason() |
|
| 216 | + { |
|
| 217 | + return $this->reason; |
|
| 218 | + } |
|
| 219 | + |
|
| 220 | + /** |
|
| 221 | + * @param string $reason |
|
| 222 | + */ |
|
| 223 | + public function setReason($reason) |
|
| 224 | + { |
|
| 225 | + $this->reason = $reason; |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + /** |
|
| 229 | + * @return mixed |
|
| 230 | + */ |
|
| 231 | + public function getDate() |
|
| 232 | + { |
|
| 233 | + return $this->date; |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * @return mixed |
|
| 238 | + */ |
|
| 239 | + public function getDuration() |
|
| 240 | + { |
|
| 241 | + return $this->duration; |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + /** |
|
| 245 | + * @param mixed $duration |
|
| 246 | + */ |
|
| 247 | + public function setDuration($duration) |
|
| 248 | + { |
|
| 249 | + $this->duration = $duration; |
|
| 250 | + } |
|
| 251 | + |
|
| 252 | + /** |
|
| 253 | + * @return bool |
|
| 254 | + */ |
|
| 255 | + public function isActive() |
|
| 256 | + { |
|
| 257 | + return $this->active == 1; |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + /** |
|
| 261 | + * @param bool $active |
|
| 262 | + */ |
|
| 263 | + public function setActive($active) |
|
| 264 | + { |
|
| 265 | + $this->active = $active ? 1 : 0; |
|
| 266 | + } |
|
| 267 | + |
|
| 268 | + /** |
|
| 269 | + * @return int |
|
| 270 | + */ |
|
| 271 | + public function getUser() |
|
| 272 | + { |
|
| 273 | + return $this->user; |
|
| 274 | + } |
|
| 275 | + |
|
| 276 | + /** |
|
| 277 | + * @param int $user UserID of user who is setting the ban |
|
| 278 | + * |
|
| 279 | + * @throws Exception |
|
| 280 | + */ |
|
| 281 | + public function setUser($user) |
|
| 282 | + { |
|
| 283 | + $this->user = $user; |
|
| 284 | + } |
|
| 285 | 285 | } |
@@ -23,124 +23,124 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | abstract class DataObject |
| 25 | 25 | { |
| 26 | - /** @var int ID of the object */ |
|
| 27 | - protected $id = null; |
|
| 28 | - /** @var int update version for optimistic locking */ |
|
| 29 | - protected $updateversion = 0; |
|
| 30 | - /** |
|
| 31 | - * @var PdoDatabase |
|
| 32 | - */ |
|
| 33 | - protected $dbObject; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * Retrieves a data object by it's row ID. |
|
| 37 | - * |
|
| 38 | - * @param int $id |
|
| 39 | - * @param PdoDatabase $database |
|
| 40 | - * |
|
| 41 | - * @return DataObject|false |
|
| 42 | - */ |
|
| 43 | - public static function getById($id, PdoDatabase $database) |
|
| 44 | - { |
|
| 45 | - $array = explode('\\', get_called_class()); |
|
| 46 | - $realClassName = strtolower(end($array)); |
|
| 47 | - |
|
| 48 | - $statement = $database->prepare("SELECT * FROM {$realClassName} WHERE id = :id LIMIT 1;"); |
|
| 49 | - $statement->bindValue(":id", $id); |
|
| 50 | - |
|
| 51 | - $statement->execute(); |
|
| 52 | - |
|
| 53 | - $resultObject = $statement->fetchObject(get_called_class()); |
|
| 54 | - |
|
| 55 | - if ($resultObject != false) { |
|
| 56 | - $resultObject->setDatabase($database); |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - return $resultObject; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - public function setDatabase(PdoDatabase $db) |
|
| 63 | - { |
|
| 64 | - $this->dbObject = $db; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * Gets the database associated with this data object. |
|
| 69 | - * @return PdoDatabase |
|
| 70 | - */ |
|
| 71 | - public function getDatabase() |
|
| 72 | - { |
|
| 73 | - return $this->dbObject; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Saves a data object to the database, either updating or inserting a record. |
|
| 78 | - * |
|
| 79 | - * @return void |
|
| 80 | - */ |
|
| 81 | - abstract public function save(); |
|
| 82 | - |
|
| 83 | - /** |
|
| 84 | - * Retrieves the ID attribute |
|
| 85 | - */ |
|
| 86 | - public function getId() |
|
| 87 | - { |
|
| 88 | - return (int)$this->id; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Deletes the object from the database |
|
| 93 | - */ |
|
| 94 | - public function delete() |
|
| 95 | - { |
|
| 96 | - if ($this->id === null) { |
|
| 97 | - // wtf? |
|
| 98 | - return; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - $array = explode('\\', get_called_class()); |
|
| 102 | - $realClassName = strtolower(end($array)); |
|
| 103 | - |
|
| 104 | - $deleteQuery = "DELETE FROM {$realClassName} WHERE id = :id AND updateversion = :updateversion;"; |
|
| 105 | - $statement = $this->dbObject->prepare($deleteQuery); |
|
| 106 | - |
|
| 107 | - $statement->bindValue(":id", $this->id); |
|
| 108 | - $statement->bindValue(":updateversion", $this->updateversion); |
|
| 109 | - $statement->execute(); |
|
| 110 | - |
|
| 111 | - if ($statement->rowCount() !== 1) { |
|
| 112 | - throw new OptimisticLockFailedException(); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - $this->id = null; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * @return int |
|
| 120 | - */ |
|
| 121 | - public function getUpdateVersion() |
|
| 122 | - { |
|
| 123 | - return $this->updateversion; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Sets the update version. |
|
| 128 | - * |
|
| 129 | - * You should never call this to change the value of the update version. You should only call it when passing user |
|
| 130 | - * input through. |
|
| 131 | - * |
|
| 132 | - * @param int $updateVersion |
|
| 133 | - */ |
|
| 134 | - public function setUpdateVersion($updateVersion) |
|
| 135 | - { |
|
| 136 | - $this->updateversion = $updateVersion; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * @return bool |
|
| 141 | - */ |
|
| 142 | - public function isNew() |
|
| 143 | - { |
|
| 144 | - return $this->id === null; |
|
| 145 | - } |
|
| 26 | + /** @var int ID of the object */ |
|
| 27 | + protected $id = null; |
|
| 28 | + /** @var int update version for optimistic locking */ |
|
| 29 | + protected $updateversion = 0; |
|
| 30 | + /** |
|
| 31 | + * @var PdoDatabase |
|
| 32 | + */ |
|
| 33 | + protected $dbObject; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * Retrieves a data object by it's row ID. |
|
| 37 | + * |
|
| 38 | + * @param int $id |
|
| 39 | + * @param PdoDatabase $database |
|
| 40 | + * |
|
| 41 | + * @return DataObject|false |
|
| 42 | + */ |
|
| 43 | + public static function getById($id, PdoDatabase $database) |
|
| 44 | + { |
|
| 45 | + $array = explode('\\', get_called_class()); |
|
| 46 | + $realClassName = strtolower(end($array)); |
|
| 47 | + |
|
| 48 | + $statement = $database->prepare("SELECT * FROM {$realClassName} WHERE id = :id LIMIT 1;"); |
|
| 49 | + $statement->bindValue(":id", $id); |
|
| 50 | + |
|
| 51 | + $statement->execute(); |
|
| 52 | + |
|
| 53 | + $resultObject = $statement->fetchObject(get_called_class()); |
|
| 54 | + |
|
| 55 | + if ($resultObject != false) { |
|
| 56 | + $resultObject->setDatabase($database); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + return $resultObject; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + public function setDatabase(PdoDatabase $db) |
|
| 63 | + { |
|
| 64 | + $this->dbObject = $db; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * Gets the database associated with this data object. |
|
| 69 | + * @return PdoDatabase |
|
| 70 | + */ |
|
| 71 | + public function getDatabase() |
|
| 72 | + { |
|
| 73 | + return $this->dbObject; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Saves a data object to the database, either updating or inserting a record. |
|
| 78 | + * |
|
| 79 | + * @return void |
|
| 80 | + */ |
|
| 81 | + abstract public function save(); |
|
| 82 | + |
|
| 83 | + /** |
|
| 84 | + * Retrieves the ID attribute |
|
| 85 | + */ |
|
| 86 | + public function getId() |
|
| 87 | + { |
|
| 88 | + return (int)$this->id; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Deletes the object from the database |
|
| 93 | + */ |
|
| 94 | + public function delete() |
|
| 95 | + { |
|
| 96 | + if ($this->id === null) { |
|
| 97 | + // wtf? |
|
| 98 | + return; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + $array = explode('\\', get_called_class()); |
|
| 102 | + $realClassName = strtolower(end($array)); |
|
| 103 | + |
|
| 104 | + $deleteQuery = "DELETE FROM {$realClassName} WHERE id = :id AND updateversion = :updateversion;"; |
|
| 105 | + $statement = $this->dbObject->prepare($deleteQuery); |
|
| 106 | + |
|
| 107 | + $statement->bindValue(":id", $this->id); |
|
| 108 | + $statement->bindValue(":updateversion", $this->updateversion); |
|
| 109 | + $statement->execute(); |
|
| 110 | + |
|
| 111 | + if ($statement->rowCount() !== 1) { |
|
| 112 | + throw new OptimisticLockFailedException(); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + $this->id = null; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * @return int |
|
| 120 | + */ |
|
| 121 | + public function getUpdateVersion() |
|
| 122 | + { |
|
| 123 | + return $this->updateversion; |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Sets the update version. |
|
| 128 | + * |
|
| 129 | + * You should never call this to change the value of the update version. You should only call it when passing user |
|
| 130 | + * input through. |
|
| 131 | + * |
|
| 132 | + * @param int $updateVersion |
|
| 133 | + */ |
|
| 134 | + public function setUpdateVersion($updateVersion) |
|
| 135 | + { |
|
| 136 | + $this->updateversion = $updateVersion; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * @return bool |
|
| 141 | + */ |
|
| 142 | + public function isNew() |
|
| 143 | + { |
|
| 144 | + return $this->id === null; |
|
| 145 | + } |
|
| 146 | 146 | } |
@@ -18,34 +18,34 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class HelpAction extends ApiPageBase implements IApiAction |
| 20 | 20 | { |
| 21 | - public function executeApiAction(DOMElement $apiDocument) |
|
| 22 | - { |
|
| 23 | - $helpElement = $this->getHelpElement(); |
|
| 24 | - $apiDocument->appendChild($helpElement); |
|
| 25 | - |
|
| 26 | - return $apiDocument; |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * Gets the help information |
|
| 31 | - * @return DOMElement |
|
| 32 | - */ |
|
| 33 | - protected function getHelpElement() |
|
| 34 | - { |
|
| 21 | + public function executeApiAction(DOMElement $apiDocument) |
|
| 22 | + { |
|
| 23 | + $helpElement = $this->getHelpElement(); |
|
| 24 | + $apiDocument->appendChild($helpElement); |
|
| 25 | + |
|
| 26 | + return $apiDocument; |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * Gets the help information |
|
| 31 | + * @return DOMElement |
|
| 32 | + */ |
|
| 33 | + protected function getHelpElement() |
|
| 34 | + { |
|
| 35 | 35 | $helpInfo = "API help can be found at https://github.com/enwikipedia-acc/waca/wiki/API"; |
| 36 | 36 | |
| 37 | - $help = $this->document->createElement("help"); |
|
| 38 | - $helptext = $this->document->createElement("info", $helpInfo); |
|
| 39 | - $helpactions = $this->document->createElement("actions"); |
|
| 37 | + $help = $this->document->createElement("help"); |
|
| 38 | + $helptext = $this->document->createElement("info", $helpInfo); |
|
| 39 | + $helpactions = $this->document->createElement("actions"); |
|
| 40 | 40 | |
| 41 | - foreach (ApiRequestRouter::getActionList() as $action) { |
|
| 42 | - $actionElement = $this->document->createElement("action", $action); |
|
| 43 | - $helpactions->appendChild($actionElement); |
|
| 44 | - } |
|
| 41 | + foreach (ApiRequestRouter::getActionList() as $action) { |
|
| 42 | + $actionElement = $this->document->createElement("action", $action); |
|
| 43 | + $helpactions->appendChild($actionElement); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - $help->appendChild($helptext); |
|
| 47 | - $help->appendChild($helpactions); |
|
| 46 | + $help->appendChild($helptext); |
|
| 47 | + $help->appendChild($helpactions); |
|
| 48 | 48 | |
| 49 | - return $help; |
|
| 50 | - } |
|
| 49 | + return $help; |
|
| 50 | + } |
|
| 51 | 51 | } |
@@ -202,24 +202,24 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | // request states |
| 204 | 204 | $availableRequestStates = array( |
| 205 | - 'Open' => array( |
|
| 206 | - 'defertolog' => 'users', // don't change or you'll break old logs |
|
| 207 | - 'deferto' => 'users', |
|
| 208 | - 'header' => 'Open requests', |
|
| 209 | - 'api' => "open", |
|
| 210 | - ), |
|
| 211 | - 'Flagged users' => array( |
|
| 212 | - 'defertolog' => 'flagged users', // don't change or you'll break old logs |
|
| 213 | - 'deferto' => 'flagged users', |
|
| 214 | - 'header' => 'Flagged user needed', |
|
| 215 | - 'api' => "admin", |
|
| 216 | - ), |
|
| 217 | - 'Checkuser' => array( |
|
| 218 | - 'defertolog' => 'checkusers', // don't change or you'll break old logs |
|
| 219 | - 'deferto' => 'checkusers', |
|
| 220 | - 'header' => 'Checkuser needed', |
|
| 221 | - 'api' => "checkuser", |
|
| 222 | - ), |
|
| 205 | + 'Open' => array( |
|
| 206 | + 'defertolog' => 'users', // don't change or you'll break old logs |
|
| 207 | + 'deferto' => 'users', |
|
| 208 | + 'header' => 'Open requests', |
|
| 209 | + 'api' => "open", |
|
| 210 | + ), |
|
| 211 | + 'Flagged users' => array( |
|
| 212 | + 'defertolog' => 'flagged users', // don't change or you'll break old logs |
|
| 213 | + 'deferto' => 'flagged users', |
|
| 214 | + 'header' => 'Flagged user needed', |
|
| 215 | + 'api' => "admin", |
|
| 216 | + ), |
|
| 217 | + 'Checkuser' => array( |
|
| 218 | + 'defertolog' => 'checkusers', // don't change or you'll break old logs |
|
| 219 | + 'deferto' => 'checkusers', |
|
| 220 | + 'header' => 'Checkuser needed', |
|
| 221 | + 'api' => "checkuser", |
|
| 222 | + ), |
|
| 223 | 223 | ); |
| 224 | 224 | |
| 225 | 225 | $defaultRequestStateKey = 'Open'; |
@@ -266,24 +266,24 @@ discard block |
||
| 266 | 266 | require_once('config.local.inc.php'); |
| 267 | 267 | |
| 268 | 268 | $cDatabaseConfig = array( |
| 269 | - "acc" => array( |
|
| 270 | - "dsrcname" => "mysql:host=" . $toolserver_host . ";dbname=" . $toolserver_database, |
|
| 271 | - "username" => $toolserver_username, |
|
| 272 | - "password" => $toolserver_password, |
|
| 269 | + "acc" => array( |
|
| 270 | + "dsrcname" => "mysql:host=" . $toolserver_host . ";dbname=" . $toolserver_database, |
|
| 271 | + "username" => $toolserver_username, |
|
| 272 | + "password" => $toolserver_password, |
|
| 273 | 273 | "options" => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4'), |
| 274 | - ), |
|
| 275 | - "wikipedia" => array( |
|
| 276 | - "dsrcname" => "mysql:host=" . $antispoof_host . ";dbname=" . $antispoof_db, |
|
| 277 | - "username" => $toolserver_username, |
|
| 278 | - "password" => $toolserver_password, |
|
| 279 | - "options" => array(), |
|
| 280 | - ), |
|
| 281 | - "notifications" => array( |
|
| 282 | - "dsrcname" => "mysql:host=" . $toolserver_notification_dbhost . ";dbname=" . $toolserver_notification_database, |
|
| 283 | - "username" => $notifications_username, |
|
| 284 | - "password" => $notifications_password, |
|
| 285 | - "options" => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4'), |
|
| 286 | - ), |
|
| 274 | + ), |
|
| 275 | + "wikipedia" => array( |
|
| 276 | + "dsrcname" => "mysql:host=" . $antispoof_host . ";dbname=" . $antispoof_db, |
|
| 277 | + "username" => $toolserver_username, |
|
| 278 | + "password" => $toolserver_password, |
|
| 279 | + "options" => array(), |
|
| 280 | + ), |
|
| 281 | + "notifications" => array( |
|
| 282 | + "dsrcname" => "mysql:host=" . $toolserver_notification_dbhost . ";dbname=" . $toolserver_notification_database, |
|
| 283 | + "username" => $notifications_username, |
|
| 284 | + "password" => $notifications_password, |
|
| 285 | + "options" => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4'), |
|
| 286 | + ), |
|
| 287 | 287 | ); |
| 288 | 288 | |
| 289 | 289 | // //Keep the included files from being executed. |
@@ -295,18 +295,18 @@ discard block |
||
| 295 | 295 | ini_set('user_agent', $toolUserAgent); |
| 296 | 296 | |
| 297 | 297 | foreach (array( |
| 298 | - "mbstring", // unicode and stuff |
|
| 299 | - "pdo", |
|
| 300 | - "pdo_mysql", // new database module |
|
| 301 | - "session", |
|
| 302 | - "date", |
|
| 303 | - "pcre", // core stuff |
|
| 304 | - "curl", // mediawiki api access etc |
|
| 305 | - "openssl", // token generation |
|
| 298 | + "mbstring", // unicode and stuff |
|
| 299 | + "pdo", |
|
| 300 | + "pdo_mysql", // new database module |
|
| 301 | + "session", |
|
| 302 | + "date", |
|
| 303 | + "pcre", // core stuff |
|
| 304 | + "curl", // mediawiki api access etc |
|
| 305 | + "openssl", // token generation |
|
| 306 | 306 | ) as $x) { |
| 307 | - if (!extension_loaded($x)) { |
|
| 308 | - die("extension $x is required."); |
|
| 309 | - } |
|
| 307 | + if (!extension_loaded($x)) { |
|
| 308 | + die("extension $x is required."); |
|
| 309 | + } |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | // Set up the AutoLoader |
@@ -333,40 +333,40 @@ discard block |
||
| 333 | 333 | $siteConfiguration = new \Waca\SiteConfiguration(); |
| 334 | 334 | |
| 335 | 335 | $siteConfiguration->setBaseUrl($baseurl) |
| 336 | - ->setFilePath(__DIR__) |
|
| 337 | - ->setDebuggingTraceEnabled($enableErrorTrace) |
|
| 338 | - ->setForceIdentification($forceIdentification) |
|
| 339 | - ->setIdentificationCacheExpiry($identificationCacheExpiry) |
|
| 340 | - ->setMediawikiScriptPath($mediawikiScriptPath) |
|
| 341 | - ->setMediawikiWebServiceEndpoint($mediawikiWebServiceEndpoint) |
|
| 342 | - ->setMetaWikimediaWebServiceEndpoint($metaWikimediaWebServiceEndpoint) |
|
| 343 | - ->setEnforceOAuth($enforceOAuth) |
|
| 344 | - ->setEmailConfirmationEnabled($enableEmailConfirm == 1) |
|
| 345 | - ->setEmailConfirmationExpiryDays($emailConfirmationExpiryDays) |
|
| 346 | - ->setMiserModeLimit($requestLimitShowOnly) |
|
| 347 | - ->setRequestStates($availableRequestStates) |
|
| 348 | - ->setSquidList($squidIpList) |
|
| 349 | - ->setDefaultCreatedTemplateId($createdid) |
|
| 350 | - ->setDefaultRequestStateKey($defaultRequestStateKey) |
|
| 351 | - ->setUseStrictTransportSecurity($strictTransportSecurityExpiry) |
|
| 352 | - ->setUserAgent($toolUserAgent) |
|
| 353 | - ->setCurlDisableVerifyPeer($curlDisableSSLVerifyPeer) |
|
| 354 | - ->setUseOAuthSignup($useOauthSignup) |
|
| 355 | - ->setOAuthBaseUrl($oauthBaseUrl) |
|
| 356 | - ->setOAuthConsumerToken($oauthConsumerToken) |
|
| 357 | - ->setOAuthConsumerSecret($oauthSecretToken) |
|
| 358 | - ->setOauthMediaWikiCanonicalServer($oauthMediaWikiCanonicalServer) |
|
| 359 | - ->setDataClearInterval($dataclear_interval) |
|
| 360 | - ->setXffTrustedHostsFile($xff_trusted_hosts_file) |
|
| 361 | - ->setIrcNotificationsEnabled($ircBotNotificationsEnabled == 1) |
|
| 362 | - ->setIrcNotificationType($ircBotNotificationType) |
|
| 363 | - ->setIrcNotificationsInstance($whichami) |
|
| 364 | - ->setTitleBlacklistEnabled($enableTitleblacklist == 1) |
|
| 365 | - ->setTorExitPaths(array_merge(gethostbynamel('en.wikipedia.org'), gethostbynamel('accounts.wmflabs.org'))) |
|
| 366 | - ->setCreationBotUsername($creationBotUsername) |
|
| 367 | - ->setCreationBotPassword($creationBotPassword) |
|
| 368 | - ->setCurlCookieJar($curlCookieJar) |
|
| 369 | - ->setYubicoApiId($yubicoApiId) |
|
| 370 | - ->setYubicoApiKey($yubicoApiKey) |
|
| 371 | - ->setTotpEncryptionKey($totpEncryptionKey) |
|
| 372 | - ->setRegistrationAllowed($allowRegistration); |
|
| 336 | + ->setFilePath(__DIR__) |
|
| 337 | + ->setDebuggingTraceEnabled($enableErrorTrace) |
|
| 338 | + ->setForceIdentification($forceIdentification) |
|
| 339 | + ->setIdentificationCacheExpiry($identificationCacheExpiry) |
|
| 340 | + ->setMediawikiScriptPath($mediawikiScriptPath) |
|
| 341 | + ->setMediawikiWebServiceEndpoint($mediawikiWebServiceEndpoint) |
|
| 342 | + ->setMetaWikimediaWebServiceEndpoint($metaWikimediaWebServiceEndpoint) |
|
| 343 | + ->setEnforceOAuth($enforceOAuth) |
|
| 344 | + ->setEmailConfirmationEnabled($enableEmailConfirm == 1) |
|
| 345 | + ->setEmailConfirmationExpiryDays($emailConfirmationExpiryDays) |
|
| 346 | + ->setMiserModeLimit($requestLimitShowOnly) |
|
| 347 | + ->setRequestStates($availableRequestStates) |
|
| 348 | + ->setSquidList($squidIpList) |
|
| 349 | + ->setDefaultCreatedTemplateId($createdid) |
|
| 350 | + ->setDefaultRequestStateKey($defaultRequestStateKey) |
|
| 351 | + ->setUseStrictTransportSecurity($strictTransportSecurityExpiry) |
|
| 352 | + ->setUserAgent($toolUserAgent) |
|
| 353 | + ->setCurlDisableVerifyPeer($curlDisableSSLVerifyPeer) |
|
| 354 | + ->setUseOAuthSignup($useOauthSignup) |
|
| 355 | + ->setOAuthBaseUrl($oauthBaseUrl) |
|
| 356 | + ->setOAuthConsumerToken($oauthConsumerToken) |
|
| 357 | + ->setOAuthConsumerSecret($oauthSecretToken) |
|
| 358 | + ->setOauthMediaWikiCanonicalServer($oauthMediaWikiCanonicalServer) |
|
| 359 | + ->setDataClearInterval($dataclear_interval) |
|
| 360 | + ->setXffTrustedHostsFile($xff_trusted_hosts_file) |
|
| 361 | + ->setIrcNotificationsEnabled($ircBotNotificationsEnabled == 1) |
|
| 362 | + ->setIrcNotificationType($ircBotNotificationType) |
|
| 363 | + ->setIrcNotificationsInstance($whichami) |
|
| 364 | + ->setTitleBlacklistEnabled($enableTitleblacklist == 1) |
|
| 365 | + ->setTorExitPaths(array_merge(gethostbynamel('en.wikipedia.org'), gethostbynamel('accounts.wmflabs.org'))) |
|
| 366 | + ->setCreationBotUsername($creationBotUsername) |
|
| 367 | + ->setCreationBotPassword($creationBotPassword) |
|
| 368 | + ->setCurlCookieJar($curlCookieJar) |
|
| 369 | + ->setYubicoApiId($yubicoApiId) |
|
| 370 | + ->setYubicoApiKey($yubicoApiKey) |
|
| 371 | + ->setTotpEncryptionKey($totpEncryptionKey) |
|
| 372 | + ->setRegistrationAllowed($allowRegistration); |
|
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | $BUbasefile = "backup"; // The basefile's name. |
| 134 | 134 | $BUdir = "/home/project/a/c/c/acc/backups"; // The directory where backups should be stored. |
| 135 | -$BUmonthdir = $BUdir . "/monthly"; // The directory where monthly backups should be stored. |
|
| 135 | +$BUmonthdir = $BUdir."/monthly"; // The directory where monthly backups should be stored. |
|
| 136 | 136 | $BUdumper = "/opt/ts/mysql/5.1/bin/mysqldump --defaults-file=~/.my.cnf p_acc_live"; // Add parameters here if they are needed. |
| 137 | 137 | $BUgzip = "/usr/bin/gzip"; // Add the gzip parameters here if needed. |
| 138 | 138 | $BUtar = "/bin/tar -cvf"; // Add the tar parameters here if needed. |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | $curlDisableSSLVerifyPeer = false; |
| 249 | 249 | |
| 250 | 250 | // Change this to be outside the web directory. |
| 251 | -$curlCookieJar = __DIR__ . '/../cookies.txt'; |
|
| 251 | +$curlCookieJar = __DIR__.'/../cookies.txt'; |
|
| 252 | 252 | |
| 253 | 253 | $yubicoApiId = 0; |
| 254 | 254 | $yubicoApiKey = ""; |
@@ -267,19 +267,19 @@ discard block |
||
| 267 | 267 | |
| 268 | 268 | $cDatabaseConfig = array( |
| 269 | 269 | "acc" => array( |
| 270 | - "dsrcname" => "mysql:host=" . $toolserver_host . ";dbname=" . $toolserver_database, |
|
| 270 | + "dsrcname" => "mysql:host=".$toolserver_host.";dbname=".$toolserver_database, |
|
| 271 | 271 | "username" => $toolserver_username, |
| 272 | 272 | "password" => $toolserver_password, |
| 273 | 273 | "options" => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4'), |
| 274 | 274 | ), |
| 275 | 275 | "wikipedia" => array( |
| 276 | - "dsrcname" => "mysql:host=" . $antispoof_host . ";dbname=" . $antispoof_db, |
|
| 276 | + "dsrcname" => "mysql:host=".$antispoof_host.";dbname=".$antispoof_db, |
|
| 277 | 277 | "username" => $toolserver_username, |
| 278 | 278 | "password" => $toolserver_password, |
| 279 | 279 | "options" => array(), |
| 280 | 280 | ), |
| 281 | 281 | "notifications" => array( |
| 282 | - "dsrcname" => "mysql:host=" . $toolserver_notification_dbhost . ";dbname=" . $toolserver_notification_database, |
|
| 282 | + "dsrcname" => "mysql:host=".$toolserver_notification_dbhost.";dbname=".$toolserver_notification_database, |
|
| 283 | 283 | "username" => $notifications_username, |
| 284 | 284 | "password" => $notifications_password, |
| 285 | 285 | "options" => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4'), |
@@ -310,13 +310,13 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | // Set up the AutoLoader |
| 313 | -require_once(__DIR__ . "/includes/AutoLoader.php"); |
|
| 313 | +require_once(__DIR__."/includes/AutoLoader.php"); |
|
| 314 | 314 | spl_autoload_register('Waca\\AutoLoader::load'); |
| 315 | -require_once(__DIR__ . '/vendor/autoload.php'); |
|
| 315 | +require_once(__DIR__.'/vendor/autoload.php'); |
|
| 316 | 316 | |
| 317 | 317 | // Extra includes which are just plain awkward wherever they are. |
| 318 | -require_once(__DIR__ . '/lib/mediawiki-extensions-OAuth/lib/OAuth.php'); |
|
| 319 | -require_once(__DIR__ . '/lib/mediawiki-extensions-OAuth/lib/JWT.php'); |
|
| 318 | +require_once(__DIR__.'/lib/mediawiki-extensions-OAuth/lib/OAuth.php'); |
|
| 319 | +require_once(__DIR__.'/lib/mediawiki-extensions-OAuth/lib/JWT.php'); |
|
| 320 | 320 | |
| 321 | 321 | // Crap that's needed for libraries. >:( |
| 322 | 322 | /** |