Ejemplo n.º 1
0
 /**
  * 调用HttpServer执行
  *
  * @param string $storage
  * @param string $uri
  * @param mixed $arg1
  * @param mixed $arg2
  * @return boolean mixed
  */
 protected static function call_http_host($storage, $uri, $arg1 = null, $arg2 = null)
 {
     $param_arr = func_get_args();
     array_shift($param_arr);
     // 把 $storage 移除
     $sync_mode = File::sync_mode();
     if ($sync_mode == 'rsync') {
         // rsync 模式,调用主服执行
         $action = 'master_exec';
     } else {
         // 全部同步执行
         $action = 'sync_exec';
     }
     $rs = call_user_func_array(array(HttpCall::factory($storage), $action), $param_arr);
     if (IS_DEBUG) {
         Core::debug()->log($rs);
     }
     if (is_array($rs)) {
         $i = 0;
         foreach ($rs as $item) {
             $i++;
             if ($item !== 'success') {
                 if (IS_DEBUG) {
                     Core::debug()->error($i . '/' . count($rs), 'call_http_host rs status');
                 }
                 return false;
             }
         }
     } else {
         if ($rs === 'success') {
             return true;
         } else {
             Core::debug()->error('call_http_host error.');
             return false;
         }
     }
     return $rs;
 }
Ejemplo n.º 2
0
 /**
  * 调用HttpServer执行
  *
  * @param string $storage
  * @param string $uri
  * @param mixed $arg1
  * @param mixed $arg2
  * @return boolean mixed
  */
 protected static function call_http_host($storage, $uri, $arg1 = null, $arg2 = null)
 {
     $param_arr = \func_get_args();
     \array_shift($param_arr);
     // 把 $storage 移除
     $sync_mode = static::sync_mode();
     if ($sync_mode == 'rsync') {
         // rsync 模式,调用主服执行
         $action = 'master_exec';
     } else {
         // 全部同步执行
         $action = 'sync_exec';
     }
     $rs = \call_user_func_array(array(\HttpCall::factory($storage), $action), $param_arr);
     if (\IS_DEBUG) {
         \Core::debug()->log($rs);
     }
     if (\is_array($rs)) {
         foreach ($rs as $item) {
             if ($item !== 'success') {
                 return false;
             }
         }
     } else {
         return $rs === 'success' ? true : false;
     }
     return $rs;
 }