MediaWiki 1.16.4: Script to upload multiple image files - php

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

Related

In PHP how to deliver website to client without giving them source code

As in JSP we give "WAR" file to clients and it contains .class files and other configuration files but not the source code, is there any way, in PHP, to deliver the project (website) to client without giving them source code.
Facebook created a project called HipHop php, a php compiler.
See this post:
Can you "compile" PHP code?
Short answer, not really.
I mean you can compile php into a single .phar file however anyone with moderate php knowledge can get the code from that.
There are also solutions http://www.ioncube.com/ though I don't know how easily someone can get the code from it however I would strongly advise against any solution like this as they generally require the user of this "compiled" code to you their proprietary software to run it.

Amazon PHP SDK minimal files

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

How to upload files using Ajax and Codeigniter without having Flash support?

I have tried to many javascript plugins but finally had to post this question. Which is the best way to upload files using PHP CodeIgniter framework & Ajax ?
I use Plupload for everything now. Because it is mostly client side driven it runs on any almost any webbrowser and platform(.net,php,etc)
It uses clever ways of detecting browser compatibility; It tries to inject Flash objects or silverlight into the client to allow for functionality such as chunked uploads allowing for uploads greater than 2gb, with speed(kb/s), queue management, etc.
This is truly an amazing uploader.. but it is so under exposed that it took me years to find this. And now my sites (with a bit of perfectionist work) look like Google or Facebook styled uploaders.. FOR FREE!
I've used http://valums.com/ajax-upload/ with great success in a web app. That was over a year ago, though. I used Kohana, not CI, but it's really agnostic on that matter.
ajax does not natively support file uploads. you can achieve this by submitting a form to an iframe and reading the response. there are many plugins available which serves the functionality in an organized way.
use this one :
http://www.phpletter.com/Demo/Tinymce-Ajax-File-Manager/ ;)

Convert webpage (html) to thumbnail/preview for output via PHP file

So i've done a lot of searching on here and Google and haven't seem to come across anything that is known to work or that I think will accomplish what i'm looking to do.
Basically right now i've been using www.thumboo.com to create thumbnails via their API however they do not support SSL and where im creating the preview is under a customer area where SSL is required.
So i'm looking to either develop something myself or find something already developed to use, i would like to create a simple "screenshot" or "thumbnail" of a website address on the fly, not sure if i want to cache it yet or not, but either way doesn't matter.
Does anybody know of any scripts out there that can accomplish this? I'm not looking to get a screenshot of the "entire" page, just what a "browser" would originally see without scrolling down, just like how it works on www.thumboo.com.
I'm not too concerned with the scripting language but i plan on outputting the file using php by pulling the file from somewhere or activating the script with java or php.
Does anybody know of any other thumbnail services that may have an API That works with SSL or any scripts that are still developed for this purpose? Everything i have found has been outdated which makes me wonder if there is some easy way to do it now with some type of function or module i may need to add to PHP.
I am server admin so i can customize PHP and the server as i need to get it to work.
Thanks ahead of time!
http://www.thumbalizr.com/apitools.php
i have never use but seems like this works for you.

How to combine requests for multiple javascript files into one http request?

This concept is a new one for me -- I first came across it at the YUI dependency configurator. Basically, instead of having multiple requests for many files, the files are chained into one http request to cut down on page load time.
Anyone know how to implement this on a LAMP stack? (I saw a similar question was asked already, but it seems to be ASP specific.
Thanks!
Update: Both answers are helpful...(my rep isn't high enough to comment yet so I'm adding some parting thoughts here). I also came across another blog post with PHP-specific examples that might be useful. David's build answer, though, is making me consider a different approach. Thanks, David!
There are various ways, the two most obvious would be:
Build a tool like YUI which builds a bespoke, unique version based on the components you ticked as required so that you can still serve the file as static. MooTools and jQuery UI all provide package-builders like this when you download their package to give you the most streamlined and effecient library possible. I'm sure a generic all purpose tool exists out there.
Create a simple Perl/PHP/Python/Ruby script that serves a bunch of JavaScript files based on the request. So "onerequest.js?load=ui&load=effects" would go to a PHP script that loads in the files and serves them with the correct content-type. There are many examples of this but personally I'm not a fan.
I prefer not to serve static files through any sort of script, but I also like to develop my code with 10 or so seperate small class files without the cost of 10 HTTP requests. So I came up with a custom build process that combines all the most common classes and functions and then minifies them into a single file like project.min.js and have a condition in all my views/templates that includes this file on production.
Edit - The "custom build process" is actually an extremely simple perl script. It reads in each of the files that I've passed as arguments and writes them to a new file, optionally passing the entire thing through JSMIN (available in all your favourite languages) automatically.
At the command like it looks like:
perl build-project-master.pl core.js class1.js etc.js /path/to/live/js/file.js
There is a good blog post on this # http://www.hunlock.com/blogs/Supercharged_Javascript.
What you want is Minify. I just wrote a walkthrough for setting it up.
Capistrano is a fairly popular Ruby-based web deployment tool. If you're considering it or already using it, there's a great gem that will figure out CSS and Javascript dependencies, merge, and minify the files.
gem install juicer
From the Juicer GitHub page, it can figure out which files depend on each other and merge them together, reducing the number of http requests per page view, thus improving performance.

Categories