I’ve recently been using sc3cmd to back up a lot of data to Amazon S3. Version 1.1.0 (currently in beta) supports multi-part uploads, but it’s still very buggy (I wouldn’t recommend using it yet!), and has borked a few times half way through large uploads, without properly aborting the operation server-side. This meant that the parts uploaded so far were not removed from the server, and that’s bad because Amazon charges for this storage.
s3cmd doesn’t currently have any way to list or abort interrupted multi-part uploads, which meant I had to figure out some other way to do it. It turned out to be quite simple using Python and the boto library:
from boto.s3.connection import S3Connection
connection = S3Connection("your_access_key", "your_secret_key")
bucket = connection.get_bucket("your_s3_bucket_name")
uploads = bucket.get_all_multipart_uploads()
print len(uploads), "incomplete multi-part uploads found."
for u in uploads:
u.cancel_upload()
# If another client is in the process of uploading, then it won't have been cancelled
uploads = bucket.get_all_multipart_uploads()
if len(bucket) > 0
print "Warning: incomplete uploads still exist."
Mocality, a Kenyan online business directory, levelled some pretty serious allegations of misconduct at Google yesterday.
My initial suspicion was that this was most likely to be fraudsters piggybacking on the Google name, but Google’s initial response seems to be an implicit acknowledgement that this activity has indeed originated from Google employees in Kenya and India.
Looks like “do no evil” is taking a real beating this week. What will be interesting is to see how it’s handled from here.
The way WordPress handles commenting on attachments (media) is a bit flaky. The comment status of attachment pages is set to the global default comment status when the media item is attached to a post. After that, there’s no way to change it! Surprising? Yes. There are a couple of truly ancient bug reports related to this, but they’ve received very little attention.
I ran into this issue when working on some of my comment-related plugins. So here’s how to fix it.
If you’re lazy
If you want to just disable comments on all media items, use the Disable Comments plugin.
If you want media items to inherit their comment status from their parent post, use the Comment Control plugin.
If you’re bored :)
To disable comments on all media items, put something like this in your theme’s functions.php file:
function filter_media_comment_status( $open, $post_id ) {
$post = get_post( $post_id );
if( $post->post_type == 'attachment' ) {
return false;
}
return $open;
}
add_filter( 'comments_open', 'filter_media_comment_status', 10 , 2 );
If you want media items to inherit their comment status from their parent post:
function filter_media_comment_status( $open, $post_id ) {
$post = get_post( $post_id );
if( $post->post_type == 'attachment' && $post->post_parent ) {
return comments_open( $post->post_parent );
}
return $open;
}
add_filter( 'comments_open', 'filter_media_comment_status', 10 , 2 );