Hi,
Can any one tell me, when zen photo automatically do re-entries for albums & images though its already exist?
i.g. One I have uploaded image & gave proper it's title & description.
But after some time, i have noticed that in my newly added images, old images coming again. because album & images entries are again added to database automatically by zenphoto.
Can any developer guide me how to disable it, I am still using old zen photo.
Regards
Generally zenphoto should only images/albums to the database if you change anything on the filesystem or delete the cache. I don't know where this could come from, but zenphoto before 1.1. had some problems with database garbage problems sometimes. Which version are you using?
Anyway. you should hit the refresh database button in the admin from time to time, best doing it after every upload/change. And you might consider updating...
Is it...
if ($new) {
// Set default data for a new Album (title and parent_id)
$parentalbum = $this->getParent();
$title = strreplace(array('-','','+','~'), ' ', $this->name);
if (!is_null($parentalbum)) {
$this->set('parentid', $parentalbum->getAlbumId());
$title = substr($title, strrpos($title, '/')+1);
}
// echo $this->id;
$this->set('title', $title);
$this->save();
}
Under...
// Constructor
function Album(&$gallery, $folder)
class-album.php??????
&
if ($new) {
$title = substr($this->name, 0, strrpos($this->name, '.'));
if (empty($title)) $title = $this->name;
$this->set('title', $title);
$this->save();
}
Under...
// Constructor
function Image(&$album, $filename)
class-image.php??
or in classes.php
function load() {
// Get the database record for this object.
//echo 'SELECT FROM ' . prefix($this->table) . getWhereClause($this->unique_set) . ' LIMIT 1;';
$entry = query_single_row('SELECT FROM ' . prefix($this->table) .
getWhereClause($this->unique_set) . ' LIMIT 1;');
if (!$entry) {
$this->save();
return true;
} else {
$this->data = $entry;
$this->id = $entry['id'];
// print_r($this->data);
return false;
}
}
If I comment $this->save(); will it affect anywhere else?
You should not mess with these functions. Things may not work correctly.
If you have "orphan" records in your database, use the "refresh the database" button in admin or for individual albums on their edit page.
If you wish to get rid of an old image, you must delete it from your albums folder either through the admin interface or via FTP. Zenphoto will always add back images it finds that are not in the database.
It may possible, sometimes so much parallel connection, in
function load(), query entry = query_single_row('SELECT * FROM ' . prefix($this->table) .
getWhereClause($this->unique_set) . ' LIMIT 1;');
get's fail & next line
if (!$entry) {
$this->save();
return true;
}
get executed, so that duplicate entries are stored in database?