Пример #1
0
  public static function ucscArticleSaveComplete(&$article, 
				 &$user, &$text, &$summary,
				 &$minoredit, &$watchthis, 
				 &$sectionanchor, &$flags, 
				 &$revision)
  {
    $userName = $user->getName();
    $page_id = $article->getTitle()->getArticleID();
    $rev_id = $revision->getID();
    $page_title = $article->getTitle()->getDBkey();

    wfWikiTrustDebug(__FILE__.": ".__LINE__.": New article id $rev_id");
		
    global $wgWikiTrustContentServerURL;

    wfWikiTrustDebug(__FILE__.": ".__LINE__.": ".
       $wgWikiTrustContentServerURL 
                         ."?method=edit"
			 ."&revid=".urlencode($rev_id)
			 ."&pageid=".urlencode($page_id)
			 ."&username="******"&text=".urlencode($text)
			 ."&title=".urlencode($page_title)
			 ."&time=".urlencode(wfTimestampNow()));

      $colored_text = self::file_post_contents($wgWikiTrustContentServerURL 
                         ."?method=edit"
			 ."&revid=".urlencode($rev_id)
			 ."&pageid=".urlencode($page_id)
			 ."&username="******"&text=".urlencode($text)
			 ."&title=".urlencode($page_title)
			 ."&time=".urlencode(wfTimestampNow()));
		
    return true;
  }
Пример #2
0
 /** 
  * Actually run the eval edit program.
  * Returns -1 on error, the process id of the launched eval process 
  * otherwise.
  */
 private static function runEvalEdit($eval_type = self::TRUST_EVAL_EDIT, $rev_id = -1, $page_id = -1, $voter_name = "")
 {
     global $wgDBname, $wgDBuser, $wgDBpassword, $wgDBserver, $wgDBtype, $wgWikiTrustCmd, $wgWikiTrustLog, $wgWikiTrustDebugLog, $wgWikiTrustRepSpeed, $wgDBprefix, $wgWikiTrustCmdExtraArgs, $wgWikiTrustBlobPath, $wgWikiTrustRobots;
     if ($wgWikiTrustBlobPath) {
         $wgWikiTrustCmdExtraArgs .= " -blob_base_path " . $wgWikiTrustBlobPath;
     }
     if ($wgWikiTrustRobots) {
         $wgWikiTrustCmdExtraArgs .= " -robots " . $wgWikiTrustRobots;
     }
     $process = -1;
     $command = "";
     // Get the db.
     $dbr =& wfGetDB(DB_SLAVE);
     // Do we use a DB prefix?
     $prefix = $wgDBprefix ? "-db_prefix " . $dbr->strencode($wgDBprefix) : "";
     switch ($eval_type) {
         case self::TRUST_EVAL_EDIT:
             $command = escapeshellcmd("{$wgWikiTrustCmd} -rep_speed {$wgWikiTrustRepSpeed} -log_file {$wgWikiTrustLog} -db_host {$wgDBserver} -db_user {$wgDBuser} -db_pass {$wgDBpassword} -db_name {$wgDBname} {$prefix} {$wgWikiTrustCmdExtraArgs}") . " &";
             break;
         case self::TRUST_EVAL_VOTE:
             if ($rev_id == -1 || $page_id == -1 || $voter_name == "") {
                 return -1;
             }
             $command = escapeshellcmd("{$wgWikiTrustCmd} -eval_vote -rev_id " . $dbr->strencode($rev_id) . " -voter_name " . $dbr->strencode($voter_name) . " -page_id " . $dbr->strencode($page_id) . " -rep_speed {$wgWikiTrustRepSpeed} -log_file {$wgWikiTrustLog} -db_host {$wgDBserver} -db_user {$wgDBuser} -db_pass {$wgDBpassword} -db_name {$wgDBname} {$prefix} {$wgWikiTrustCmdExtraArgs}") . " &";
             break;
     }
     $descriptorspec = array(0 => array("pipe", "r"), 1 => array("file", escapeshellcmd($wgWikiTrustDebugLog), "a"), 2 => array("file", escapeshellcmd($wgWikiTrustDebugLog), "a"));
     $cwd = '/tmp';
     $env = array();
     wfWikiTrustDebug(__FILE__ . ":" . __LINE__ . ": runEvalEdit: " . $command);
     $process = proc_open($command, $descriptorspec, $pipes, $cwd, $env);
     return $process;
 }