21 lines
717 B
PHP
21 lines
717 B
PHP
<?php
|
|
$f="/opt/wevia-brain/wevia-master-router.php";
|
|
$c=file_get_contents($f);
|
|
if(strpos($c,"opus_persistent_intents")!==false){
|
|
echo "ALREADY HOOKED\n";
|
|
exit;
|
|
}
|
|
$target="source' => 'intent-execution'];";
|
|
$pos=strpos($c,$target);
|
|
if(!$pos){echo "TARGET NOT FOUND\n";exit;}
|
|
$insert=$target."\n \$opus_r = opus_persistent_intents(\$msg, \$base); if (\$opus_r) return \$opus_r;";
|
|
$c=substr($c,0,$pos).$insert.substr($c,$pos+strlen($target));
|
|
file_put_contents($f,$c);
|
|
echo shell_exec("php -l $f 2>&1 | head -1")."\n";
|
|
if(strpos(shell_exec("php -l $f 2>&1"),"No syntax")===false){
|
|
shell_exec("cd /opt/wevia-brain && git checkout -- $f");
|
|
echo "REVERTED (lint fail)\n";
|
|
}else{
|
|
echo "HOOKED OK\n";
|
|
}
|