Je n'y connais rien en php et je cherche a modifié le script PhpDig version 1.8.8 rc1 pour que le moteur fontionne avec Mysql. Le problème semble venir du fichier robot_functions.php.
Par logique j'ai réussie a déterminier ce qui pose problème
//=================================================
//delete a spider reccord and content file
function phpdigDelSpiderRow($id_connect,$spider_id,$ftp_id='') {
global $relative_script_path,$ftp_id;
$query = "DELETE FROM ".PHPDIG_DB_PREFIX."engine WHERE spider_id=$spider_id";
$result_id = mysql_query($query,$id_connect);
$query = "DELETE FROM ".PHPDIG_DB_PREFIX."spider WHERE spider_id=$spider_id";
$result_id = mysql_query($query,$id_connect);
phpdigDelText($relative_script_path,$spider_id,$ftp_id);
}
//=================================================
//store a content_text from a spider_id
function phpdigWriteText($relative_script_path,$spider_id,$text,$ftp_id='') {
global $br;
if (CONTENT_TEXT == 1) {
$file_text_path = $relative_script_path.'/'.TEXT_CONTENT_PATH.$spider_id.'.txt';
if ($f_handler = @fopen($file_text_path,'wb')) {
$text = phpdigRemoveBreaks(@implode(" ",$text));
$text = phpdigVerifyEnds(mb_substr($text,0,TEXT_STORAGE_AMOUNT));
fwrite($f_handler,$text);
fclose($f_handler);
@chmod($file_text_path,0666);
//here the ftp case
if (FTP_ENABLE) {
$ftp_id = phpdigFtpKeepAlive($ftp_id);
@ftp_delete($ftp_id,$spider_id.'.txt');
$res_ftp = false;
$try_count = 0;
while (!$res_ftp && $try_count++ < 10) {
$res_ftp = @ftp_put($ftp_id,$spider_id.'.txt',$file_text_path,FTP_BINARY);
if (!$res_ftp) {
sleep(2);
}
}
if (!$res_ftp) {
print "Error: ftp_put error ! $br";
}
}
}
else {
print "Warning : Unable to create the content file ! $br";
}
}
return $ftp_id;
}
//=================================================
//delete a content_text from a spider_id
function phpdigDelText($relative_script_path,$spider_id,$ftp_id='') {
if (CONTENT_TEXT == 1) {
$file_text_path = $relative_script_path.'/'.TEXT_CONTENT_PATH.$spider_id.'.txt';
if (@is_file($file_text_path))
@unlink($file_text_path);
//there delete the ftp file
if (FTP_ENABLE && $ftp_id)
@ftp_delete($ftp_id,$spider_id.'.txt');
}
}
//=================================================
//connect to the ftp if the ftp is on and the connection ok.
//the content files are stored locally and could be uploaded
//manually later.
function phpdigFtpConnect()
{
if (CONTENT_TEXT == 1 && FTP_ENABLE == 1) {
$count = 0;
global $br;
while ($count++ < 10) {
//launch connect procedure
if ($ftp_id = ftp_connect(FTP_HOST,FTP_PORT)) {
//login
if (ftp_login ($ftp_id, FTP_USER, FTP_PASS)) {
ftp_pasv ($ftp_id, FTP_PASV);
//echo ftp_pwd($ftp_id);
//change to phpdig directory
if (ftp_chdir ($ftp_id, FTP_PATH)) {
//if content_text doesnt exists, create it
if (!@ftp_chdir ($ftp_id, FTP_TEXT_PATH)) {
ftp_mkdir ($ftp_id, FTP_TEXT_PATH);
ftp_chdir ($ftp_id, FTP_TEXT_PATH);
}
return $ftp_id;
}
}
}
sleep(2);
}
print "Error : Ftp connect failed !".$br;
}
//else return empty string
}
//=================================================
//close the ftp if exists
function phpdigFtpClose($ftp_id) {
if ($ftp_id) {
@ftp_quit($ftp_id);
}
}
//=================================================
//reconnect to ftp if the connexion fails or in case of timout
function phpdigFtpKeepAlive($ftp_id,$relative_script_path=false) {
if (!$ftp_id) {
return phpdigFtpConnect();
}
elseif (!@ftp_pwd($ftp_id)) {
phpdigFtpClose($ftp_id);
return phpdigFtpConnect();
}
else {
@ftp_pasv($ftp_id, FTP_PASV);
if ($relative_script_path) {
phpdigWriteText($relative_script_path,'keepalive',array('.'),$ftp_id);
}
return $ftp_id;
}
}
Avec mon niveau inxistant lol j'ai modifier la deuxième fonctions ainsi
// =============================
// Ecriture dans Mysql
function xunWriteText($relative_script_path,$spider_id,$text,$ftp_id='') {
global $br;
if (CONTENT_TEXT ==1) {
$file_text_path = mysql(" SELECT * FROM 'xuntext_content' ORDER BY 'spider_id' ");
if($f_handler = $file_text_path ) {
reset($text);
while (list($n_chunk,$text_to_store) = each($text)) {
mysql_query(" INSERT INTO xuntext_content (spider_id, content) VALUES ('$spider_id','$text_to_store')", $id_connect);
}
}
// Here the mysql case
if (FTP_ENABLE) {
$ftp_id = xunFtpKeepAlive($ftp_id);
// @delete @ftp_delete($ftp_id,$spider_id.'.txt');
$delete = mysql_query(" DELETE 'xuntext_content' WHERE 'spider_id' = '$spider_id' ");
$res_ftp = false;
$try_count = 0;
while (!$res_ftp && $try_count++ < 10) {
$res_ftp = mysql(" INSERT INTO xuntext_content (spider_id) VALUES ('$spider_id'), $id_connect);
if (!$res_ftp) {
sleep(2);
}
if (!$res_ftp) {
echo 'Unable to wgite in ! $br';
}
}
}
else {
echo 'Warning : Imposible d\'écrire dans Mysql file $file_text_path ! $br';
}
}
return $ftp_id;
}
HELP, HELP 
-----------------------------------
Dirthangel 