Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-19-2015, 12:26 PM
Guest210212002
Guest
 
Posts: n/a
Default Cleaning out an improperly uninstalled mod

I recently installed, and subsequently uninstalled, DJ's AME because of various reasons. Unfortunately, even though i ran the cleanup tools with the plugin it left behind a ton of artifacts in old posts.

All of my old Youtube video links (which were previously just the YT URL) now look like so:

Code:
[ame="http://www.youtube.com/watch?v=6fOprNSFCX4"]Title of Video[/ame]
And since I don't have an AME code, they just parse as plain text. Is there a quick and simple way to clean these up across my forum? I'd like to remove the bold bits, and just leave the URL behind. Bonus points if the URL is still parsed correctly so that it's click-able.

Code:
[ame="ht tp://w ww.youtube.com/watch?v=6fOprNSFCX4"]Title of Video
I've attached a screenshot of how it's looking on my forum at present. Any insight would be awesome. Thanks!
Attached Images
File Type: png Screen Shot 2015-03-19 at 9.27.12 AM.png (33.9 KB, 0 views)
Reply With Quote
  #2  
Old 03-19-2015, 08:03 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Unfortunately I don't think there's any regular expression replacement in mysql, so you'd have to write a script, or maybe export the post table to a text file, do a replacement on it in an editor or something (maybe by a command line tool in linux), then import it again. But I did figure out a pattern, I think, so in a vbulletin php script it would be something like:
PHP Code:
$posts $vbulletin->db->query_read("SELECT postid, pagetext FROM ".TABLE_PREFIX."post WHERE pagetext LIKE '%[ame%' ");
while (
$post $vbulletin->db->fetch_array($posts))
{
   if ((
$new_pagetext preg_replace('/\[ame="(.*?)"].*?\[\/ame]/i''[url]$1[/url]'$post['pagetext'])) != NULL &&
         
$new_pagetext !== $post['pagetext'])
   {
      
$vbulletin->db->query_write("UPDATE ".TABLE_PREFIX."post SET pagetext='".$vbulletin->db->escape_string($new_pagetext)."' WHERE postid={$post['postid']} ");
   }

Reply With Quote
  #3  
Old 03-19-2015, 08:11 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I decided to test it in a plugin, so I thought I might as well export it and post it here. You would take this xml file and use Plugins & Products > Download/ Upload Plugins, and scroll to the bottom for the upload form. Then you'd point your browser at misc.php?do=fixame and see what happens. I tried to echo dots but it might not work, so you might see nothing for a long time if you have a lot of posts. You only need to do it once (assuming it doesn't timeout or stop because of an error) then uninstall it.

You should probably close your forum and backup your database before running this.
Attached Files
File Type: xml fixame.xml (1.1 KB, 4 views)
Reply With Quote
  #4  
Old 03-20-2015, 10:14 PM
Guest210212002
Guest
 
Posts: n/a
Default

I'll give that a shot, thank you VERY much! It rewrote all of my Amazon URLs too (ugh).

If this works, I'll PM you and paypal you some cash to grab a burrito on me. I make a decent chunk of change from my Amazon affiliated links, and AME broke them all.

--------------- Added [DATE]1426944173[/DATE] at [TIME]1426944173[/TIME] ---------------

That worked! Thank you so much dude!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:13 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05025 seconds
  • Memory Usage 2,210KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (2)postbit_attachment
  • (2)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_imicons
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete