diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2020-09-21 21:21:30 +0200 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2020-09-21 21:30:57 +0200 |
commit | 7f4159ac258c501f9666efc465a78cb2aec9d177 (patch) | |
tree | 298b4943fb5cd7ecf5f6959bf1b6f47fbc6e557a /ratatoeskr/sys/models.php | |
parent | 9834bfc4dc7f0bbf4020cebb43b03069592bc687 (diff) | |
download | ratatoeskr-cms-7f4159ac258c501f9666efc465a78cb2aec9d177.tar.gz ratatoeskr-cms-7f4159ac258c501f9666efc465a78cb2aec9d177.tar.bz2 ratatoeskr-cms-7f4159ac258c501f9666efc465a78cb2aec9d177.zip |
Code cleanup
- Remove unused variables
- Remove unused utility functions
- Asserting presence and typehinting global variables
- Remove unused variables
- Add missing global
- Add parameter type constraint
- Fix some references to nonexisting variables
Diffstat (limited to 'ratatoeskr/sys/models.php')
-rw-r--r-- | ratatoeskr/sys/models.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/ratatoeskr/sys/models.php b/ratatoeskr/sys/models.php index 626b237..9f81fcf 100644 --- a/ratatoeskr/sys/models.php +++ b/ratatoeskr/sys/models.php @@ -278,10 +278,9 @@ class User extends BySQLRowEnabled */ public static function create($username, $pwhash) { - global $ratatoeskr_settings; global $db_con; try { - $obj = self::by_name($username); + self::by_name($username); } catch (DoesNotExistError $e) { global $ratatoeskr_settings; qdb( @@ -301,7 +300,7 @@ class User extends BySQLRowEnabled return $obj; } - throw new AlreadyExistsError("\"$name\" is already in database."); + throw new AlreadyExistsError("\"$username\" is already in database."); } protected function populate_by_sqlrow($sqlrow) @@ -504,7 +503,7 @@ class Group extends BySQLRowEnabled { global $db_con; try { - $obj = self::by_name($name); + self::by_name($name); } catch (DoesNotExistError $e) { qdb("INSERT INTO `PREFIX_groups` (`name`) VALUES (?)", $name); $obj = new self(); @@ -1787,7 +1786,7 @@ class Section extends BySQLRowEnabled } try { - $obj = self::by_name($name); + self::by_name($name); } catch (DoesNotExistError $e) { $obj = new self(); $obj->name = $name; @@ -2056,7 +2055,7 @@ class Tag extends BySQLRowEnabled } try { - $obj = self::by_name($name); + self::by_name($name); } catch (DoesNotExistError $e) { $obj = new self(); @@ -2634,7 +2633,7 @@ class Repository extends BySQLRowEnabled $this->name = $repometa["name"]; $this->description = $repometa["description"]; - $this->packages = @unserialize(@file_get_contents($this->baseurl . "/packagelist", false, $ctx)); + $this->packages = @unserialize(@file_get_contents($this->baseurl . "/packagelist", false, $this->stream_ctx)); $this->lastrefresh = time(); @@ -3259,6 +3258,8 @@ class ArticleExtradata extends KVStorage */ function dbversion() { + global $config; + /* Is the meta table present? If no, the version is 0. */ $stmt = qdb( "SELECT COUNT(*) FROM `information_schema`.`tables` WHERE `table_schema` = ? AND `table_name` = ?", |