diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2005-03-18 08:02:10 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2005-03-18 08:02:10 +0000 |
commit | ab700960e46a1acf042f9be995aef8bb2aa74f7b (patch) | |
tree | 076d25566a51a2cc518e16838fb7a736f086a461 | |
parent | 55af18a2eb8e64395c78575a5d434c66b9e17e16 (diff) | |
download | brdo-ab700960e46a1acf042f9be995aef8bb2aa74f7b.tar.gz brdo-ab700960e46a1acf042f9be995aef8bb2aa74f7b.tar.bz2 |
- #18597: Resolve conflict in column name between queue.module and poll.module.
-rw-r--r-- | database/updates.inc | 14 | ||||
-rw-r--r-- | modules/poll.module | 10 | ||||
-rw-r--r-- | modules/poll/poll.module | 10 |
3 files changed, 23 insertions, 11 deletions
diff --git a/database/updates.inc b/database/updates.inc index 468dc0285..aa76ce719 100644 --- a/database/updates.inc +++ b/database/updates.inc @@ -102,7 +102,8 @@ $sql_updates = array( "2005-01-28" => "update_123", "2005-02-11" => "update_124", "2005-02-23" => "update_125", - "2005-03-03" => "update_126" + "2005-03-03" => "update_126", + "2005-03-18" => "update_127" ); function update_32() { @@ -2313,6 +2314,17 @@ function update_126() { return array(); } +function update_127() { + $ret = array(); + if ($GLOBALS['db_type'] == 'pgsql') { + $ret[] = update_sql("ALTER TABLE {poll} RENAME voters TO polled"); + } + else if ($GLOBALS['db_type'] == 'mysql') { + $ret[] = update_sql("ALTER TABLE {poll} CHANGE voters polled longtext"); + } + return $ret; +} + function update_sql($sql) { $edit = $_POST["edit"]; $result = db_query($sql); diff --git a/modules/poll.module b/modules/poll.module index fae6e098a..ee7bcfdcf 100644 --- a/modules/poll.module +++ b/modules/poll.module @@ -171,7 +171,7 @@ function poll_insert($node) { $node->active = 1; } - db_query("INSERT INTO {poll} (nid, runtime, voters, active) VALUES (%d, %d, '', %d)", $node->nid, $node->runtime, $node->active); + db_query("INSERT INTO {poll} (nid, runtime, polled, active) VALUES (%d, %d, '', %d)", $node->nid, $node->runtime, $node->active); foreach ($node->choice as $choice) { if ($choice['chtext'] != '') { @@ -239,7 +239,7 @@ function poll_uid() { */ function poll_load($node) { // Load the appropriate choices into the $node object - $poll = db_fetch_object(db_query("SELECT runtime, voters, active FROM {poll} WHERE nid = %d", $node->nid)); + $poll = db_fetch_object(db_query("SELECT runtime, polled, active FROM {poll} WHERE nid = %d", $node->nid)); $result = db_query("SELECT chtext, chvotes, chorder FROM {poll_choices} WHERE nid=%d ORDER BY chorder", $node->nid); while ($choice = db_fetch_array($result)) { @@ -249,7 +249,7 @@ function poll_load($node) { // Determine whether or not this user is allowed to vote $poll->allowvotes = false; if (user_access('vote on polls')) { - if (!strstr($poll->voters, poll_uid())) { + if (!strstr($poll->polled, poll_uid())) { $poll->allowvotes = $poll->active; } } @@ -381,8 +381,8 @@ function poll_vote(&$node) { if (isset($choice) && isset($node->choice[$choice])) { if ($node->allowvotes) { $id = poll_uid(); - $node->voters = $node->voters ? ($node->voters .' '. $id) : $id; - db_query("UPDATE {poll} SET voters='%s' WHERE nid = %d", $node->voters, $node->nid); + $node->polled = $node->polled ? ($node->polled .' '. $id) : $id; + db_query("UPDATE {poll} SET polled='%s' WHERE nid = %d", $node->polled, $node->nid); db_query("UPDATE {poll_choices} SET chvotes = chvotes + 1 WHERE nid = %d AND chorder = %d", $node->nid, $choice); $node->allowvotes = false; $node->choice[$choice]['chvotes']++; diff --git a/modules/poll/poll.module b/modules/poll/poll.module index fae6e098a..ee7bcfdcf 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -171,7 +171,7 @@ function poll_insert($node) { $node->active = 1; } - db_query("INSERT INTO {poll} (nid, runtime, voters, active) VALUES (%d, %d, '', %d)", $node->nid, $node->runtime, $node->active); + db_query("INSERT INTO {poll} (nid, runtime, polled, active) VALUES (%d, %d, '', %d)", $node->nid, $node->runtime, $node->active); foreach ($node->choice as $choice) { if ($choice['chtext'] != '') { @@ -239,7 +239,7 @@ function poll_uid() { */ function poll_load($node) { // Load the appropriate choices into the $node object - $poll = db_fetch_object(db_query("SELECT runtime, voters, active FROM {poll} WHERE nid = %d", $node->nid)); + $poll = db_fetch_object(db_query("SELECT runtime, polled, active FROM {poll} WHERE nid = %d", $node->nid)); $result = db_query("SELECT chtext, chvotes, chorder FROM {poll_choices} WHERE nid=%d ORDER BY chorder", $node->nid); while ($choice = db_fetch_array($result)) { @@ -249,7 +249,7 @@ function poll_load($node) { // Determine whether or not this user is allowed to vote $poll->allowvotes = false; if (user_access('vote on polls')) { - if (!strstr($poll->voters, poll_uid())) { + if (!strstr($poll->polled, poll_uid())) { $poll->allowvotes = $poll->active; } } @@ -381,8 +381,8 @@ function poll_vote(&$node) { if (isset($choice) && isset($node->choice[$choice])) { if ($node->allowvotes) { $id = poll_uid(); - $node->voters = $node->voters ? ($node->voters .' '. $id) : $id; - db_query("UPDATE {poll} SET voters='%s' WHERE nid = %d", $node->voters, $node->nid); + $node->polled = $node->polled ? ($node->polled .' '. $id) : $id; + db_query("UPDATE {poll} SET polled='%s' WHERE nid = %d", $node->polled, $node->nid); db_query("UPDATE {poll_choices} SET chvotes = chvotes + 1 WHERE nid = %d AND chorder = %d", $node->nid, $choice); $node->allowvotes = false; $node->choice[$choice]['chvotes']++; |