Re: Wiki search broken?

Michael Rozdoba <[email protected]> Sat, 03 Mar 2007 01:05:54 +0000
Newsgroups gmane.comp.handhelds.openzaurus.user
Message-ID <[email protected]>
Scott Bronson wrote:
> You're right!  I spent some time trying to figure out what's going wrong...
> There appear to be a number of problems all piling up:
> 
> - The index may be garbled.  Since Berlios denies access to the php shell
> command, I have no way to run the maintenance scripts to check and 
> reset.  I
> suppose can try to hack around it by writing one-off scripts...  ick.

Ick indeed, but I found it necessary too. Here's a wrapper I've used for 
one of the scripts, which fakes a cli environment well enough to get it 
to work without shell access to php. I can't credit the original source 
as I can't recall it. Maybe it's of some use to you.

<?php
header("content-type: text/plain");
ini_set('html_errors', false);
ini_set('output_buffering', false);
unset($_SERVER['REQUEST_METHOD']);

$some_long_name_no_one_uses_input  = fopen('php://input',  'r');
$some_long_name_no_one_uses_output = fopen('php://output', 'w');

$some_long_name_no_one_uses_script = '../w/maintenance/rebuildMessages.php';

chdir(dirname(__FILE__));

if (!defined('STDIN'))   define('STDIN', 
$some_long_name_no_one_uses_input);
if (!defined('STDOUT'))  define('STDOUT', 
$some_long_name_no_one_uses_output);
if (!defined('STDERR'))  define('STDERR', 
$some_long_name_no_one_uses_output);

ob_implicit_flush(true);

$argv = array( $some_long_name_no_one_uses_script );
foreach($_GET as $key=>$value) {
   if (strlen($value) <= 0) {
     if (strlen($key) <= 1) {
       $argv[] = "-$key";
     } else {
       $argv[] = "--$key";
     }
   } else {
     $argv[] = "--$key=$value";
   }
}
$argc = count($argv);

echo "This uses some dirty hacks to fake CLI. DON'T REFRESH THIS PAGE!\n";
echo "Go:\n";
flush();
include($some_long_name_no_one_uses_script);

fclose($some_long_name_no_one_uses_input);
fclose($some_long_name_no_one_uses_output);
?>

-- 
Michael
m r o z a t u k g a t e w a y d o t n e t

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV