Re: [Toolserver-l] what's the best way to convert SVGs to PNGs on the toolserver?

2010-02-17 Thread Tim Landscheidt
Ryan Kaldari kald...@gmail.com wrote:

 I tried shell_exec() and exec() instead of system() and it gives the same
 resullt - a zero byte file with no error. Any idea why it would work from
 the command line but not from PHP?

Are you sure there is no error? STDERR is usually discarded
by shell_exec () and similar functions. Try redirecting it
to STDOUT with rsvg some thing 21.

Tim


___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] what's the best way to convert SVGs to PNGs on the toolserver?

2010-02-17 Thread Ryan Kaldari
shell_exec(cat newmap.svg 21);
outputs the svg file to the browser, so it can definitely find the file. I'm
stumped. What's the difference between running rsvg directly from the
command line and executing it from PHP? Perhaps there are some environment
restrictions or something. Has anyone else been able to successfully execute
rsvg from PHP on nightshade?

Ryan Kaldari

On Wed, Feb 17, 2010 at 3:28 PM, Nikola Smolenski smole...@eunet.rs wrote:

 Дана Wednesday 17 February 2010 20:55:28 Ryan Kaldari написа:
  Good idea. The output from rsvg with 21 is Error reading SVG:. I've
  tried using the full path to the SVG and even setting the permissions on
  the file to 777, but I still get the same error. I also tried putting the
  command in a shell script and executing the shell script from PHP, but it
  gives the same results: a zero byte PNG file.

 To me, it seems it can't find the SVG file. Try replacing rsvg with echo to
 see what exactly are you giving it; then try replacing it with cat to see
 if
 anything could find the file.

 ___
 Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
 https://lists.wikimedia.org/mailman/listinfo/toolserver-l
 Posting guidelines for this list:
 https://wiki.toolserver.org/view/Mailing_list_etiquette

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette

Re: [Toolserver-l] SxWiki

2010-02-17 Thread Conrad Irwin
On 02/17/2010 10:09 PM, Ja Ga wrote:
 Is anyone else having problems where login() fails via SxWiki?  I've used it 
 to update a user page for about a year now, and for the first time, it's 
 failing.
 
 - Jason
 

I guess it does not set a User Agent header. Wikimedia now requires this
due to abuse by misbehaving bots.

SxWiki says it is written in PHP, so either set it in your php.ini file,
or add the following somewhere to your version of it:

ini_set( 'user_agent', 'Jason's Bot (using SxWikiPro-0.2-beta)' )

It should be fairly simple to set the user agent for any framework if
I've got the wrong end of the stick, Google is your friend.

Sorry for the inconvenience.
Conrad


___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] SxWiki

2010-02-17 Thread John Doe
Does it set a user agent?

On Wednesday, February 17, 2010, Ja Ga jaga_...@yahoo.com wrote:
 Is anyone else having problems where login() fails via SxWiki?  I've used it 
 to update a user page for about a year now, and for the first time, it's 
 failing.

 - Jason



___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette

Re: [Toolserver-l] SxWiki

2010-02-17 Thread fl
On Thu, 18 Feb 2010 6:09 am, Ja Ga wrote:
 Is anyone else having problems where login() fails via SxWiki?  I've 
 used it to update a user page for about a year now, and for the first 
 time, it's failing.

Changes to the Wikimedia cluster reject scripts without User-Agent 
strings. I presume that is the problem with SxWiki.
___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


[Toolserver-l] Getting lengths of old revisions

2010-02-17 Thread Derrick Coetzee
Hi all,

I've noticed that prior to about April 2007, none of the revisions in
the database stored their rev_len. I assume this was because this
feature was added at this time. Currently, in order to obtain the
rev_len for these revisions I'm using the following function to issue
a HEAD request to the live production wiki:

function get_revision_length($lang, $rev_id) {
  $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
  if (!isset($cached_ip[$lang . .wikipedia.org])) {
$cached_ip[$host] = gethostbyname($lang . .wikipedia.org);
  }
  socket_connect($socket, $cached_ip[$host], 80);
  $request = 'HEAD ' . /w/index.php?oldid= . $revids[$i] .
action=raw . ' HTTP/1.1' . \n .
 'Host: ' . $lang . .wikipedia.org . \n .
 'User-Agent: Mozilla/5.0' . \n .
 'Connection: close' . \n\n;
  socket_send($socket, $request, strlen($request), 0);
  socket_recv($socket, $buffer, 2048, MSG_WAITALL);
  if (preg_match('/Content-Length: ([0-9]+)/', $buffer, $matches)) {
$result = $matches[1];
  } else {
$result = null;
  }
  socket_close($socket);
  return $result;
}

This is not too bad, but still is my app's bottleneck. I had little
luck with Duesentrieb's WikiProxy - it was much slower than this
approach, even just fetching metadata. Is there some other better way?
Is there any plan to update the rev_len fields for old revisions?
Thanks!
-- 
Derrick Coetzee
User:Dcoetzee, En/Commons admin

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] what's the best way to convert SVGs to PNGs on the toolserver?

2010-02-17 Thread Nikola Smolenski
Ryan Kaldari wrote:
 shell_exec(cat newmap.svg 21);
 outputs the svg file to the browser, so it can definitely find the file. 
 I'm stumped. What's the difference between running rsvg directly from 
 the command line and executing it from PHP? Perhaps there are some 
 environment restrictions or something. Has anyone else been able to 
 successfully execute rsvg from PHP on nightshade?

First, even if you wouldn't have these problems, you really should be 
using full paths to files. So, please, /usr/bin/rsvg-convert 
/tmp/whatever/newmap.svg

Second, try strace -e file -f rsvg newmap.svg 21 and if you don't 
see anything useful, the same without -e file. You should see what 
exactly fails in the last lines.

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette