Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename user column in user_message_forward to userid #1008

Open
wants to merge 2 commits into
base: release-3.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public_html/lists/admin/exportuserdata.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
FROM
'.$GLOBALS['tables']['user_message_forward'].'
WHERE
USER = '.sprintf('%d', $user['id'])
USERID = '.sprintf('%d', $user['id'])
);

$totalForwards = Sql_Num_Rows( $forwardrows );
Expand Down
2 changes: 1 addition & 1 deletion public_html/lists/admin/inc/userlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function deleteUserRecordsLeaveBlacklistRecords($id)
Sql_Query('delete from '.$tables['user_attribute'].' where userid = '.$id);
Sql_Query('delete from '.$tables['user_history'].' where userid = '.$id);
Sql_Query('delete from '.$tables['user_message_bounce'].' where user = '.$id);
Sql_Query('delete from '.$tables['user_message_forward'].' where user = '.$id);
Sql_Query('delete from '.$tables['user_message_forward'].' where userid = '.$id);
Sql_Query('delete from '.$tables['user'].' where id = '.$id);
Sql_Query('delete from '.$tables['user_message_view'].' where userid = '.$id);
}
Expand Down
6 changes: 3 additions & 3 deletions public_html/lists/admin/structure.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,13 @@
),
'user_message_forward' => array(
'id' => array('integer not null primary key auto_increment', 'ID'),
'user' => array('integer not null', 'subscriber ID'),
'userid' => array('integer not null', 'subscriber ID'),
'message' => array('integer not null', 'Message ID'),
'forward' => array('varchar(255)', 'Forward email'),
'status' => array('varchar(255)', 'Status of forward'),
'time' => array('timestamp', 'When was it forwarded'),
'index_1' => array('usermessageidx (user,message)', 'index'),
'index_2' => array('useridx (user)', 'index'),
'index_1' => array('usermessageidx (userid,message)', 'index'),
'index_2' => array('useridx (userid)', 'index'),
'index_3' => array('messageidx (message)', 'index'),
),
'config' => array(
Expand Down
9 changes: 9 additions & 0 deletions public_html/lists/admin/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,15 @@ function output($message)
Sql_Query("alter table {$GLOBALS['tables']['admin']} modify modifiedby varchar(66) default ''");
}

if (Sql_Table_Column_Exists($GLOBALS['tables']['user_message_forward'],'user')) {
Sql_Query('drop index usermessageidx on '.$GLOBALS['tables']['user_message_forward']);
Sql_Query('drop index useridx on '.$GLOBALS['tables']['user_message_forward']);
Sql_Query('alter table '.$GLOBALS['tables']['user_message_forward'].' change column user userid integer not null');
Sql_Query('alter table '.$GLOBALS['tables']['user_message_forward'].' add index usermessageidx (userid,message)');
Sql_Query('alter table '.$GLOBALS['tables']['user_message_forward'].' add index useridx (userid)');
Sql_Query('drop index useridx on '.$GLOBALS['tables']['user_message_forward']);
}

//# longblobs are better at mixing character encoding. We don't know the encoding of anything we may want to store in cache
//# before converting, it's quickest to clear the cache
clearPageCache();
Expand Down
8 changes: 4 additions & 4 deletions public_html/lists/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ function forwardPage($id)
$forwardemail = '';
if (isset($_REQUEST['email']) && !empty($_REQUEST['email'])) {
$firstpage = 0;
$forwardPeriodCount = Sql_Fetch_Array_Query(sprintf('select count(user) from %s where date_add(time,interval %s) >= now() and user = %d and status ="sent" ',
$forwardPeriodCount = Sql_Fetch_Array_Query(sprintf('select count(userid) from %s where date_add(time,interval %s) >= now() and userid = %d and status ="sent" ',
$tables['user_message_forward'], FORWARD_EMAIL_PERIOD, $userdata['id']));
$forwardemail = stripslashes($_REQUEST['email']);
$emails = explode("\n", $forwardemail);
Expand Down Expand Up @@ -1126,7 +1126,7 @@ function forwardPage($id)

foreach ($emails as $index => $email) {
//0011860: forward to friend, multiple emails
$done = Sql_Fetch_Array_Query(sprintf('select user,status,time from %s where forward = "%s" and message = %d',
$done = Sql_Fetch_Array_Query(sprintf('select userid,status,time from %s where forward = "%s" and message = %d',
$tables['user_message_forward'], $email, $mid));
$info .= '<br />'.$email.': ';
if ($done['status'] === 'sent') {
Expand All @@ -1145,7 +1145,7 @@ function forwardPage($id)
sendAdminCopy(s('Message Forwarded'),
s('%s has forwarded message %d to %s', $userdata['email'], $mid, $email),
$messagelists);
Sql_Query(sprintf('insert into %s (user,message,forward,status,time)
Sql_Query(sprintf('insert into %s (userid,message,forward,status,time)
values(%d,%d,"%s","sent",now())',
$tables['user_message_forward'], $userdata['id'], $mid, $email));
if ($iCountFriends) {
Expand All @@ -1156,7 +1156,7 @@ function forwardPage($id)
sendAdminCopy(s('Message Forwarded'),
s('%s tried forwarding message %d to %s but failed', $userdata['email'], $mid, $email),
$messagelists);
Sql_Query(sprintf('insert into %s (user,message,forward,status,time)
Sql_Query(sprintf('insert into %s (userid,message,forward,status,time)
values(%d,%d,"%s","failed",now())',
$tables['user_message_forward'], $userdata['id'], $mid, $email));
$ok = false;
Expand Down
Loading