QUICK NEWS

{NEW} - More to come for this tab...

{OLD} - A new css video is up.


Video of the moment:


Internal Links

SMF Sites

Quick Info

Mysql database help please?

Started by Dave, Jan 30, 2026, 09:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

shawnb61

#15
Ah...  You wish to make changes to the smf_down_file table, not the smf_messages table...

My utilities won't help with that; they are primarily working on smf_messages.

So I understand: Have you also uploaded the files, to be served via the Downloads mod?  Is that why would you want to keep the record - to keep the stats & configs? 

If the record stores a link only, and the link is dead, I'd be tempted to delete the record.  Change it from a link to a local download.  Unless you're trying to repurpose that record to be a download.

If that's the case, the problem is much simpler, because the fileurl field on the smf_down_file record is just the URL.  No complicated regex needed, as the filename isn't embedded in a bunch of text.  You can see that in the .sql dump above - it's a discrete field.

The real question is whether the swap from a link to a download works & preserves the stats...  I can't answer that.  Although I use the Downloads mod, I don't have that option.  Must be unique to the paid version.

If all you want to do is nuke the URL, that's easy.  That would be something like:
UPDATE smf_down_file
   SET fileurl = NULL
 WHERE fileurl LIKE '%filefactory%';

I'm pretty sure you want it NULL, the field is nullable.  It's possible you need an empty space.  If that's the case, it would be more like:
UPDATE smf_down_file
   SET fileurl = ''
 WHERE fileurl LIKE '%filefactory%';

The above are somewhat safe, as they will only do the update if the url was previously a filefactory url.

Dave

Thanks again guys I'll check all this out

Dave

#17
Quote from: shawnb61 on Feb 01, 2026, 08:47 PMAh...  You wish to make changes to the smf_down_file table, not the smf_messages table...

My utilities won't help with that; they are primarily working on smf_messages.

So I understand: Have you also uploaded the files, to be served via the Downloads mod?  Is that why would you want to keep the record - to keep the stats & configs? 

If the record stores a link only, and the link is dead, I'd be tempted to delete the record.  Change it from a link to a local download.  Unless you're trying to repurpose that record to be a download.

If that's the case, the problem is much simpler, because the fileurl field on the smf_down_file record is just the URL.  No complicated regex needed, as the filename isn't embedded in a bunch of text.  You can see that in the .sql dump above - it's a discrete field.

The real question is whether the swap from a link to a download works & preserves the stats...  I can't answer that.  Although I use the Downloads mod, I don't have that option.  Must be unique to the paid version.

If all you want to do is nuke the URL, that's easy.  That would be something like:
UPDATE smf_down_file
   SET fileurl = NULL
 WHERE fileurl LIKE '%filefactory%';

I'm pretty sure you want it NULL, the field is nullable.  It's possible you need an empty space.  If that's the case, it would be more like:
UPDATE smf_down_file
   SET fileurl = ''
 WHERE fileurl LIKE '%filefactory%';

The above are somewhat safe, as they will only do the update if the url was previously a filefactory url.


Shawn you are a genius, I used the bottom query and added

UPDATE smf_down_file
   SET fileurl = 'Link Removed'
 WHERE fileurl LIKE '%filefactory%';

it worked perfectly thank you very much

Ronald

Sure had me confused.  I am sure happy you had the right fix Dave. :rgton

Bigguy

"It's the American dream....cause ya have to be asleep to believe it." - George Carlin