Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
HillLiu committed Oct 25, 2021
1 parent 00fb223 commit f5cedae
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 29 deletions.
48 changes: 48 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: 2.1

jobs:
unittest:
parameters:
php-version:
type: string
docker:
- image: hillliu/pmvc-phpunit:<< parameters.php-version >>
working_directory: /var/www/minions
steps:
- checkout
- run:
name: "Display information"
command: |
date
php -v
php -m
composer --version
phpunit --version
- run:
name: Composer install packages
command: |
composer update
composer install --prefer-source
- run:
name: PHPUnit
command: |
ENABLE_COVERAGE=false
if [ "<< parameters.php-version >>" == "8" ] && [ "$ENABLE_COVERAGE" == "true" ]; then
XDEBUG_MODE=coverage phpunit --coverage-clover clover.xml
coveralls --coverage_clover=clover.xml -v -o coveralls-upload.json
else
phpunit
fi
- store_artifacts:
path: /var/www/minions/clover.xml
- store_artifacts:
path: /var/www/minions/coveralls-upload.json

workflows:
run-job:
jobs:
- unittest:
matrix:
name: test-<< matrix.php-version >>
parameters:
php-version: ["8", "5.6"]
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Latest Stable Version](https://poser.pugx.org/pmvc-plugin/minions/v/stable)](https://packagist.org/packages/pmvc-plugin/minions)
[![Latest Unstable Version](https://poser.pugx.org/pmvc-plugin/minions/v/unstable)](https://packagist.org/packages/pmvc-plugin/minions)
[![Build Status](https://travis-ci.org/pmvc-plugin/minions.svg?branch=master)](https://travis-ci.org/pmvc-plugin/minions)
[![CircleCI](https://circleci.com/gh/pmvc-plugin/minions/tree/master.svg?style=svg)](https://circleci.com/gh/pmvc-plugin/minions/tree/master)
[![License](https://poser.pugx.org/pmvc-plugin/minions/license)](https://packagist.org/packages/pmvc-plugin/minions)
[![Total Downloads](https://poser.pugx.org/pmvc-plugin/minions/downloads)](https://packagist.org/packages/pmvc-plugin/minions)

Expand Down
24 changes: 15 additions & 9 deletions src/_ask.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private function ask($minionsServer, $curl, $more = null)
];
\PMVC\dev(function () use (&$curlOptions) {
$curlOptions['--trace'] = 1;
}, 'minions-client-debug');
}, 'debug');
$this->_curl->post(
$host,
function ($r, $curlHelper) use ($callback, $minionsServer, $host) {
Expand Down Expand Up @@ -119,34 +119,40 @@ function () use (
$curlHelper,
$debugs
) {
$debugRespond = clone $r;
$pCurl = \PMVC\plug('curl');
$optUtil = [$pCurl->opt_to_str(), 'all'];
$curlField = $optUtil($curlHelper->set());
$curlField['POSTFIELDS']['cook']['curl'] = $optUtil(
$curlField['POSTFIELDS']['cook']['curl']
);
$more = \PMVC\get($curlField['POSTFIELDS']['cook'], 'more');
$more = \PMVC\get(
$curlField['POSTFIELDS']['cook'],
'more'
);
if (!empty($more)) {
$moreUtil = [$pCurl->info_to_str(), 'one'];
$moreInfo = [];
foreach($more as $mk) {
foreach ($more as $mk) {
$moreInfo[$mk] = $moreUtil($mk);
}
$curlField['POSTFIELDS']['cook']['more'] = $moreInfo;
$curlField['POSTFIELDS']['cook'][
'more'
] = $moreInfo;
}
$body = $pCurl->bodyDev($r->body);
unset($r->info);
unset($r->body);
$body = $pCurl->body_dev($debugRespond->body);
unset($debugRespond->info);
unset($debugRespond->body);
return [
'Minions Client' => $minionsServer,
'Minions Debugs' => $debugs,
'Minions Time' => $serverTime,
'Respond' => \PMVC\get($r),
'Respond' => \PMVC\get($debugRespond),
'Curl Information' => $curlField,
'Body' => $body,
];
},
'minions'
'curl'
);
if (is_callable($callback)) {
call_user_func($callback, $r, $curlHelper, [
Expand Down
9 changes: 6 additions & 3 deletions src/_cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function process($curlRequest, $more, $ttl)
}
\PMVC\dev(
/**
* @help Minions cache status. could use with ?--trace=[curl|curl-json]
* @help Minions cache status. could use with ?--trace=curl
*/
function () use ($r) {
return $r->info();
Expand Down Expand Up @@ -116,7 +116,7 @@ function () use ($r) {

\PMVC\dev(
/**
* @help Minons cache status. could use with ?--trace=[curl|curl-json]
* @help Minons cache status. could use with ?--trace=curl
*/
function () use ($r) {
return $r->info();
Expand Down Expand Up @@ -161,7 +161,10 @@ private function _storeCache($r, $hash, $ttl)
{
$r->createTime = time();
$next = clone $r;
$next->body = urlencode(gzcompress($r->body, 9));
$nextBody = \PMVC\get($r, 'body');
if ($nextBody) {
$next->body = urlencode(gzcompress($nextBody, 9));
}
$this->_db->setCache($ttl);
$this->_db[$hash] = json_encode($next);
}
Expand Down

0 comments on commit f5cedae

Please sign in to comment.