Page 1 of 1

Mediadatabase: Moving pictures

Posted: Tue Jul 03, 2007 3:27 pm
by blog.brockha.us
I have a sugestion: It would be a nice feature, if s9y would scan the articles for image refs after moving medias to another directory and change the refs to the new location, if found.

If this should slow down the performance to much, we could add a new table imagerefs, where imagerefs to article id's are saved (similiar to the references table).

I hope, this was not sugested before..
[And sorry, I'm German: I hope my English was good enough to make my sugestion clear..]

Re: Mediadatabase: Moving pictures

Posted: Tue Jul 03, 2007 3:56 pm
by garvinhicking
Hi!

When you use MySQL, Serendipity does exactly this. It was added for Serendipity 1.2, I believe. :)

Best regards,
Garvin

Posted: Tue Jul 03, 2007 4:03 pm
by blog.brockha.us
COOL! In this moment I am upgrading my s9y 1.1.3 installation to the actual nightly build, as you sugested to me in another thread. I will test this new feature, of course. :-)

I didn't found this change in the NEWS file of the archive. Is there a more complete changelog for the releases?

Posted: Tue Jul 03, 2007 4:10 pm
by blog.brockha.us
Later: Well.. This new feature was introduced in Version 1.1-alpha5() acording to the NEWS file. This means: This feature should work in 1.1.3 but doesn't work for me (although I'm using MySQL on my server). I will check, if I can find out, if I missed some option or something.

Posted: Tue Jul 03, 2007 4:40 pm
by garvinhicking
Hi!

How do you move the media files? Are you using MySQL?

The code is contained in include/functions_images.inc.php, function serendipity_moveMediaDirectory().

HTH,
Garvin

Posted: Tue Jul 03, 2007 4:45 pm
by blog.brockha.us
Later again: I've updated successfully to the nighly build! :-)

But the moving functionality still doesn't work. But whil moving the image to another subdirectory, I get PHP errors (I get them with 1.1.3, too, if I remember correctly):
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/brocken/blog/include/db/mysql.inc.php on line 270

Warning: mysql_select_db() [function.mysql-select-db]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /www/htdocs/brocken/blog/include/db/mysql.inc.php on line 271

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /www/htdocs/brocken/blog/include/db/mysql.inc.php on line 271

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /www/htdocs/brocken/blog/include/db/mysql.inc.php on line 281

Posted: Tue Jul 03, 2007 4:47 pm
by garvinhicking
Hi!

That sounds like a general MySQL problem. Which version are you running? You should check the MySQL error logs.

HTH,
Garvin

Posted: Tue Jul 03, 2007 4:49 pm
by blog.brockha.us
garvinhicking wrote:How do you move the media files? Are you using MySQL?
Yes, I'm using MySQL. I'm moving the image in the "Mediendatenbank". I click the tool button near the image ("properties") change the directory in the editor and save the changes. But: I get MySQL errors as wrote before.

Posted: Tue Jul 03, 2007 4:55 pm
by blog.brockha.us
garvinhicking wrote:That sounds like a general MySQL problem. Which version are you running? You should check the MySQL error logs.
Hmm. I'm using MySQL 5.0.22 (http://blog.brockha.us/infophp.php).

But this is the only place, where I get this error messages ever yet, only while moving images.. After the moving process, the image is moved correctly but the article is not updated. Well.. I guess I can live without that feature allthough I realy would like to have it..

Posted: Tue Jul 03, 2007 5:11 pm
by garvinhicking
Hi!

Could you patch the function i mentioned to see which SQL query is causing the error?

Regards,
Garvin

Posted: Tue Jul 03, 2007 5:38 pm
by blog.brockha.us
Ahm sorry.. Patch in what way?

Posted: Tue Jul 03, 2007 5:49 pm
by garvinhicking
Hi!

Just echo the $sql and other variables that are being sent to serendipity_db_query() inside the function serendipity_moveMediaDirectory() - in your prevoius postings I figured you'Re already quite well with PHP, so maybe you can do that?

Regards,
Garvin

Posted: Tue Jul 03, 2007 6:05 pm
by blog.brockha.us
Yes, of course I can do that. :) Thougt there is some nice PHP directive switching on the dumping of function names or something. :) I'll try that.