summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Evans <grknight@gentoo.org>2018-12-20 09:24:24 -0500
committerBrian Evans <grknight@gentoo.org>2018-12-20 09:24:24 -0500
commit7594f9fd51d499f5ad51eb54084b3a807a4ccc5c (patch)
tree8acf6ccf9e2f9c3757050a63e2cc6a1595b5694b
parentRevert "Add Interwiki to allow easy management" (diff)
downloadextensions-7594f9fd51d499f5ad51eb54084b3a807a4ccc5c.tar.gz
extensions-7594f9fd51d499f5ad51eb54084b3a807a4ccc5c.tar.bz2
extensions-7594f9fd51d499f5ad51eb54084b3a807a4ccc5c.zip
GentooPackages: Drop global/local descriptors
They confuse users as to what their purpose is Signed-off-by: Brian Evans <grknight@gentoo.org>
-rw-r--r--GentooPackages/GentooPackages.php44
1 files changed, 7 insertions, 37 deletions
diff --git a/GentooPackages/GentooPackages.php b/GentooPackages/GentooPackages.php
index 3dbedd38..3f38dd46 100644
--- a/GentooPackages/GentooPackages.php
+++ b/GentooPackages/GentooPackages.php
@@ -8,12 +8,12 @@ class GentooPackages {
if ($atom === NULL) {
return "Package name missing";
} else {
- return array(self::fetchOrError($atom, $type), 'markerType' => 'nowiki');
+ return [self::fetchOrError($atom, $type), 'markerType' => 'nowiki'];
}
}
static function fetchOrError($atom, $type) {
- $json_str = Http::get("https://packages.gentoo.org/packages/" . $atom . ".json");
+ $json_str = Http::get("https://packages.gentoo.org/packages/${atom}.json");
if ($json_str === false) {
return '<div class="alert alert-danger">Cannot load package information. Is the atom <em>' . htmlspecialchars($atom) . '</em> correct?</div>';
@@ -79,9 +79,6 @@ HTML;
<td>
${desc}
</td>
- <td class="gp-useflag-type">
- ${flag['type']}
- </td>
</tr>
HTML;
}
@@ -94,38 +91,11 @@ HTML;
}
static function sortFlags($json) {
- $merged_flags = self::mapByFlagName(array_merge($json['use']['global'], $json['use']['local']));
- $local_flags = self::getFlagNames($json['use']['local']);
- $all_flags = self::getFlagNames($merged_flags);
- sort($all_flags);
-
- $result = array();
- foreach($all_flags as $flag_name) {
- $result[$flag_name] = $merged_flags[$flag_name];
- $result[$flag_name]['type'] = in_array($flag_name, $local_flags) ? 'local' : 'global';
- }
-
- return $result;
- }
-
- static function mapByFlagName($flags) {
- $result = array();
-
- foreach($flags as $flag) {
- $result[$flag['name']] = $flag;
- }
-
- return $result;
- }
-
- static function getFlagNames($flag_map) {
- $result = array();
-
- foreach($flag_map as $flag) {
- $result[] = $flag['name'];
- }
-
- return $result;
+ $merged_flags = [];
+ foreach(array_merge($json['use']['global'], $json['use']['local']) as $flag)
+ $merged_flags[$flag['name']] = $flag;
+ ksort($merged_flags);
+ return $merged_flags;
}
static function initHooks($parser) {