summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-01-08 12:49:51 +0000
committerDries Buytaert <dries@buytaert.net>2006-01-08 12:49:51 +0000
commit7f87b19eeb3af1d6afb4dbca771e261cc49b8caa (patch)
tree87887d263d34b37bed369bb3efe280c78ac11ce4
parent7f083e0c2fe9075a2950f198345a1a8cc2ac80b4 (diff)
downloadbrdo-7f87b19eeb3af1d6afb4dbca771e261cc49b8caa.tar.gz
brdo-7f87b19eeb3af1d6afb4dbca771e261cc49b8caa.tar.bz2
- Patch #42886 by chx: critical feature: allow modules to be reordered.
-rw-r--r--database/database.mysql4
-rw-r--r--database/database.pgsql2
-rw-r--r--database/updates.inc16
-rw-r--r--includes/module.inc5
-rw-r--r--modules/node.module2
-rw-r--r--modules/node/node.module2
6 files changed, 25 insertions, 6 deletions
diff --git a/database/database.mysql b/database/database.mysql
index e84d4518b..68671f14b 100644
--- a/database/database.mysql
+++ b/database/database.mysql
@@ -685,7 +685,9 @@ CREATE TABLE system (
throttle tinyint(1) DEFAULT '0' NOT NULL,
bootstrap int(2) NOT NULL default '0',
schema_version smallint(2) unsigned NOT NULL default 0,
- PRIMARY KEY (filename)
+ weight int(2) NOT NULL default '0',
+ PRIMARY KEY (filename),
+ KEY (weight)
) TYPE=MyISAM;
--
diff --git a/database/database.pgsql b/database/database.pgsql
index 8b7659f5a..1529901dd 100644
--- a/database/database.pgsql
+++ b/database/database.pgsql
@@ -680,8 +680,10 @@ CREATE TABLE system (
throttle smallint NOT NULL default '0',
bootstrap integer NOT NULL default '0',
schema_version smallint NOT NULL default 0,
+ weight smallint NOT NULL default 0,
PRIMARY KEY (filename)
);
+CREATE INDEX system_weight_idx ON system(weight);
--
-- Table structure for term_data
diff --git a/database/updates.inc b/database/updates.inc
index d4b440f3d..10a73f3d7 100644
--- a/database/updates.inc
+++ b/database/updates.inc
@@ -1397,3 +1397,19 @@ function system_update_166() {
return $ret;
}
+
+function system_update_167() {
+ $ret = array();
+ switch ($GLOBALS['db_type']) {
+ case 'pgsql':
+ db_add_column($ret, 'system', 'weight', 'smallint', array('not null' => TRUE, 'default' => 0));
+ $ret[] = update_sql('CREATE INDEX {system}_weight_idx ON {system} (weight)');
+ break;
+ case 'mysql':
+ case 'mysqli':
+ $ret[] = update_sql("ALTER TABLE {system} ADD weight tinyint(3) unsigned default '0' NOT NULL, ADD KEY (weight)");
+ break;
+ }
+
+ return $ret;
+}
diff --git a/includes/module.inc b/includes/module.inc
index f4f590772..e4956999f 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -50,10 +50,10 @@ function module_list($refresh = FALSE, $bootstrap = TRUE) {
if (!$list) {
$list = array('filter' => 'filter', 'system' => 'system', 'user' => 'user', 'watchdog' => 'watchdog');
if ($bootstrap) {
- $result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = 1 AND bootstrap = 1");
+ $result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = 1 AND bootstrap = 1 ORDER BY weight ASC, filename ASC");
}
else {
- $result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = 1");
+ $result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = 1 ORDER BY weight ASC, filename ASC");
}
while ($module = db_fetch_object($result)) {
if (file_exists($module->filename)) {
@@ -67,7 +67,6 @@ function module_list($refresh = FALSE, $bootstrap = TRUE) {
}
}
}
- asort($list);
}
return $list;
}
diff --git a/modules/node.module b/modules/node.module
index 3c7283b0e..f7e998d13 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -2169,7 +2169,7 @@ function node_form_alter($form_id, &$form) {
* - "delete"
* - "create"
* @param $node
- * The node object (or node array) on which the operation is to be performed,
+ * The node object (or node array) on which the operation is to be performed,
* or node type (e.g. 'forum') for "create" operation.
* @param $uid
* The user ID on which the operation is to be performed.
diff --git a/modules/node/node.module b/modules/node/node.module
index 3c7283b0e..f7e998d13 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -2169,7 +2169,7 @@ function node_form_alter($form_id, &$form) {
* - "delete"
* - "create"
* @param $node
- * The node object (or node array) on which the operation is to be performed,
+ * The node object (or node array) on which the operation is to be performed,
* or node type (e.g. 'forum') for "create" operation.
* @param $uid
* The user ID on which the operation is to be performed.