Mediadatabase: Moving pictures

Discussion corner for Developers of Serendipity.
Post Reply
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Mediadatabase: Moving pictures

Post 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..]
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Mediadatabase: Moving pictures

Post by garvinhicking »

Hi!

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

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post 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?
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

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

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post 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.
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post 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..
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

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

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post by blog.brockha.us »

Ahm sorry.. Patch in what way?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post 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.
Post Reply