diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-05-05 13:57:29 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-05-05 13:57:29 +0000 |
commit | be8e898d23a3f9ca515f59fbcc8d82e112ed7ee8 (patch) | |
tree | cf0d05f6b767f36e7feb09a3bc59cbc9a01e459b /modules/module.module | |
parent | 16818777616eadeb8a4670324e099b95c8d53e3b (diff) | |
download | brdo-be8e898d23a3f9ca515f59fbcc8d82e112ed7ee8.tar.gz brdo-be8e898d23a3f9ca515f59fbcc8d82e112ed7ee8.tar.bz2 |
- Uhm. Rewrote the module system: less code clutter, less run-time
overhead, and a lot better (simpler) module API. I had to edit a
LOT of files to get this refactored but I'm sure it was worth the
effort.
For module writers / maintainers:
None of the hooks changed, so 95% of the old modules should still
work. You can remove some code instead as "$module = array(...)"
just became obsolete. Also - and let's thank God for this - the
global variable "$repository" has been eliminated to avoid modules
relying on, and poking in drupal's internal data structures. Take
a look at include/module.inc to investigate the details/changes.
- Improved design of the content modules "story", "book" and "node"
(to aid smooth integration of permisions + moderate.module). I'm
still working on the permissions but I got side tracked for which
I "Oops!".
Diffstat (limited to 'modules/module.module')
-rw-r--r-- | modules/module.module | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/modules/module.module b/modules/module.module index e4140ce22..f11832770 100644 --- a/modules/module.module +++ b/modules/module.module @@ -1,8 +1,5 @@ <?php -$module = array("help" => "module_help", - "admin" => "module_admin"); - function module_help() { ?> The module administration page provide you a list of all available modules. Moreover, it allows you to "rehash" modules. Whenever you install a new module or when an existing module has been changed or updated, it requires "rehashing": when you rehash a module, the module is registered to the engine and properly initialized. @@ -10,34 +7,24 @@ function module_help() { } function module_admin_rehash() { - global $repository; - $result = db_query("SELECT * FROM modules"); while ($module = db_fetch_object($result)) { module_rehash($module->name); } - foreach ($repository as $name=>$module) { + foreach (module_list() as $name) { module_rehash($name); } } -function module_admin_display() { - global $output; - - function module_row($name, $module) { - global $output; - - $view = ($module["page"]) ? "<A HREF=\"module.php?mod=$name\">view</A>" : " "; - $admin = ($module["admin"]) ? "<A HREF=\"admin.php?mod=$name\">admin</A>" : " "; - $output .= " <TR><TD>$name</TD><TD>$view</TD><TD>$admin</TD><TD><A HREF=\"admin.php?mod=module&op=rehash&name=$name\">rehash</A></TD></TR>\n"; - } - +function module_admin_overview() { $output .= "<FORM ACTION=\"admin.php?mod=module\" METHOD=\"post\">\n"; $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>module</TH><TH COLSPAN=\"3\">operations</TH></TR>\n"; - module_iterate("module_row"); + foreach (module_list() as $name) { + $output .= " <TR><TD>$name</TD><TD>". (module_hook($name, "page") ? "<A HREF=\"module.php?mod=$name\">view</A>" : " ") ."</TD><TD>". (module_hook($name, "admin") ? "<A HREF=\"admin.php?mod=$name\">admin</A>" : " ") ."</TD><TD><A HREF=\"admin.php?mod=module&op=rehash&name=$name\">rehash</A></TD></TR>\n"; + } $output .= "</TABLE>\n"; $output .= "<INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Rehash modules\">\n"; @@ -56,14 +43,14 @@ function module_admin() { break; case "rehash": module_rehash($name); - module_admin_display(); + module_admin_overview(); break; case "Rehash modules": module_admin_rehash(); - module_admin_display(); + module_admin_overview(); break; default: - module_admin_display(); + module_admin_overview(); } } |