Problem with non-existant galleries in database. (long) Problem with non-existant galleries in database. (long)
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Problem with non-existant galleries in database. (long)

Started by Glenshadow, December 28, 2005, 07:09:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Glenshadow

Hello all,

I have a pretty odd problem and I think the only way to resolve it is going to be starting a whole new database with Coppermine. I figure I will give it a shot here though just in case there is a fix out there.

I am running VBulletin 3.50, VBadvanced 2.x, and Coppermine 1.42 stable.

I have a working script that I found on the vbadvaced websites called crandom.php that will pull images from the Coppermine database and it works just fine for what I need. I started noticing that it was bringing up images that fail on a random occurance and tore through the code up and down to make sure I didn't screw something up, I ended up hard coding it to a specific directory within my /albums folder. This led me to more pouring through code to figure out what was going on and I came up with the problem after awhile of taking it all in.

It seems that when I first was setting up Coppermine and learning how it all functioned, I decided before I got too far into it to delete all my albums and such and essentially start from scratch (or so I thought.. wrong).

I run a 4x4 off roading site and decided that I wanted to organize the pictures within my /albums folders.. so I changed stuff around, renamed some folders and then once I was happy with my folders within /albums, I set about going back into Coppermine and adding all my albums, Galleries and whatnot. My Coppermine galleries work PERFECT, never a missing image or anything weird.

Now factor in this crandom.php. From what I can tell it is reading directly from the database and basically it is finding traces of the very first setup I did within Coppermine, and is attempting to poll images from directories that no longer exist.

Example: In my /albums folder I had used to have a much of folders dated 12-28-05 and similar. When I cleaned up I created folders called Wheeling, Projects, etc..... Well during cleanup I moved that 12-28-05 folder into the Projects folder, and renamed it 12-28-05-weekend to make it easier to figure out when I was batch adding it.

Problem is I have the crandom.php hard coded to only look for random images in the /albums/wheeling folder, yet about 25% of the time it appears to be attempting to pull the folder 12-28-05 folder from there and it doesn't even exist... it is now in /albums/projects/12-28-05-weekend and the script shouldn't even know it ever exists.

So what I came up with it that there are still traces of the very first (tables?) in the database somewhere that Coppermine ignores, but this script somehow sees.

My question (I know finally) is simply this. Is there any kind of script out there that can search the Coppermine database for bad entries/non existant data/pictures and then proceed to prune them out of the database ?

What makes this hard is I have no idea roughly how many entries are in there that are wrong. I have gone into the database via myphpadmin and searched for the file name that the script is attempting to pull hoping to find dulicate entries (one being bad), but I only find one entry. I don't want to delete this because that image is correct, just in a different place.

I am thinking I am going to be stuck creating a whole new database and adding all my images back into it.. which is not exactly something I want to do.

If you want to see this in action here is all the info:

Coppermine is installed here: http://www.truckporn.com/pics

The Crandom.php is here: http://www.truckporn.com/pics/crandom.php
(You may have to hit refresh a few times to get a broken image, or a working one)

My current crandom.php can be found here: http://www.truckporn.com/crandom.zip

Here is a link to the Crandom thread on vbadvanced with my posts around the bottom: http://www.vbadvanced.com/forum/showthread.php?t=1523


Thanks in advance for any help... I know this is a long winded deal.




Glenshadow

Sorry about that.. I just took it down briefly to put a new UPS on. Back online.

Nibbler

You can use the admin tools function 'Reload file dimensions and size information'. That will tell you about any files that don't exist and give you the direct link. You can follow the direct link and delete them from the database using coppermine's deletion functions. Don't make changes directly to the filesystem, as Coppermine will not know about it.

Glenshadow

Man I had some high hopes it was that easy !

I just ran through all 5077 and no problems detected.... well like 3 or 4 updates in the user galleries, but not where I am having the problems.

I am gonna look over the stuff again and maybe try just on the Wheeling gallery.

kegobeer

Perhaps you should look at that script since it appears there are no problems with Coppermine.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

Nibbler

Make sure the script is using the same database details and prefix as Coppermine. Check include/config.inc.php for the details that Coppermine is running under.

Glenshadow

Yeah.. I know. Coppermine just appears to be fine, however I can't explain where this script would be getting the wrong directory structure from.

Wonder if I can get CPMfetch to work in it's place ?


hmmmm...... guess I am gonna have to give that a whirl and see if it resolves the problems. (probably will since it was written for Coppermine)


Glenshadow

Hmmm..... Coppermine says:

// MySQL TABLE NAMES PREFIX
$CONFIG['TABLE_PREFIX'] =                'tpp_';
?>

so tpp_ is my prefix... now I look at the crandom and see this:

$MZresult = @mysql_query("SELECT * FROM tpics_pictures ORDER BY RAND() LIMIT 0,1"); //*** Change the TABLEPREFIX_ to reflect yours ***
if (!$MZresult) {
die('<p>Error performing query: ' . mysql_error() .
'</p>');
}


Changed it to :

$MZresult = @mysql_query("SELECT * FROM tpp_pictures ORDER BY RAND() LIMIT 0,1"); //*** Change the TABLEPREFIX_ to reflect yours ***
if (!$MZresult) {
die('<p>Error performing query: ' . mysql_error() .
'</p>');
}


Now I get this:
Error performing query: Table 'tpics.tpp_pictures' doesn't exist


Let me go look for an orig version of crandom and see if maybe I am reading that wrong.

Nibbler

Check the database name as well ($CONFIG['dbname']).

if (! @mysql_select_db('tpics') ) { //*** Change this to your db name ***

Glenshadow

Well in Coppermine I am using the bridge to my vBulletin.. config database points to my forums.

I went throguh the crandom again and found 2 places that the tableprefix is listed, and it was tpics. That is the database name, so I changed it to match the prefix listed in config.inc.php from coppermine:

// MySQL TABLE NAMES PREFIX
$CONFIG['TABLE_PREFIX'] =                'tpp_';
?>

Now I get:

Error performing query: Table 'tpics.tpp_pictures' doesn't exist

That is weird... worked with the database name as the prefix ?

I also tried removing the word "pictures" and making it just tpp_:
$MZresult = @mysql_query("SELECT * FROM tpp_ ORDER BY RAND() LIMIT 0,1"); //*** Change the TABLEPREFIX_ to reflect yours ***

No dice either.

There is two areas with table prefix, one says tpp_pictures, and the other is tpp_albums


Nibbler

You just make sure the info is exactly the same in both. If you can't do that then try cpmfetch instead.

Glenshadow

interesting......

I went into phpmyadmin and looked at the table prefix which is tpics_ ...so this explains why tpp_ doesn't work.

So I corrected the config.inc.php in coppermine to pics_ instead of tpp_

Well that causd fatal error.

hahahah... I think I am gonna bail and try cpmfetch since Coppermine works otherwise !