Amazon PHP SDK minimal files - php

I'm working with the Amazon SDK for PHP, which is a little over 2MB when extracted. I only need the functionality for S3.
Is it possible to extract only the required files for S3 from the SDK and use those? If so, which files do I need?
Thanks

Here's an almost-official answer from the AWS forums:
Hey! This is a feature we've been thinking about better supporting in the future, but right now, there is no official or supported way to do this. That said, I think you might be able to get away with keeping the following files for using only S3:
lib/cachecore/*
lib/dom/*
lib/requestcore/*
sdk.class.php
services/s3.class.php
utilities/*
You could also delete a few more items out of the of the utilities directory like the hadoop ones, manifest, stacktemplate, and stepconfig.
I successfully made a list_buckets call with just these files, but
obviously you are going to want to test all of your API calls to make
sure that they work and that you aren't missing any dependencies that
I might have overlooked. Good luck.

I used this dedicated class before http://undesigned.org.za/2007/10/22/amazon-s3-php-class and it did the job just fine

Related

Is it possible to use Google Cloud Storage CloudStorageTools::serve with PHP Zip?

I have a set of confidential files in Google Cloud Storage that I allow people to download one at a time using CloudStorageTools::serve. It would be more convenient if they could select a group of files and download them in a zip file. I am using PHP with Google App Engine and see that PHP has a ZipArchive class.
I don't see a straightforward way to create a zip file using CloudStorageTools:serve, which for times sake would be my preferred method. If someone knows how to do this, that would be very helpful.
If it's not possible, it would seem a lot of other options may work, from momentarily turning the files into public accessible, which would give them a public URL that I could use to create the zip files. I would prefer to avoid this because of the confidentiality issue. Another option would be to temporarily copy them to a folder in Google App Engine, zip them and then delete them. Again, I have concerns with confidentiality. Both these methods seem somewhat time consuming to setup. So if someone has a faster/better method, I would really appreciate the help. Thanks!

How to change ColdFusion function to a similar PHP function

I am working with some code for uploading images to a server on android. I am working on my local xampp server. I do have Restler and PHP installed on it for REST services at the moment.
I was working modifying the code in this tutorial.
I installed an external jar file for the http client errors. But I cannot install coldfusion as it appears to require a commercial license of some sort and this is what this tutorial is using. As I said, most of the code is in that tutorial besides downloading the latest http client jar file here. What I'm really asking is what alternatives to this cfc function are there? And preferrably what php alternatives are there? Please let me know if I should clarify anything else. Thank You.
Cormac, the only ColdFusion consideration here is that the blogger uses a CFC as a web service within one of their Java classes (it's not great to have a dependency like that in there, but oh well). So what you're gonna need to do is to find out what that web service does, and roll your own. On the basis of the info you have given is, we can't tell you what the web service does... I recommend you touch base with the blogger and ask them. They'll almost certainly flick you the code, and then we can have a look at that if you need further help.

What does Dropbox use for Revision History? How can I add my own?

One of the neater features of Dropbox is that it keeps previous versions of the files you upload.
Part of our site is a similar file repository (customers upload their files to store them offsite), and we'd like to implement a similar feature.
How does Dropbox manage revisions? Do they use some off the shelve revision software that autocommits each file? Or did they just roll their own solution?
I'm hoping there's a 3rd party library I can use for this as it's not the sort of thing we have time to do from scratch ourselves.
Thanks for any help you guys can provide!
More than likely they used a custom solution. Possible methods you can look at are storing a separate file on filesystem for each version, store a separate file in the database for each version, or calculate the diff for the revised file and store that.
The third option is the best as it uses the least space.
Take a look at xdiff_file_bdiff(), it calculates a binary diff of two files (The old version and the new version). The xdiff library should give you the tools you need to do this. You could also look at using something like git for version control, just automate the process using PHP. You'd probably want to run some benchmarks to see what solution works the fastest.

php, own little file manager instead of FTP. Good idea?

Im planning to add file manager (very basic once) because I never used FTP functions, and it looks easier (FTP connection loses when scripts is done). I would simply use POST request (or what should I?) instead of FTP functions. Is it good idea? Anyone knows restrictions?
As far as I can see only FTP functions are to post and receive files.
What you need to do is add dynamic form where you can select multiple files and upload them to specific directory of your chose.
You will need to get all available directories and files in them, probably with some kind of recursive function. More optimal way is to get directories/files of current folder and when you click on folder it will get files/folder for it.
Can it be done - sure. Is it a good idea - no. People will have access for uploading malicious files, we are not talking about images here, php scripts, shell scripts, executable viruses and so on...
If you are doing this only for yourself, for file posting and receiving I suggest you to use FTP clients for that.
I wouldn't recommend it, but it's probably best to use a 3rd party tool, rather than to write your own.
PHP File Manager
PHPfileNavigator2
FileManager
...
Keep in mind that both PHP and your webserver can put certain restrictions on the size of files that you can transfer, it is of course possible to change these in the configuration files.

MediaWiki 1.16.4: Script to upload multiple image files

I am using MediaWiki 1.16.4 and currently have to migrate from a help site using HTML to a new help site with mediawiki. One problem I bump into is to upload a mass amount of images onto mediawiki without using the web interface (since that would take forever and a half). I am currently trying to use pywikipedia (which is a python bot) for the task but haven't succeeded yet. Does any of you happen to know a script for the task?
Thansk,
See the section "Blatant hack" here: http://meta.wikimedia.org/wiki/MediaWiki_Bulk_Page_Creator for a PHP script that does just that.
As with many of those bot scripts, you'll need the PHP Snoopy library available. This script is pretty old and doesn't use the API, so I'm not sure if it will work with the new CSRF protection. If a newer one exists, I haven't found it.
It might be a good idea to rewrite it to use the API, it's not that hard. If you want to do that I have a demo of how to use PHP with cURL to login with the API here: http://www.mediawiki.org/wiki/User:Bcoughlan/Login_with_curl
Try upload.py from the pywikipedia bot framework.
I got so irritated with how the existing tools have massive amounts of code for this simple thing. So I built my own. Including a mass image file uploader (and downloader) in python.
You may need to do a little python hacking because it may not be polished; but it shows how it can be done in just a few lines of code.
The code is here:
https://github.com/gandrewstone/mediawiki_python_bot
So I have found the answer. It turns out that MW 1.16.4 provides its own script for bulk media upload which can be found here: http://www.mediawiki.org/wiki/Manual:ImportImages.php

Categories