How Do I Change File Descriptions in MASS ? How Do I Change File Descriptions in MASS ?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

How Do I Change File Descriptions in MASS ?

Started by geffroman, April 04, 2009, 03:42:12 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

geffroman

I need to change a redundant BB Link in my file descriptions.  I have hundreds to do and may need to do this again in the future.  If doing simple HTML I would simply FIND/REPLACE code on all pages on my site.  I need to do the same thing within the File Descriptions on my Coppermine Gallery.

Example:

Current text  "[url=file:///M:/A"

Change to  "[url=file:///L:/A"

It looks like a small thing but 100s of manual entries makes it important to find a FIND/REPLACE procedure.

Thank you for any advise.  Jeff

Joachim Müller

That information is not being stored in a file, but in the database. Therefor, you'll need a tool like phpMyAdmin that allows you to perform edits directly on the database. You will then have to run queries against the database that perform such find/replace operations. But you need to understand that this is not trivial: if you make a mistake, you will lose data. It's mandatory to perform a backup (database dump) before "playing" with the database.

However: in the most recent security release, bbcode linking has been disabled for security reasons. If you still have bbcode links, you probably are running an outdated version that subsequently is vulnerable in terms of security. It's mandatory to upgrade to cpg1.4.21. Please read up the corresponding announcement thread.

geffroman

I understand that this is a data base issue rather than a simple file edit.  That's why I need help from you guys.

I appreciate the security issue.  However it does not affect me.  My gallery is not public.  It is a private system only used by my family.  In short, it is locked down and not available to anyone outside my home.  Secondly, I use Coppermine as a search-able, sortable front end to find files on local computers in my home via these links in the file descriptions.   So for me, updating Coppermine would render the program completely unusable for the purpose I use it.  I have months invested in the system.  We love it as it is.

So can you help me understand what it will take to make these File Description text adjustments in bulk/mass ?

Thank you...  Jeff

Nibbler

The query would something like

UPDATE cpg_pictures SET caption = REPLACE(caption, 'find this', 'replace with this')

geffroman

Thank you Nibbler.  I'll do a few tests before applying to a mass edit to see if I have it straight.

I'll post up when successful :)


geffroman

Fellas I took a look at phpMyAdmin.  Looks like a lot to install, configure and learn to apply nibblers very simple query.  Is there a simplier method to getting this done ?

Joachim Müller

phpMyAdmin is a no-brainer: pretty straightforward to install. Needed to perform backups (and all sorts of maintenance) anyway.

This being said: if you're too lazy to install phpMyAdmin, use a plain text editor to edit sql/update.sql.
Add the query UPDATE CPG_pictures SET caption = REPLACE(caption, 'find this', 'replace with this') at the very end of the file (into a new line of it's own). Then run http://yoursite.tld/your_coppermine_folder/update.php in your browser. After doing that ONCE, edit sql/update.sql once more and remove the line you have added in the frist place to make sure it doesn't get run for a second time.
However, you should only do as I advised if you have made a backup (dump) of your database. For this, you will probably want to use phpMyAdmin anyway, so you're back to step one.

Don't perform database manipulation if you have no idea about the impact. Don't run a webserver if you have no idea how to maintain it.

geffroman

Quote from: Joachim Müller on April 06, 2009, 09:22:27 AM
phpMyAdmin is a no-brainer: pretty straightforward to install. Needed to perform backups (and all sorts of maintenance) anyway.

This being said: if you're too lazy to install phpMyAdmin, use a plain text editor to edit sql/update.sql.
Add the query UPDATE CPG_pictures SET caption = REPLACE(caption, 'find this', 'replace with this') at the very end of the file (into a new line of it's own). Then run http://yoursite.tld/your_coppermine_folder/update.php in your browser. After doing that ONCE, edit sql/update.sql once more and remove the line you have added in the frist place to make sure it doesn't get run for a second time.
However, you should only do as I advised if you have made a backup (dump) of your database. For this, you will probably want to use phpMyAdmin anyway, so you're back to step one.

Don't perform database manipulation if you have no idea about the impact. Don't run a webserver if you have no idea how to maintain it.

Don't reply to forum requests for assistance if you cannot do so without being superior, rude and insulting.  Thank you.

geffroman

Fellas the idea of using update.sql is perfect.  However in my test image the update function did not catch/update the file Description text.  I placed Nibblers code on it's own line at the end of the update.sql file as Muller instructed.

Is the syntax correct that Nibbler suggested ?  Is there a step that Muller missed ?

Your assistance is appreciated.  Jeff

Joachim Müller

Quote from: geffroman on April 08, 2009, 05:24:55 AM
Don't reply to forum requests for assistance if you cannot do so without being superior, rude and insulting.  Thank you.
Don't post such rants if you want answers. You're banned for three days from posting. I posted clear instructions what to do. I'm sorry now that I have wasted time to answer your question if the only thing you can do is reply with an insult.