Commit ab700960 authored by Steven Wittens's avatar Steven Wittens
Browse files

- #18597: Resolve conflict in column name between queue.module and poll.module.

parent 55af18a2
......@@ -102,7 +102,8 @@
"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);
......
......@@ -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']++;
......
......@@ -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']++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment