From 673596d33753a192fece0fc8f9e1f9e052c7aad0 Mon Sep 17 00:00:00 2001
From: Jaime Perez Crespo <jaime.perez@uninett.no>
Date: Wed, 21 Jan 2015 15:59:43 +0100
Subject: [PATCH] Extract the modinfo module out to its own repository. This
 closes #155.

---
 docs/simplesamlphp-modules.txt                |   3 +-
 modules/modinfo/default-enable                |   3 -
 .../dictionaries/modinfo.definition.json      |  27 ----
 .../dictionaries/modinfo.translation.json     | 147 ------------------
 modules/modinfo/hooks/hook_frontpage.php      |  16 --
 modules/modinfo/hooks/hook_moduleinfo.php     |  20 ---
 modules/modinfo/templates/modlist.php         |  64 --------
 modules/modinfo/www/index.php                 |  29 ----
 8 files changed, 2 insertions(+), 307 deletions(-)
 delete mode 100644 modules/modinfo/default-enable
 delete mode 100644 modules/modinfo/dictionaries/modinfo.definition.json
 delete mode 100644 modules/modinfo/dictionaries/modinfo.translation.json
 delete mode 100644 modules/modinfo/hooks/hook_frontpage.php
 delete mode 100644 modules/modinfo/hooks/hook_moduleinfo.php
 delete mode 100644 modules/modinfo/templates/modlist.php
 delete mode 100644 modules/modinfo/www/index.php

diff --git a/docs/simplesamlphp-modules.txt b/docs/simplesamlphp-modules.txt
index ccc5f66ef..74151a5d2 100644
--- a/docs/simplesamlphp-modules.txt
+++ b/docs/simplesamlphp-modules.txt
@@ -172,7 +172,8 @@ The hook interface allows you to call a hook function in all enabled modules whi
 
 Each hook function accepts a single argument. This argument will be passed by reference, which allows each hook to update that argument.
 
-There is currently a single user of the hook interface - the front page. The front page defines a hook named `frontpage`, which allows modules to add things to the different sections on the front page. For an example of this, see `modules/modinfo/hooks/hook_frontpage.php`.
+There is currently a single user of the hook interface - the front page. The front page defines a hook named `frontpage`, which allows modules to add things to the different sections on the front page. For an example of this, see the `modules/modinfo/hooks/hook_frontpage.php` file in the
+[modinfo module](https://github.com/simplesamlphp/simplesamlphp-module-modinfo).
 
 
 
diff --git a/modules/modinfo/default-enable b/modules/modinfo/default-enable
deleted file mode 100644
index 25615cb47..000000000
--- a/modules/modinfo/default-enable
+++ /dev/null
@@ -1,3 +0,0 @@
-This file indicates that the default state of this module
-is enabled. To disable, create a file named disable in the
-same directory as this file.
diff --git a/modules/modinfo/dictionaries/modinfo.definition.json b/modules/modinfo/dictionaries/modinfo.definition.json
deleted file mode 100644
index 1c20ab7ae..000000000
--- a/modules/modinfo/dictionaries/modinfo.definition.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
-	"modlist_header": {
-		"en": "Available modules"
-	},
-	"modlist_name": {
-		"en": "Name"
-	},
-	"modlist_status": {
-		"en": "Status"
-	},
-	"modlist_enabled": {
-		"en": "Enabled"
-	},
-	"modlist_disabled": {
-		"en": "Disabled"
-	},
-	"latest_version" : {
-		"en" : "Updated"
-	},
-	"update_exists" : {
-		"en" : "Update available"
-	},
-	"version" : {
-		"en" : "Version"
-	}
-
-}
\ No newline at end of file
diff --git a/modules/modinfo/dictionaries/modinfo.translation.json b/modules/modinfo/dictionaries/modinfo.translation.json
deleted file mode 100644
index eb8714d1a..000000000
--- a/modules/modinfo/dictionaries/modinfo.translation.json
+++ /dev/null
@@ -1,147 +0,0 @@
-{
-	"modlist_header": {
-		"no": "Tilgjengelige moduler",
-		"de": "Verf\u00fcgbare Module",
-		"sl": "Razpolo\u017eljivi moduli",
-		"pt": "M\u00f3dulos dispon\u00edveis",
-		"sv": "Tillg\u00e4ngliga moduler",
-		"hr": "Raspolo\u017eivi moduli",
-		"da": "Tilg\u00e6ngelige moduler",
-		"fr": "Modules disponibles",
-		"it": "Moduli disponibili",
-		"es": "M\u00f3dulos disponibles",
-		"lt": "Esami moduliai",
-		"hu": "El\u00e9rhet\u0151 modulok",
-		"nl": "Beschikbare modules",
-		"ja": "\u6709\u52b9\u306a\u30e2\u30b8\u30e5\u30fc\u30eb",
-		"zh-tw": "\u53ef\u4f7f\u7528\u7684\u6a21\u7d44",
-		"nn": "Tilgjengelege modular",
-		"et": "Saadaolevad moodulid",
-		"he": "\u05de\u05d5\u05d3\u05d5\u05dc\u05d9\u05dd \u05d6\u05de\u05d9\u05e0\u05d9\u05dd",
-		"ru": "\u0414\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438",
-		"zh": "\u53ef\u7528\u7684\u6a21\u5757",
-		"ar": "\u0646\u0645\u0627\u0630\u062c \u0645\u062a\u0648\u0641\u0631\u0629",
-		"lv": "Pieejamie modu\u013ci",
-		"id": "Module-module yang tersedia",
-		"sr": "Raspolo\u017eivi moduli",
-		"ro": "Module disponibile",
-		"cs": "Dostupn\u00e9 moduly",
-		"eu": "Modulu erabilgarriak"
-	},
-	"modlist_name": {
-		"no": "Navn",
-		"de": "Name",
-		"sl": "Ime",
-		"pt": "Nome",
-		"sv": "Namn",
-		"hr": "Naziv",
-		"da": "Navn",
-		"fr": "Nom",
-		"it": "Nome",
-		"es": "Nombre",
-		"lt": "Pavadinimas",
-		"hu": "N\u00e9v",
-		"nl": "Naam",
-		"ja": "\u540d\u524d",
-		"zh-tw": "\u540d\u5b57",
-		"nn": "Namn",
-		"et": "Nimi",
-		"he": "\u05e9\u05dd",
-		"ru": "\u0418\u043c\u044f",
-		"zh": "\u540d\u5b57",
-		"ar": "\u0627\u0644\u0627\u0633\u0645",
-		"lv": "V\u0101rds",
-		"id": "Nama",
-		"sr": "Naziv",
-		"ro": "Nume",
-		"cs": "Jm\u00e9no",
-		"eu": "Izena"
-	},
-	"modlist_status": {
-		"no": "Status",
-		"de": "Status",
-		"sl": "Status",
-		"pt": "Estado",
-		"sv": "Status",
-		"hr": "Status",
-		"da": "Status",
-		"fr": "Statut",
-		"it": "Stato",
-		"es": "Estado",
-		"lt": "B\u016bsena",
-		"hu": "\u00c1llapot",
-		"nl": "Status",
-		"ja": "\u30b9\u30c6\u30fc\u30bf\u30b9",
-		"zh-tw": "\u72c0\u614b",
-		"nn": "Status",
-		"et": "Olek",
-		"he": "\u05de\u05e6\u05d1",
-		"ru": "\u0421\u0442\u0430\u0442\u0443\u0441",
-		"zh": "\u72b6\u6001",
-		"ar": "\u0627\u0644\u062d\u0627\u0644\u0629",
-		"lv": "Statuss",
-		"id": "Status",
-		"sr": "Status",
-		"ro": "Stare",
-		"cs": "Stav",
-		"eu": "Egoera"
-	},
-	"modlist_enabled": {
-		"no": "P\u00e5sl\u00e5tt",
-		"de": "Aktiviert",
-		"sl": "Vklopljen",
-		"pt": "Activo",
-		"sv": "Aktiv",
-		"hr": "Omogu\u0107en",
-		"da": "Sl\u00e5et til",
-		"fr": "Activ\u00e9",
-		"it": "Attivato",
-		"es": "Habilitado",
-		"lt": "Palaikomas",
-		"hu": "Enged\u00e9lyezve",
-		"nl": "Ingeschakeld",
-		"ja": "\u6709\u52b9",
-		"zh-tw": "\u555f\u7528",
-		"nn": "P\u00e5sl\u00e5tt",
-		"et": "Lubatud",
-		"he": "\u05de\u05d5\u05e4\u05e2\u05dc",
-		"ru": "\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0439",
-		"zh": "\u542f\u7528",
-		"ar": "\u0645\u0645\u0643\u0646",
-		"lv": "Iesp\u0113jots",
-		"id": "Diaktifkan",
-		"sr": "Omogu\u0107en",
-		"ro": "Activat\/Disponibil",
-		"cs": "Povolen\u00fd",
-		"eu": "Aktibatu"
-	},
-	"modlist_disabled": {
-		"no": "Avsl\u00e5tt",
-		"de": "Deaktiviert",
-		"sl": "Izklopljen",
-		"pt": "Inactivo",
-		"sv": "Ej aktiv",
-		"hr": "Onemogu\u0107en",
-		"da": "Sl\u00e5et fra",
-		"fr": "D\u00e9sactiv\u00e9",
-		"it": "Disattivato",
-		"es": "Deshabilitado",
-		"lt": "Nepalaikomas",
-		"hu": "Tiltva",
-		"nl": "Uitgeschakeld",
-		"ja": "\u7121\u52b9",
-		"zh-tw": "\u505c\u7528",
-		"nn": "Avsl\u00e5tt",
-		"et": "Keelatud",
-		"he": "\u05db\u05d1\u05d5\u05d9",
-		"ru": "\u0412\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0439",
-		"zh": "\u5173\u95ed",
-		"ar": "\u0645\u0645\u0646\u0648\u0639",
-		"lv": "Atsp\u0113jots",
-		"id": "Dinonaktifkan",
-		"sr": "Onemogu\u0107en",
-		"ro": "Dezactivat\/Nedisponibil",
-		"cs": "Zak\u00e1zan\u00fd",
-		"eu": "Desaktibatu"
-	}
-}
diff --git a/modules/modinfo/hooks/hook_frontpage.php b/modules/modinfo/hooks/hook_frontpage.php
deleted file mode 100644
index 12aaa6d1a..000000000
--- a/modules/modinfo/hooks/hook_frontpage.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-/**
- * Hook to add the modinfo module to the frontpage.
- *
- * @param array &$links  The links on the frontpage, split into sections.
- */
-function modinfo_hook_frontpage(&$links) {
-	assert('is_array($links)');
-	assert('array_key_exists("links", $links)');
-
-	$links['config'][] = array(
-		'href' => SimpleSAML_Module::getModuleURL('modinfo/'),
-		'text' => '{modinfo:modinfo:modlist_header}',
-		);
-
-}
diff --git a/modules/modinfo/hooks/hook_moduleinfo.php b/modules/modinfo/hooks/hook_moduleinfo.php
deleted file mode 100644
index 2436715ea..000000000
--- a/modules/modinfo/hooks/hook_moduleinfo.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/**
- * This hook lets the module describe itself.
- *
- * @param array &$moduleinfo  The links on the frontpage, split into sections.
- */
-function modinfo_hook_moduleinfo(&$moduleinfo) {
-	assert('is_array($moduleinfo)');
-	assert('array_key_exists("info", $moduleinfo)');
-	
-
-	$moduleinfo['info']['modinfo'] = array(
-		'name' => array('en' => 'Module information'),
-		'description' => array('en' => 'This module lists all available modules, and tells whether they are enabled or not.'),
-		
-		'dependencies' => array('core'),
-		'uses' => array('sanitycheck'),
-	);
-
-}
diff --git a/modules/modinfo/templates/modlist.php b/modules/modinfo/templates/modlist.php
deleted file mode 100644
index f3c157ccc..000000000
--- a/modules/modinfo/templates/modlist.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-$this->data['header'] = $this->t('{modinfo:modinfo:modlist_header}');
-$this->includeAtTemplateBase('includes/header.php');
-
-#$icon_enabled  = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/accept.png" alt="' .
-#htmlspecialchars($this->t(...)" />';
-#$icon_disabled = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/delete.png" alt="disabled" />';
-
-?>
-
-<h2><?php echo($this->data['header']); ?></h2>
-
-<table class="modules" style="width: 100%">
-<tr>
-<th colspan="2"><?php echo($this->t('{modinfo:modinfo:modlist_name}')); ?></th>
-<th ><?php echo($this->t('{modinfo:modinfo:modlist_status}')); ?></th>
-<th colspan="2"><?php echo($this->t('{modinfo:modinfo:version}')); ?></th>
-</tr>
-<?php
-ksort($this->data['modules']);
-
-$i = 0;
-foreach($this->data['modules'] as $id => $info) {
-	echo('<tr class="' . ($i++ % 2 == 0 ? 'odd' : 'even') . '">');
-	
-	
-	if (isset($info['def'])) {
-		echo('<td><a href="http://simplesamlphp.org/modules/' . htmlspecialchars($id) . '">' . htmlspecialchars($info['def']->def['name']) . '</a></td>');		
-	} else {
-		echo('<td> </td>');
-	}
-	
-	
-	echo('<td><tt>' . htmlspecialchars($id) . '</tt></td>');
-	
-	
-	if($info['enabled']) {
-		echo('<td><img src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/accept.png" alt="' .
-			htmlspecialchars($this->t('{modinfo:modinfo:modlist_enabled}')) . '" /></td>');
-	} else {
-		echo('<td><img src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/delete.png" alt="' .
-			htmlspecialchars($this->t('{modinfo:modinfo:modlist_disabled}')) . '" /></td>');
-	}
-	
-	if (isset($info['def'])) {
-		echo('<td>' . htmlspecialchars($info['def']->getVersion()) . ' (' .htmlspecialchars($info['def']->getBranch()) . ')</td>');	
-		if ($info['def']->updateExists()) {
-			echo('<td><img style="display: inline" src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/delete.png" alt="' .
-				htmlspecialchars($this->t('{modinfo:modinfo:update_exists}')) . '" /> ' . 
-				htmlspecialchars($this->t('{modinfo:modinfo:update_exists}')) . '</td>');		
-		} else {
-			echo('<td><img style="display: inline" src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/accept.png" alt="' .
-				htmlspecialchars($this->t('{modinfo:modinfo:latest_version}')) . '" /> ' . 
-				htmlspecialchars($this->t('{modinfo:modinfo:latest_version}')) . '</td>');
-		}
-	} else {
-		echo('<td colspan="2"> </td>');
-	}
-	
-	echo('</tr>');
-}
-?>
-</table>
-<?php $this->includeAtTemplateBase('includes/footer.php');
diff --git a/modules/modinfo/www/index.php b/modules/modinfo/www/index.php
deleted file mode 100644
index 9e431d889..000000000
--- a/modules/modinfo/www/index.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-$modules = SimpleSAML_Module::getModules();
-sort($modules);
-
-$modinfo = array();
-
-foreach($modules as $m) {
-	$modinfo[$m] = array(
-		'enabled' => SimpleSAML_Module::isModuleEnabled($m),
-	);
-	if (sspmod_core_ModuleDefinition::isDefined($m)) {
-		$modinfo[$m]['def'] = sspmod_core_ModuleDefinition::load($m);
-	}
-
-}
-
-function cmpa($a, $b) {
-	
-    if (isset($a['def']) && !isset($b['def'])) return -1;
-    if (isset($b['def']) && !isset($a['def'])) return 1;
-	return 0;
-}
-uasort($modinfo, 'cmpa');
-
-$config = SimpleSAML_Configuration::getInstance();
-$t = new SimpleSAML_XHTML_Template($config, 'modinfo:modlist.php');
-$t->data['modules'] = $modinfo;
-$t->show();
-- 
GitLab