mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-22 23:05:18 -04:00
Add a button to install all plugins at once, now that we have so many.
Improve the style a bit, sort the plugins, put core first and make it stand out so that you don't accidentally uninstall it.
This commit is contained in:
@@ -42,21 +42,21 @@ class Welcome_Controller extends Template_Controller {
|
||||
}
|
||||
|
||||
function install($module_name) {
|
||||
call_user_func(array("{$module_name}_installer", "install"));
|
||||
if ($module_name == "*") {
|
||||
foreach ($this->_read_modules() as $module_name => $version) {
|
||||
if (empty($version)) {
|
||||
call_user_func(array("${module_name}_installer", "install"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
call_user_func(array("{$module_name}_installer", "install"));
|
||||
}
|
||||
|
||||
url::redirect("welcome");
|
||||
}
|
||||
|
||||
function uninstall($module_name) {
|
||||
if ($module_name == "core") {
|
||||
// Legacy support for uninstalling the auth module and removing the blocks table
|
||||
try {
|
||||
$db = Database::instance();
|
||||
$db->query("DROP TABLE IF EXISTS `passwords`;");
|
||||
ORM::factory("module")->where("name", "auth")->find()->delete();
|
||||
$db->query("DROP TABLE IF EXISTS `blocks`;");
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
// We have to uninstall all other modules first, else their tables, etc don't
|
||||
// get cleaned up.
|
||||
foreach (ORM::factory("module")->find_all() as $module) {
|
||||
@@ -292,6 +292,7 @@ class Welcome_Controller extends Template_Controller {
|
||||
} catch (Exception $e) {
|
||||
// The database may not be installed
|
||||
}
|
||||
ksort($modules);
|
||||
return $modules;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +106,18 @@
|
||||
display: inline;
|
||||
}
|
||||
|
||||
tr.core td {
|
||||
border-bottom: 1px solid black;
|
||||
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="<?= url::file("lib/jquery.js") ?>"></script>
|
||||
<script type="text/javascript" src="<?= url::file("lib/jquery.cookie.js") ?>"></script>
|
||||
|
||||
@@ -35,7 +35,13 @@
|
||||
<th align="left">Version</th>
|
||||
<th align="left">Action</th>
|
||||
</tr>
|
||||
<tr class="core">
|
||||
<td> <b> core </b> </td>
|
||||
<td> <b> <?= $modules["core"] ?> </b> </td>
|
||||
<td> <b> <?= html::anchor("welcome/uninstall/core", "reset install") ?> </b> </td>
|
||||
</tr>
|
||||
<? foreach ($modules as $module_name => $module_version): ?>
|
||||
<? if ($module_name == "core") continue; ?>
|
||||
<tr>
|
||||
<td><?= $module_name ?></td>
|
||||
<td><?= empty($module_version) ? "" : $module_version ?></td>
|
||||
@@ -49,6 +55,9 @@
|
||||
</tr>
|
||||
<? endforeach; ?>
|
||||
<tr>
|
||||
<td colspan="3" align="center">
|
||||
<button onclick="document.location.href='<?= url::site("welcome/install/*") ?>'">Install All Plugins</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<? endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user