mirror of
https://codeberg.org/vlw/vlw.se.git
synced 2026-02-26 11:21:57 +01:00
fix: add array for defining Forgejo languages to merge (#61)
Closes #53 Reviewed-on: https://codeberg.org/vlw/vlw.se/pulls/61
This commit is contained in:
parent
432f5218db
commit
6da89cccf8
1 changed files with 9 additions and 2 deletions
|
|
@ -13,7 +13,9 @@
|
||||||
require_once VV::root("src/Database/Tables/Languages/Languages.php");
|
require_once VV::root("src/Database/Tables/Languages/Languages.php");
|
||||||
|
|
||||||
class Forgejo {
|
class Forgejo {
|
||||||
private const FORGEJO_HREF = "https://git.vlw.se/explore/repos?q=&sort=recentupdate&language=";
|
private const MERGE_LANGUAGES = [
|
||||||
|
"Hack" => "PHP"
|
||||||
|
];
|
||||||
private const FORGEJO_ENDPOINT_USER = "/api/v1/users/%s";
|
private const FORGEJO_ENDPOINT_USER = "/api/v1/users/%s";
|
||||||
private const FORGEJO_ENDPOINT_SEARCH = "/api/v1/repos/search?uid=%s";
|
private const FORGEJO_ENDPOINT_SEARCH = "/api/v1/repos/search?uid=%s";
|
||||||
|
|
||||||
|
|
@ -71,6 +73,11 @@
|
||||||
$this->languages[$language] = 0;
|
$this->languages[$language] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Merge language with another if exists in merge array
|
||||||
|
if (array_key_exists($language, self::MERGE_LANGUAGES)) {
|
||||||
|
$language = self::MERGE_LANGUAGES[$language];
|
||||||
|
}
|
||||||
|
|
||||||
// Add bytes to language in total
|
// Add bytes to language in total
|
||||||
$this->languages[$language] += $bytes;
|
$this->languages[$language] += $bytes;
|
||||||
}
|
}
|
||||||
|
|
@ -92,4 +99,4 @@
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue