├── .gitignore
├── vendor
├── workerman
│ ├── workerman
│ │ ├── .gitignore
│ │ ├── Events
│ │ │ ├── React
│ │ │ │ ├── ExtEventLoop.php
│ │ │ │ ├── StreamSelectLoop.php
│ │ │ │ └── ExtLibEventLoop.php
│ │ │ └── EventInterface.php
│ │ ├── composer.json
│ │ ├── Lib
│ │ │ └── Constants.php
│ │ ├── MIT-LICENSE.txt
│ │ ├── Protocols
│ │ │ ├── Frame.php
│ │ │ ├── ProtocolInterface.php
│ │ │ └── Text.php
│ │ ├── Autoloader.php
│ │ └── Connection
│ │ │ └── ConnectionInterface.php
│ └── mysql
│ │ ├── composer.json
│ │ └── README.md
├── smi2
│ └── phpclickhouse
│ │ ├── .gitignore
│ │ ├── phpstan.neon
│ │ ├── example
│ │ ├── 00_config_connect.php
│ │ ├── cluster
│ │ │ ├── 00_config_connect.php
│ │ │ ├── cluster_02_create.php
│ │ │ ├── cluster_05_select_node.php
│ │ │ ├── cluster_06_truncate_table.php
│ │ │ ├── cluster_01_start.php
│ │ │ ├── cluster_03_list.php
│ │ │ ├── cluster_07_test_ddl.php
│ │ │ └── cluster_08_drop_partitions.php
│ │ ├── exam18_log_queries.php
│ │ ├── exam19_readonly_user.php
│ │ ├── exam14_Statistics_in_JSON.php
│ │ ├── exam01_select.php
│ │ ├── exam21_httpS.php
│ │ ├── exam22_PROGRESSFUNCTION.php
│ │ ├── exam04_sql_conditions.php
│ │ ├── exam16_custom_degeneration.php
│ │ ├── exam11_errors.php
│ │ ├── exam10_settings.php
│ │ ├── exam07_where_in.php
│ │ ├── exam20_FormatLine_TSV.php
│ │ ├── exam23_streams.php
│ │ ├── exam15_direct_write_result.php
│ │ ├── exam05_error_async.php
│ │ └── exam09_drop_partitions.php
│ │ ├── src
│ │ ├── Exception
│ │ │ ├── ClickHouseException.php
│ │ │ ├── DatabaseException.php
│ │ │ ├── QueryException.php
│ │ │ ├── TransportException.php
│ │ │ └── UnsupportedParameterType.php
│ │ ├── Query
│ │ │ ├── Degeneration.php
│ │ │ ├── WhereInFile.php
│ │ │ ├── WriteToFile.php
│ │ │ └── Query.php
│ │ ├── Quote
│ │ │ ├── CSV.php
│ │ │ └── FormatLine.php
│ │ └── Transport
│ │ │ ├── IStream.php
│ │ │ ├── StreamRead.php
│ │ │ ├── StreamWrite.php
│ │ │ ├── Stream.php
│ │ │ └── StreamInsert.php
│ │ ├── tests
│ │ ├── docker-compose.yaml
│ │ ├── AsyncSelectTest.php
│ │ ├── JsonTest.php
│ │ ├── ProgressAndEscapeTest.php
│ │ ├── WithClient.php
│ │ ├── TableSizeTest.php
│ │ ├── InsertAssocTest.php
│ │ ├── FormatQueryTest.php
│ │ ├── StrictQuoteLineTest.php
│ │ ├── StreamTest.php
│ │ └── UriTest.php
│ │ ├── phpcs.xml.dist
│ │ ├── composer.json
│ │ ├── LICENSE
│ │ ├── .scrutinizer.yml
│ │ ├── phpunit.xml.dist
│ │ ├── include.php
│ │ └── .travis.yml
├── rmccue
│ └── requests
│ │ ├── .coveralls.yml
│ │ ├── .gitignore
│ │ ├── library
│ │ └── Requests
│ │ │ ├── Exception
│ │ │ ├── Transport.php
│ │ │ ├── HTTP
│ │ │ │ ├── 410.php
│ │ │ │ ├── 409.php
│ │ │ │ ├── 403.php
│ │ │ │ ├── 404.php
│ │ │ │ ├── 304.php
│ │ │ │ ├── 305.php
│ │ │ │ ├── 400.php
│ │ │ │ ├── 401.php
│ │ │ │ ├── 502.php
│ │ │ │ ├── 306.php
│ │ │ │ ├── 406.php
│ │ │ │ ├── 408.php
│ │ │ │ ├── 411.php
│ │ │ │ ├── 501.php
│ │ │ │ ├── 504.php
│ │ │ │ ├── 402.php
│ │ │ │ ├── 405.php
│ │ │ │ ├── 417.php
│ │ │ │ ├── 412.php
│ │ │ │ ├── 503.php
│ │ │ │ ├── 414.php
│ │ │ │ ├── 415.php
│ │ │ │ ├── 500.php
│ │ │ │ ├── 413.php
│ │ │ │ ├── 505.php
│ │ │ │ ├── 407.php
│ │ │ │ ├── 416.php
│ │ │ │ ├── 418.php
│ │ │ │ ├── 428.php
│ │ │ │ ├── 431.php
│ │ │ │ ├── 511.php
│ │ │ │ ├── 429.php
│ │ │ │ └── Unknown.php
│ │ │ ├── Transport
│ │ │ │ └── cURL.php
│ │ │ └── HTTP.php
│ │ │ ├── Hooker.php
│ │ │ ├── Auth.php
│ │ │ ├── Proxy.php
│ │ │ ├── Utility
│ │ │ ├── FilteredIterator.php
│ │ │ └── CaseInsensitiveDictionary.php
│ │ │ ├── Exception.php
│ │ │ ├── Transport.php
│ │ │ ├── Hooks.php
│ │ │ ├── Auth
│ │ │ └── Basic.php
│ │ │ ├── Response
│ │ │ └── Headers.php
│ │ │ └── Response.php
│ │ ├── tests
│ │ ├── Transport
│ │ │ ├── cURL.php
│ │ │ └── fsockopen.php
│ │ ├── utils
│ │ │ └── proxy
│ │ │ │ ├── stop.sh
│ │ │ │ ├── proxy.py
│ │ │ │ └── start.sh
│ │ ├── phpunit.xml.dist
│ │ ├── Response
│ │ │ └── Headers.php
│ │ ├── Auth
│ │ │ └── Basic.php
│ │ ├── Encoding.php
│ │ └── IDNAEncoder.php
│ │ ├── examples
│ │ ├── get.php
│ │ ├── post.php
│ │ ├── basic-auth.php
│ │ ├── cookie.php
│ │ ├── timeout.php
│ │ ├── cookie_jar.php
│ │ ├── proxy.php
│ │ ├── session.php
│ │ └── multiple.php
│ │ ├── composer.json
│ │ ├── docs
│ │ ├── proxy.md
│ │ ├── README.md
│ │ ├── authentication.md
│ │ ├── goals.md
│ │ ├── authentication-custom.md
│ │ ├── usage-advanced.md
│ │ └── hooks.md
│ │ ├── .travis.yml
│ │ ├── bin
│ │ └── create_pear_package.php
│ │ ├── package.xml.tpl
│ │ └── LICENSE
├── autoload.php
└── composer
│ ├── autoload_classmap.php
│ ├── autoload_namespaces.php
│ ├── autoload_psr4.php
│ ├── LICENSE
│ ├── autoload_static.php
│ └── autoload_real.php
├── lib
├── clickhouse.php
├── auth.php
├── app_ws.php
├── db.php
├── kafka.php
└── cache.php
├── config.php
├── proxy.md
├── ws.php
└── api.php
/.gitignore:
--------------------------------------------------------------------------------
1 | *.DS_Store
2 | *.log
3 | *.pid
4 |
--------------------------------------------------------------------------------
/vendor/workerman/workerman/.gitignore:
--------------------------------------------------------------------------------
1 | logs
2 | .buildpath
3 | .project
4 | .settings
5 | .idea
6 | .DS_Store
7 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/.gitignore:
--------------------------------------------------------------------------------
1 | /.phpcs-cache
2 | /phpcs.xml
3 | /phpunit.xml
4 | composer.lock
5 | vendor/
6 | var/
7 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/phpstan.neon:
--------------------------------------------------------------------------------
1 | includes:
2 | # Enable Level 1
3 | - vendor/phpstan/phpstan/conf/config.level1.neon
4 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/.coveralls.yml:
--------------------------------------------------------------------------------
1 | src_dir: library
2 | coverage_clover: tests/clover.xml
3 | json_path: tests/coveralls.json
4 | service_name: travis-ci
--------------------------------------------------------------------------------
/vendor/rmccue/requests/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore coverage report
2 | tests/coverage/*
3 |
4 | # Ignore composer related files
5 | /composer.lock
6 | /vendor
7 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Exception/Transport.php:
--------------------------------------------------------------------------------
1 | 'tabix.dev7', // you hot name
4 | 'port' => '8123',
5 | 'username' => 'default',
6 | 'password' => ''
7 | ];
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/src/Exception/ClickHouseException.php:
--------------------------------------------------------------------------------
1 | 'tabix.dev7', // you hot name
4 | 'port' => '8123',
5 | 'username' => 'default',
6 | 'password' => ''
7 | ];
--------------------------------------------------------------------------------
/vendor/autoload.php:
--------------------------------------------------------------------------------
1 | array($vendorDir . '/rmccue/requests/library'),
10 | );
11 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/src/Quote/CSV.php:
--------------------------------------------------------------------------------
1 | 'application/json'));
11 |
12 | // Check what we received
13 | var_dump($request);
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam18_log_queries.php:
--------------------------------------------------------------------------------
1 | enableLogQueries()->enableHttpCompression();
11 | //----------------------------------------
12 | print_r($db->select('SELECT * FROM system.query_log')->rows());
13 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/examples/post.php:
--------------------------------------------------------------------------------
1 | 'something'));
11 |
12 | // Check what we received
13 | var_dump($request);
--------------------------------------------------------------------------------
/vendor/composer/autoload_psr4.php:
--------------------------------------------------------------------------------
1 | array($vendorDir . '/workerman/mysql/src'),
10 | 'Workerman\\' => array($vendorDir . '/workerman/workerman'),
11 | 'ClickHouseDB\\' => array($vendorDir . '/smi2/phpclickhouse/src'),
12 | );
13 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/src/Transport/IStream.php:
--------------------------------------------------------------------------------
1 | array('someuser', 'password')
12 | );
13 | $request = Requests::get('http://httpbin.org/basic-auth/someuser/password', array(), $options);
14 |
15 | // Check what we received
16 | var_dump($request);
--------------------------------------------------------------------------------
/vendor/workerman/mysql/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "workerman/mysql",
3 | "type" : "library",
4 | "keywords": ["mysql", "pdo", "pdo_mysql"],
5 | "homepage": "http://www.workerman.net",
6 | "license" : "MIT",
7 | "description": "Long-living MySQL connection for daemon.",
8 | "require": {
9 | "php": ">=5.3",
10 | "ext-pdo": "*",
11 | "ext-pdo_mysql": "*"
12 | },
13 | "autoload": {
14 | "psr-4": {"Workerman\\MySQL\\": "./src"}
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/examples/cookie.php:
--------------------------------------------------------------------------------
1 | $c->formatForHeader()));
14 |
15 | // Check what we received
16 | var_dump($request);
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/src/Transport/StreamRead.php:
--------------------------------------------------------------------------------
1 | source, 'zlib.deflate', STREAM_FILTER_READ, ['window' => 30]);
18 | $this->enableGzipHeader();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Exception/HTTP/410.php:
--------------------------------------------------------------------------------
1 | 2.5,
12 | );
13 |
14 | // Now let's make a request to a page that will delay its response by 3 seconds
15 | $request = Requests::get('http://httpbin.org/delay/3', array(), $options);
16 |
17 | // An exception will be thrown, stating a timeout of the request !
18 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Exception/HTTP/306.php:
--------------------------------------------------------------------------------
1 | 'something']);
11 |
12 | // Now let's make a request!
13 | $request = Requests::get(
14 | 'http://httpbin.org/cookies', // Url
15 | [], // No need to set the headers the Jar does this for us
16 | ['cookies' => $c] // Pass in the Jar as an option
17 | );
18 |
19 | // Check what we received
20 | var_dump($request);
--------------------------------------------------------------------------------
/vendor/rmccue/requests/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rmccue/requests",
3 | "description": "A HTTP library written in PHP, for human beings.",
4 | "homepage": "http://github.com/rmccue/Requests",
5 | "license": "ISC",
6 | "keywords": ["http", "idna", "iri", "ipv6", "curl", "sockets", "fsockopen"],
7 | "authors": [
8 | {
9 | "name": "Ryan McCue",
10 | "homepage": "http://ryanmccue.info"
11 | }
12 | ],
13 | "require": {
14 | "php": ">=5.2"
15 | },
16 | "require-dev": {
17 | "requests/test-server": "dev-master"
18 | },
19 | "type": "library",
20 | "autoload": {
21 | "psr-0": {"Requests": "library/"}
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/docs/proxy.md:
--------------------------------------------------------------------------------
1 | Proxy Support
2 | =============
3 |
4 | You can easily make requests through HTTP proxies.
5 |
6 | To make requests through an open proxy, specify the following options:
7 |
8 | ```php
9 | $options = array(
10 | 'proxy' => '127.0.0.1:3128'
11 | );
12 | Requests::get('http://httpbin.org/ip', array(), $options);
13 | ```
14 |
15 | If your proxy needs you to authenticate, the option will become an array like
16 | the following:
17 |
18 | ```php
19 | $options = array(
20 | 'proxy' => array( '127.0.0.1:3128', 'my_username', 'my_password' )
21 | );
22 | Requests::get('http://httpbin.org/ip', array(), $options);
23 | ```
24 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Exception/HTTP/418.php:
--------------------------------------------------------------------------------
1 | getStream(), 'zlib.deflate', STREAM_FILTER_READ, ['window' => 30]);
26 | $this->enableGzipHeader();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/examples/proxy.php:
--------------------------------------------------------------------------------
1 | '127.0.0.1:8080', // syntax: host:port, eg 12.13.14.14:8080 or someproxy.com:3128
12 | // If you need to authenticate, use the following syntax:
13 | // 'proxy' => array( '127.0.0.1:8080', 'username', 'password' ),
14 | );
15 | $request = Requests::get('http://httpbin.org/ip', array(), $options );
16 |
17 | // See result
18 | var_dump($request->body);
19 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Exception/HTTP/428.php:
--------------------------------------------------------------------------------
1 | headers['Accept'] = 'application/json';
12 | $session->useragent = 'Awesomesauce';
13 |
14 | // Now let's make a request!
15 | $request = $session->get('/get');
16 |
17 | // Check what we received
18 | var_dump($request);
19 |
20 | // Let's check our user agent!
21 | $request = $session->get('/user-agent');
22 |
23 | // And check again
24 | var_dump($request);
25 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Exception/HTTP/431.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | src
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/lib/clickhouse.php:
--------------------------------------------------------------------------------
1 | CLICKHOUSE_HOST,
10 | 'port' => CLICKHOUSE_PORT,
11 | 'username' => CLICKHOUSE_USER,
12 | 'password' => CLICKHOUSE_PASS
13 | ];
14 | $db = new ClickHouseDB\Client($config);
15 | $db->database(CLICKHOUSE_DB);
16 | $db->setTimeout(100); // 100 seconds
17 | $db->setConnectTimeOut(10); // 10 seconds
18 | self::$_instance = $db;
19 | }
20 | return self::$_instance;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/vendor/workerman/workerman/Events/React/ExtEventLoop.php:
--------------------------------------------------------------------------------
1 |
10 | * @copyright walkor
11 | * @link http://www.workerman.net/
12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License
13 | */
14 | namespace Workerman\Events\React;
15 |
16 | /**
17 | * Class ExtEventLoop
18 | * @package Workerman\Events\React
19 | */
20 | class ExtEventLoop extends Base
21 | {
22 |
23 | public function __construct()
24 | {
25 | $this->_eventLoop = new \React\EventLoop\ExtEventLoop();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/cluster/cluster_02_create.php:
--------------------------------------------------------------------------------
1 | setScanTimeOut(2.5); // 2500 ms
13 | if (!$cl->isReplicasIsOk())
14 | {
15 | throw new Exception('Replica state is bad , error='.$cl->getError());
16 | }
17 | //
18 | $cluster_name='sharovara';
19 | //
20 | echo "> $cluster_name , count shard = ".$cl->getClusterCountShard($cluster_name)." ; count replica = ".$cl->getClusterCountReplica($cluster_name)."\n";
21 |
22 |
23 |
24 | echo "\n----\nEND\n";
25 | // ----------------------------------------------------------------------
26 |
27 |
--------------------------------------------------------------------------------
/vendor/workerman/workerman/Events/React/StreamSelectLoop.php:
--------------------------------------------------------------------------------
1 |
10 | * @copyright walkor
11 | * @link http://www.workerman.net/
12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License
13 | */
14 | namespace Workerman\Events\React;
15 |
16 | /**
17 | * Class StreamSelectLoop
18 | * @package Workerman\Events\React
19 | */
20 | class StreamSelectLoop extends Base
21 | {
22 | public function __construct()
23 | {
24 | $this->_eventLoop = new \React\EventLoop\StreamSelectLoop();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam19_readonly_user.php:
--------------------------------------------------------------------------------
1 | enableExtremes(true)->enableHttpCompression();
12 | $db->setReadOnlyUser(true);
13 |
14 |
15 | // exec
16 | $db->showDatabases();
17 |
18 | // ----------------------------
19 |
20 |
21 | $db = new ClickHouseDB\Client($config);
22 |
23 | //$db->enableLogQueries()->enableHttpCompression();
24 | //----------------------------------------
25 | //print_r($db->select('SELECT * FROM system.query_log')->rows());
26 |
27 | //----------------------------------------
28 |
29 | $db->enableExtremes(true)->enableHttpCompression();
30 |
31 |
32 |
33 | $db->showDatabases();
34 |
35 | echo "OK?\n";
36 | // ---------
37 |
--------------------------------------------------------------------------------
/lib/auth.php:
--------------------------------------------------------------------------------
1 | uri;
8 | if ($req->_from_ip != '127.0.0.1') {
9 | // verify params
10 | if (!isset($req->params['app_id']) || !isset($_SERVER['HTTP_SIGN'])) {
11 | echo ("No app_id/sign\n");
12 | return [false, ['code' => 1001, 'message' => 'missing app_id, sign']];
13 | }
14 | $app_id = $req->params['app_id'];
15 | $sign = $_SERVER['HTTP_SIGN'];
16 | $secret = PROJECT_ID_SECRETE[$app_id];
17 | // verify sign
18 | $_sign = base64_encode(hash_hmac('sha256', urldecode($uri), $secret, true));
19 | if ($sign !== $_sign) {
20 | echo ("Wrong app_id: " . $app_id . ", sign: " . $sign . "\n");
21 | return [false, ['code' => 1002, 'message' => 'wrong sign']];
22 | }
23 | }
24 | return [true];
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Hooker.php:
--------------------------------------------------------------------------------
1 | 0 is executed later
22 | */
23 | public function register($hook, $callback, $priority = 0);
24 |
25 | /**
26 | * Dispatch a message
27 | *
28 | * @param string $hook Hook name
29 | * @param array $parameters Parameters to pass to callbacks
30 | * @return boolean Successfulness
31 | */
32 | public function dispatch($hook, $parameters = array());
33 | }
--------------------------------------------------------------------------------
/vendor/workerman/workerman/Events/React/ExtLibEventLoop.php:
--------------------------------------------------------------------------------
1 |
10 | * @copyright walkor
11 | * @link http://www.workerman.net/
12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License
13 | */
14 | namespace Workerman\Events\React;
15 | use Workerman\Events\EventInterface;
16 |
17 | /**
18 | * Class ExtLibEventLoop
19 | * @package Workerman\Events\React
20 | */
21 | class ExtLibEventLoop extends Base
22 | {
23 | public function __construct()
24 | {
25 | $this->_eventLoop = new \React\EventLoop\ExtLibeventLoop();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/docs/README.md:
--------------------------------------------------------------------------------
1 | Documentation
2 | =============
3 |
4 | If you're here, you're looking for documentation for Requests! The documents
5 | here are prose; you might also want to check out the [API documentation][].
6 |
7 | [API documentation]: http://requests.ryanmccue.info/api/
8 |
9 | * Introduction
10 | * [Goals][goals]
11 | * [Why should I use Requests instead of X?][why-requests]
12 | * Usage
13 | * [Making a request][usage]
14 | * [Advanced usage][usage-advanced]
15 | * [Authenticating your request][authentication]
16 | * Advanced Usage
17 | * [Custom authentication][authentication-custom]
18 | * [Requests through proxy][proxy]
19 | * [Hooking system][hooks]
20 |
21 | [goals]: goals.md
22 | [why-requests]: why-requests.md
23 | [usage]: usage.md
24 | [usage-advanced]: usage-advanced.md
25 | [authentication]: authentication.md
26 | [authentication-custom]: authentication-custom.md
27 | [hooks]: hooks.md
28 | [proxy]: proxy.md
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Auth.php:
--------------------------------------------------------------------------------
1 | verbose();
11 | $db->settings()->readonly(false);
12 |
13 |
14 | $result = $db->select(
15 | 'SELECT 12 as {key} WHERE {key} = :value',
16 | ['key' => 'ping', 'value' => 12]
17 | );
18 |
19 | if ($result->fetchOne('ping') != 12) {
20 | echo "Error : ? \n";
21 | }
22 |
23 | print_r($result->fetchOne());
24 |
25 |
26 |
27 | echo 'elapsed :'.$result->statistics('elapsed')."\n";
28 | echo 'rows_read :'.$result->statistics('rows_read')."\n";
29 | echo 'bytes_read:'.$result->statistics('bytes_read')."\n";
30 |
31 | //
32 | $result = $db->select("SELECT 12 as ping");
33 |
34 | print_r($result->statistics());
35 | /*
36 | "statistics":
37 | {
38 | "elapsed": 0.000029702,
39 | "rows_read": 1,
40 | "bytes_read": 1
41 | }
42 |
43 | */
44 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam01_select.php:
--------------------------------------------------------------------------------
1 | verbose();
10 | $db->settings()->readonly(false);
11 |
12 |
13 | $result = $db->select(
14 | 'SELECT 12 as {key} WHERE {key} = :value',
15 | ['key' => 'ping', 'value' => 12]
16 | );
17 |
18 | if ($result->fetchOne('ping') != 12) {
19 | echo "Error : ? \n";
20 | }
21 |
22 | print_r($result->fetchOne());
23 |
24 | // ---------------------------- ASYNC SELECT ----------------------------
25 | $state1 = $db->selectAsync('SELECT 1 as {key} WHERE {key} = :value', ['key' => 'ping', 'value' => 1]);
26 | $state2 = $db->selectAsync('SELECT 2 as ping');
27 | $db->executeAsync();
28 |
29 | print_r($state1->fetchOne());
30 | print_r($state1->rows());
31 | print_r($state2->fetchOne('ping'));
32 | //----------------------------------------//----------------------------------------
--------------------------------------------------------------------------------
/config.php:
--------------------------------------------------------------------------------
1 | '2e3b42e53ba480b297cbc0b6f02c451f',
38 | ]);
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam21_httpS.php:
--------------------------------------------------------------------------------
1 | verbose();
9 |
10 | // ---------------------------------------- NO HTTPS ----------------------------------------
11 | $db->select('SELECT 11');
12 |
13 |
14 |
15 | // ---------------------------------------- ADD HTTPS ----------------------------------------
16 | $db->https();
17 |
18 | $db->select('SELECT 11');
19 |
20 |
21 |
22 |
23 | // --------------------- $db->settings()->https(); --------------------------------
24 |
25 | $db = new ClickHouseDB\Client($config);
26 | $db->verbose();
27 | $db->settings()->https();
28 | $db->select('SELECT 11');
29 |
30 |
31 |
32 |
33 | // --------------------- $config['https']=true; --------------------------------
34 |
35 | $config['https']=true;
36 |
37 | $db = new ClickHouseDB\Client($config);
38 | $db->verbose();
39 | $db->select('SELECT 11');
40 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/tests/AsyncSelectTest.php:
--------------------------------------------------------------------------------
1 | client->selectAsync('SELECT {num} as num',['num'=>$f]);
24 | }
25 | $this->client->executeAsync();
26 | for ($f=0;$f<$counter;$f++)
27 | {
28 | $ResultInt=0;
29 | try {
30 | $ResultInt=$list[$f]->fetchOne('num');
31 | } catch (\Exception $E)
32 | {
33 |
34 | }
35 | $this->assertEquals($f, $ResultInt);
36 | }
37 |
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "smi2/phpclickhouse",
3 | "type": "library",
4 | "description": "PHP ClickHouse Client",
5 | "keywords": ["clickhouse", "driver", "client", "curl", "http", "HTTP client", "php"],
6 | "homepage": "https://github.com/smi2/phpClickHouse",
7 | "license": "MIT",
8 | "authors": [
9 | {
10 | "name": "Igor Strykhar",
11 | "email": "isublimity@gmail.com",
12 | "homepage": "https://github.com/isublimity"
13 | }
14 | ],
15 | "require": {
16 | "php": ">=7.0",
17 | "ext-curl": "*"
18 | },
19 | "require-dev": {
20 | "php": "^7.1",
21 | "doctrine/coding-standard": "^4.0",
22 | "phpstan/phpstan": "^0.9.2",
23 | "phpunit/phpunit": "^7",
24 | "sebastian/comparator": "~3.0"
25 | },
26 | "autoload": {
27 | "psr-4": {
28 | "ClickHouseDB\\": "src/"
29 | }
30 | },
31 | "autoload-dev": {
32 | "psr-4": {
33 | "ClickHouseDB\\Tests\\": "tests/",
34 | "ClickHouseDB\\Example\\": "example/"
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/cluster/cluster_05_select_node.php:
--------------------------------------------------------------------------------
1 | setScanTimeOut(2.5); // 2500 ms
13 | $cl->setSoftCheck(true);
14 | if (!$cl->isReplicasIsOk())
15 | {
16 | throw new Exception('Replica state is bad , error='.$cl->getError());
17 | }
18 | //
19 | $cluster_name='sharovara';
20 | //
21 | echo "> $cluster_name , count shard = ".$cl->getClusterCountShard($cluster_name)." ; count replica = ".$cl->getClusterCountReplica($cluster_name)."\n";
22 |
23 |
24 | // Выбрать IP содержащий строку ".248" типа 123.123.123.248, разделитель ; - если не найдена первая берется
25 | $cli=$cl->clientLike($cluster_name,'.298;.964');
26 | $cli->ping();
27 | echo "\n----\nEND\n";
28 | // ----------------------------------------------------------------------
29 |
30 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Utility/FilteredIterator.php:
--------------------------------------------------------------------------------
1 | callback = $callback;
33 | }
34 |
35 | /**
36 | * Get the current item's value after filtering
37 | *
38 | * @return string
39 | */
40 | public function current() {
41 | $value = parent::current();
42 | $value = call_user_func($this->callback, $value);
43 | return $value;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/docs/authentication.md:
--------------------------------------------------------------------------------
1 | Authentication
2 | ==============
3 | Many requests that you make will require authentication of some type. Requests
4 | includes support out of the box for HTTP Basic authentication, with more
5 | built-ins coming soon.
6 |
7 | Making a Basic authenticated call is ridiculously easy:
8 |
9 | ```php
10 | $options = array(
11 | 'auth' => new Requests_Auth_Basic(array('user', 'password'))
12 | );
13 | Requests::get('http://httpbin.org/basic-auth/user/password', array(), $options);
14 | ```
15 |
16 | As Basic authentication is usually what you want when you specify a username
17 | and password, you can also just pass in an array as a shorthand:
18 |
19 | ```php
20 | $options = array(
21 | 'auth' => array('user', 'password')
22 | );
23 | Requests::get('http://httpbin.org/basic-auth/user/password', array(), $options);
24 | ```
25 |
26 | Note that POST/PUT can also take a data parameter, so you also need that
27 | before `$options`:
28 |
29 | ```php
30 | Requests::post('http://httpbin.org/basic-auth/user/password', array(), null, $options);
31 | ```
32 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam22_PROGRESSFUNCTION.php:
--------------------------------------------------------------------------------
1 | settings()->set('max_block_size', 1);
20 |
21 |
22 |
23 |
24 | // ---------------------------------------- ----------------------------------------
25 | $db->progressFunction(function ($data) {
26 | echo "CALL FUNCTION:".json_encode($data)."\n";
27 | });
28 | $st=$db->select('SELECT number,sleep(0.2) FROM system.numbers limit 5');
29 |
30 |
31 | // ---------------------------------------- ----------------------------------------
32 | $db->settings()->set('http_headers_progress_interval_ms', 15); // change interval
33 |
34 | $db->progressFunction(['progress','printz']);
35 | $st=$db->select('SELECT number,sleep(0.1) FROM system.numbers limit 5');
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Exception/HTTP/Unknown.php:
--------------------------------------------------------------------------------
1 | code = $data->status_code;
40 | }
41 |
42 | parent::__construct($reason, $data);
43 | }
44 | }
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/cluster/cluster_06_truncate_table.php:
--------------------------------------------------------------------------------
1 | setScanTimeOut(2.5); // 2500 ms
13 | $cl->setSoftCheck(true);
14 | if (!$cl->isReplicasIsOk())
15 | {
16 | throw new Exception('Replica state is bad , error='.$cl->getError());
17 | }
18 |
19 |
20 | $tables=$cl->getTables();
21 |
22 | foreach ($tables as $dbtable=>$tmp)
23 | {
24 | echo ">>> $dbtable :";
25 |
26 | $size=$cl->getSizeTable($dbtable);
27 |
28 |
29 | echo "\t".\ClickHouseDB\Example\Helper::humanFileSize($size)."\n";
30 |
31 | }
32 |
33 |
34 | $table_for_truncate='target.events_sharded';
35 |
36 | $result=$cl->truncateTable($table_for_truncate);
37 |
38 | echo "Result:truncate table\n";
39 | print_r($result);
40 |
41 | echo "\n----\nEND\n";
42 | // ----------------------------------------------------------------------
43 |
44 |
--------------------------------------------------------------------------------
/vendor/composer/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Copyright (c) Nils Adermann, Jordi Boggiano
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is furnished
9 | to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 |
22 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2016 Smi2, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/tests/JsonTest.php:
--------------------------------------------------------------------------------
1 | client->select('SELECT sin(number) as sin,cos(number) as cos FROM {table_name} LIMIT 2 FORMAT JSONEachRow', ['table_name'=>'system.numbers']);
23 | $checkString='{"sin":0,"cos":1}';
24 | $this->assertContains($checkString,$state->rawData());
25 |
26 |
27 | $state=$this->client->select('SELECT round(4+sin(number),2) as sin,round(4+cos(number),2) as cos FROM {table_name} LIMIT 2 FORMAT JSONCompact', ['table_name'=>'system.numbers']);
28 |
29 | $re=[
30 | [[4,5]],
31 | [[4.84,4.54]]
32 | ];
33 |
34 | // print_r($state->rows());
35 | // print_r($re);
36 | // die();
37 | $this->assertEquals($re,$state->rows());
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam04_sql_conditions.php:
--------------------------------------------------------------------------------
1 | ['2000-10-10', '2000-10-11', '2000-10-12'],
12 | 'limit' => 5,
13 | 'from_table' => 'table'
14 | ];
15 |
16 |
17 | $db->enableQueryConditions();
18 |
19 |
20 | $select = '
21 | SELECT * FROM {from_table}
22 | WHERE
23 | {if select_date}
24 | event_date IN (:select_date)
25 | {else}
26 | event_date=today()
27 | {/if}
28 | {if limit}
29 | LIMIT {limit}
30 | {/if}
31 | ';
32 |
33 | $statement = $db->selectAsync($select, $input_params);
34 | echo $statement->sql();
35 | echo "\n";
36 |
37 | /*
38 | SELECT * FROM table
39 | WHERE
40 | event_date IN ('2000-10-10','2000-10-11','2000-10-12')
41 | LIMIT 5
42 | FORMAT JSON
43 | */
44 |
45 | $input_params['select_date'] = false;
46 |
47 |
48 | $statement = $db->selectAsync($select, $input_params);
49 | echo $statement->sql();
50 | echo "\n";
51 |
52 | /*
53 | SELECT * FROM table
54 | WHERE
55 | event_date=today()
56 | LIMIT 5
57 | FORMAT JSON
58 | */
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Exception/Transport/cURL.php:
--------------------------------------------------------------------------------
1 | type = $type;
35 | }
36 |
37 | if ($code !== null) {
38 | $this->code = $code;
39 | }
40 |
41 | if ($message !== null) {
42 | $this->reason = $message;
43 | }
44 |
45 | $message = sprintf('%d %s', $this->code, $this->reason);
46 | parent::__construct($message, $this->type, $data, $this->code);
47 | }
48 |
49 | /**
50 | * Get the error message
51 | */
52 | public function getReason() {
53 | return $this->reason;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/tests/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Auth
6 |
7 |
8 | Transport
9 |
10 |
11 | Proxy
12 |
13 |
14 | ChunkedEncoding.php
15 | Cookies.php
16 | IDNAEncoder.php
17 | IRI.php
18 | Requests.php
19 | Response/Headers.php
20 | Session.php
21 | SSL.php
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 | .
34 |
35 |
36 | ../library
37 |
38 |
39 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/.scrutinizer.yml:
--------------------------------------------------------------------------------
1 | build:
2 | nodes:
3 | analysis:
4 | environment:
5 | php:
6 | version: 7.1
7 | cache:
8 | disabled: false
9 | directories:
10 | - ~/.composer/cache
11 | project_setup:
12 | override: true
13 | tests:
14 | override:
15 | - php-scrutinizer-run
16 | - phpcs-run
17 |
18 | dependencies:
19 | override:
20 | - composer install --no-interaction --prefer-dist
21 |
22 | checks:
23 | php:
24 | code_rating: true
25 |
26 | tools:
27 | external_code_coverage: true
28 |
29 | build_failure_conditions:
30 | - 'elements.rating(<= C).new.exists' # No new classes/methods with a rating of C or worse allowed
31 | - 'issues.severity(>= MAJOR).new.exists' # New issues of major or higher severity
32 | - 'project.metric_change("scrutinizer.test_coverage", < 0)' # Code Coverage decreased from previous inspection
33 | - 'patches.label("Unused Use Statements").new.exists' # No new unused imports patches allowed
34 |
--------------------------------------------------------------------------------
/vendor/workerman/workerman/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "workerman/workerman",
3 | "type": "library",
4 | "keywords": [
5 | "event-loop",
6 | "asynchronous"
7 | ],
8 | "homepage": "http://www.workerman.net",
9 | "license": "MIT",
10 | "description": "An asynchronous event driven PHP framework for easily building fast, scalable network applications.",
11 | "authors": [
12 | {
13 | "name": "walkor",
14 | "email": "walkor@workerman.net",
15 | "homepage": "http://www.workerman.net",
16 | "role": "Developer"
17 | }
18 | ],
19 | "support": {
20 | "email": "walkor@workerman.net",
21 | "issues": "https://github.com/walkor/workerman/issues",
22 | "forum": "http://wenda.workerman.net/",
23 | "wiki": "http://doc3.workerman.net/index.html",
24 | "source": "https://github.com/walkor/workerman"
25 | },
26 | "require": {
27 | "php": ">=5.3"
28 | },
29 | "suggest": {
30 | "ext-event": "For better performance. "
31 | },
32 | "autoload": {
33 | "psr-4": {
34 | "Workerman\\": "./"
35 | }
36 | },
37 | "minimum-stability": "dev"
38 | }
39 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/docs/goals.md:
--------------------------------------------------------------------------------
1 | Goals
2 | =====
3 |
4 | 1. **Simple interface**
5 |
6 | Requests is designed to provide a simple, unified interface to making
7 | requests, regardless of what is available on the system. This means not worrying.
8 |
9 | 2. **Fully tested code**
10 |
11 | Requests strives to have 90%+ code coverage from the unit tests, aiming for
12 | the ideal 100%. Introducing new features always means introducing new tests
13 |
14 | (Note: some parts of the code are not covered by design. These sections are
15 | marked with `@codeCoverageIgnore` tags)
16 |
17 | 3. **Maximum compatibility**
18 |
19 | No matter what you have installed on your system, you should be able to run
20 | Requests. We use cURL if it's available, and fallback to sockets otherwise.
21 | We require only a baseline of PHP 5.2, leaving the choice of PHP minimum
22 | requirement fully in your hands, and giving you the ability to support many
23 | more hosts.
24 |
25 | 4. **No dependencies**
26 |
27 | Requests is designed to be entirely self-contained and doesn't require
28 | anything else at all. You can run Requests on an entirely stock PHP build
29 | without any additional extensions outside the standard library.
30 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/cluster/cluster_01_start.php:
--------------------------------------------------------------------------------
1 | setScanTimeOut(2.5); // 2500 ms
12 | if (!$cl->isReplicasIsOk())
13 | {
14 | throw new Exception('Replica state is bad , error='.$cl->getError());
15 | }
16 |
17 | echo "Ips:\n";
18 | print_r($cl->getNodes());
19 | echo "getClusterList:\n";
20 | print_r($cl->getClusterList());
21 |
22 | //
23 | foreach (['pulse','repikator','sharovara','repikator3x','sharovara3x'] as $name)
24 | {
25 | echo "-------------------- $name ---------------------------\n";
26 | print_r($cl->getClusterNodes($name));
27 |
28 | echo "> Count Shard = ".$cl->getClusterCountShard($name)."\n";
29 | echo "> Count Replica = ".$cl->getClusterCountReplica($name)."\n";
30 | }
31 | // ----------------------------------------------------------------------
32 | echo "\n----\nEND\n";
33 | // ----------------------------------------------------------------------
34 |
--------------------------------------------------------------------------------
/vendor/workerman/workerman/Lib/Constants.php:
--------------------------------------------------------------------------------
1 |
10 | * @copyright walkor
11 | * @link http://www.workerman.net/
12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License
13 | */
14 |
15 | // Date.timezone
16 | if (!ini_get('date.timezone')) {
17 | date_default_timezone_set('Asia/Shanghai');
18 | }
19 | // Display errors.
20 | ini_set('display_errors', 'on');
21 | // Reporting all.
22 | error_reporting(E_ALL);
23 |
24 | // Reset opcache.
25 | if (function_exists('opcache_reset')) {
26 | opcache_reset();
27 | }
28 |
29 | // For onError callback.
30 | define('WORKERMAN_CONNECT_FAIL', 1);
31 | // For onError callback.
32 | define('WORKERMAN_SEND_FAIL', 2);
33 |
34 | // Define OS Type
35 | define('OS_TYPE_LINUX', 'linux');
36 | define('OS_TYPE_WINDOWS', 'windows');
37 |
38 | // Compatible with php7
39 | if(!class_exists('Error'))
40 | {
41 | class Error extends Exception
42 | {
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/examples/multiple.php:
--------------------------------------------------------------------------------
1 | 'http://httpbin.org/get',
13 | 'headers' => array('Accept' => 'application/javascript'),
14 | ),
15 | 'post' => array(
16 | 'url' => 'http://httpbin.org/post',
17 | 'data' => array('mydata' => 'something'),
18 | ),
19 | 'delayed' => array(
20 | 'url' => 'http://httpbin.org/delay/10',
21 | 'options' => array(
22 | 'timeout' => 20,
23 | ),
24 | ),
25 | );
26 |
27 | // Setup a callback
28 | function my_callback(&$request, $id) {
29 | var_dump($id, $request);
30 | }
31 |
32 | // Tell Requests to use the callback
33 | $options = array(
34 | 'complete' => 'my_callback',
35 | );
36 |
37 | // Send the request!
38 | $responses = Requests::request_multiple($requests, $options);
39 |
40 | // Note: the response from the above call will be an associative array matching
41 | // $requests with the response data, however we've already handled it in
42 | // my_callback() anyway!
43 | //
44 | // If you don't believe me, uncomment this:
45 | # var_dump($responses);
--------------------------------------------------------------------------------
/vendor/workerman/workerman/MIT-LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2009-2015 walkor and contributors (see https://github.com/walkor/workerman/contributors)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/lib/app_ws.php:
--------------------------------------------------------------------------------
1 | map_path[$path] = $callback;
11 | }
12 |
13 | public function onWebSocketConnect($connection , $http_header)
14 | {
15 | // params
16 | $req = new stdClass();
17 | $req->method = $_SERVER['REQUEST_METHOD'];
18 | $req->uri = $_SERVER['REQUEST_URI'];
19 | $req->path = $req->uri;
20 | $pos = stripos($req->path,'?');
21 | if ($pos !== false) {
22 | $req->path = substr($req->path,0,$pos);
23 | }
24 | $connection->path = $req->path;
25 | }
26 |
27 | public function onClientMessage($connection, $data)
28 | {
29 | $cb = $this->map_path[$connection->path];
30 | if ($cb) {
31 | $data = json_decode($data);
32 | $data = call_user_func($cb, $data);
33 | $connection->send(json_encode($data));
34 | } else {
35 | $connection->send(json_encode(array('code' => '404')));
36 | }
37 | }
38 |
39 | public function run()
40 | {
41 | $this->reusePort = true;
42 | $this->onWebSocketConnect = array($this, 'onWebSocketConnect');
43 | $this->onMessage = array($this, 'onClientMessage');
44 | parent::run();
45 | }
46 | }
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam16_custom_degeneration.php:
--------------------------------------------------------------------------------
1 | bindings=$bindings;
15 | }
16 | public function process($sql)
17 | {
18 | if (sizeof($this->bindings))
19 | {
20 | foreach ($this->bindings as $key=>$value)
21 | {
22 | $sql=str_ireplace('%'.$key.'%',$value,$sql);
23 | }
24 | }
25 | return str_ireplace('XXXX','SELECT',$sql);
26 | }
27 | }
28 |
29 |
30 | $config = include_once __DIR__ . '/00_config_connect.php';
31 |
32 |
33 | $db = new ClickHouseDB\Client($config);
34 |
35 | print_r($db->select('SELECT 1 as ping')->fetchOne());
36 |
37 |
38 |
39 | // CustomConditions
40 | $db->addQueryDegeneration(new CustomDegeneration());
41 |
42 |
43 | // strreplace XXXX=>SELECT
44 | print_r($db->select('XXXX 1 as ping')->fetchOne());
45 |
46 |
47 |
48 | // SELECT 1 as ping
49 | print_r($db->select('XXXX 1 as %ZX%',['ZX'=>'ping'])->fetchOne());
50 |
--------------------------------------------------------------------------------
/lib/db.php:
--------------------------------------------------------------------------------
1 | insert($args);
29 | }
30 |
31 | public static function update($args)
32 | {
33 | return DB::getInstance()->update($args);
34 | }
35 |
36 | public static function delete($args)
37 | {
38 | return DB::getInstance()->delete($args);
39 | }
40 |
41 | // Read
42 | public static function select($args)
43 | {
44 | return DB::getReadInstance()->select($args);
45 | }
46 |
47 | public static function query($args)
48 | {
49 | return DB::getReadInstance()->query($args);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/cluster/cluster_03_list.php:
--------------------------------------------------------------------------------
1 | isReplicasIsOk())
13 | {
14 | throw new Exception('Replica state is bad , error='.$cl->getError());
15 | }
16 | $cluster_name='sharovara';
17 |
18 | echo "> $cluster_name , count shard = ".$cl->getClusterCountShard($cluster_name)." ; count replica = ".$cl->getClusterCountReplica($cluster_name)."\n";
19 |
20 |
21 | // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
22 | $nodes=$cl->getNodesByTable('shara.adpreview_body_views_sharded');
23 |
24 | foreach ($nodes as $node)
25 | {
26 | echo "$node > \n";
27 | print_r($cl->client($node)->tableSize('adpreview_body_views_sharded'));
28 | print_r($cl->client($node)->showCreateTable('shara.adpreview_body_views'));
29 | }
30 | // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
31 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/cluster/cluster_07_test_ddl.php:
--------------------------------------------------------------------------------
1 | '172.18.0.8','username'=>'default','password'=>'','port'=>8123]);
12 |
13 | $cl->setScanTimeOut(2.5); // 2500 ms
14 | $cl->setSoftCheck(true);
15 | if (!$cl->isReplicasIsOk())
16 | {
17 | throw new Exception('Replica state is bad , error='.$cl->getError());
18 | }
19 |
20 | print_r($cl->getClusterList());
21 |
22 |
23 | print_r($cl->getNodes());
24 |
25 | print_r($cl->getClusterNodes('cluster'));
26 |
27 |
28 | $cl->activeClient()->setTimeout(0.01);
29 | for ($z=0;$z<50;$z++)
30 | {
31 | try{
32 | $x=$cl->activeClient()->write("DROP TABLE IF EXISTS default.asdasdasd ON CLUSTER cluster2");
33 | }catch (Exception $exception)
34 | {
35 |
36 | }
37 | }
38 |
39 | $cl->activeClient()->setTimeout(22);
40 | $x=$cl->activeClient()->write("DROP TABLE IF EXISTS default.asdasdasd ON CLUSTER cluster2");
41 | $x->dump();
42 |
43 |
44 |
45 | echo "\n----\nEND\n";
46 | // ----------------------------------------------------------------------
47 |
48 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Exception.php:
--------------------------------------------------------------------------------
1 | type = $type;
40 | $this->data = $data;
41 | }
42 |
43 | /**
44 | * Like {@see getCode()}, but a string code.
45 | *
46 | * @codeCoverageIgnore
47 | * @return string
48 | */
49 | public function getType() {
50 | return $this->type;
51 | }
52 |
53 | /**
54 | * Gives any relevant data
55 | *
56 | * @codeCoverageIgnore
57 | * @return mixed
58 | */
59 | public function getData() {
60 | return $this->data;
61 | }
62 | }
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam11_errors.php:
--------------------------------------------------------------------------------
1 | ping();
13 | }
14 | catch (ClickHouseDB\Exception\QueryException $E) {
15 | echo "ERROR:" . $E->getMessage() . "\nOK\n";
16 | }
17 |
18 |
19 | // ------------------
20 |
21 |
22 | $db = new ClickHouseDB\Client([
23 | 'host' => 'NO_DB_HOST.COM',
24 | 'port' => '8123',
25 | 'username' => 'x',
26 | 'password' => 'x'
27 | ]);
28 | $db->setConnectTimeOut(1);
29 | try {
30 | $db->ping();
31 | }
32 | catch (ClickHouseDB\Exception\QueryException $E) {
33 | echo "ERROR:" . $E->getMessage() . "\nOK\n";
34 | }
35 |
36 |
37 | // ------------------
38 |
39 |
40 |
41 | $db = new ClickHouseDB\Client($config);
42 |
43 | try {
44 | $db->ping();
45 | echo "PING : OK!\n";
46 | }
47 | catch (ClickHouseDB\Exception\QueryException $E) {
48 | echo "ERROR:" . $E->getMessage() . "\nOK\n";
49 | }
50 |
51 | try {
52 | $db->select("SELECT xxx as PPPP FROM ZZZZZ ")->rows();
53 | }
54 | catch (ClickHouseDB\Exception\DatabaseException $E) {
55 | echo "ERROR : DatabaseException : " . $E->getMessage() . "\n"; // Table default.ZZZZZ doesn't exist.
56 | }
57 |
58 | // ----------------------------
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/tests/ProgressAndEscapeTest.php:
--------------------------------------------------------------------------------
1 | client->ping();
24 | }
25 |
26 | public function testProgressFunction()
27 | {
28 | global $resultTest;
29 |
30 | $this->client->settings()->set('max_block_size', 1);
31 |
32 | $this->client->progressFunction(function ($data) {
33 | global $resultTest;
34 | $resultTest=$data;
35 | });
36 | $st=$this->client->select('SELECT number,sleep(0.1) FROM system.numbers limit 4');
37 |
38 | // read_rows + read_bytes + total_rows
39 | $this->assertArrayHasKey('read_rows',$resultTest);
40 | $this->assertArrayHasKey('read_bytes',$resultTest);
41 | $this->assertArrayHasKey('total_rows',$resultTest);
42 |
43 | $this->assertGreaterThan(3,$resultTest['read_rows']);
44 | $this->assertGreaterThan(3,$resultTest['read_bytes']);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 | tests
12 |
13 |
14 |
15 |
16 | src
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/src/Quote/FormatLine.php:
--------------------------------------------------------------------------------
1 | quoteRow($row);
37 | }
38 |
39 | /**
40 | * Array to TSV
41 | *
42 | * @param array $row
43 | * @return string
44 | */
45 | public static function TSV(Array $row)
46 | {
47 | return self::strictQuote('TSV')->quoteRow($row);
48 | }
49 |
50 | /**
51 | * Array to CSV
52 | *
53 | * @param array $row
54 | * @return string
55 | */
56 | public static function CSV(Array $row)
57 | {
58 | return self::strictQuote('CSV')->quoteRow($row);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam10_settings.php:
--------------------------------------------------------------------------------
1 | 100]);
11 |
12 | if ($db->settings()->getSetting('max_execution_time') !== 100) {
13 | throw new Exception("Bad work settings");
14 | }
15 |
16 |
17 | // set method
18 | $config = [
19 | 'host' => 'x',
20 | 'port' => '8123',
21 | 'username' => 'x',
22 | 'password' => 'x'
23 | ];
24 |
25 | $db = new ClickHouseDB\Client($config);
26 | $db->settings()->set('max_execution_time', 100);
27 |
28 | if ($db->settings()->getSetting('max_execution_time') !== 100) {
29 | throw new Exception("Bad work settings");
30 | }
31 |
32 |
33 | // apply array method
34 | $config = [
35 | 'host' => 'x',
36 | 'port' => '8123',
37 | 'username' => 'x',
38 | 'password' => 'x'
39 | ];
40 |
41 | $db = new ClickHouseDB\Client($config);
42 | $db->settings()->apply([
43 | 'max_execution_time' => 100,
44 | 'max_block_size' => 12345
45 | ]);
46 |
47 |
48 | if ($db->settings()->getSetting('max_execution_time') !== 100) {
49 | throw new Exception("Bad work settings");
50 | }
51 |
52 | if ($db->settings()->getSetting('max_block_size') !== 12345) {
53 | throw new Exception("Bad work settings");
54 | }
55 |
56 |
57 | echo "getSetting - OK\n";
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Transport.php:
--------------------------------------------------------------------------------
1 | password = $password;
20 | }
21 |
22 | public function register(Requests_Hooks &$hooks) {
23 | $hooks->register('requests.before_request', array(&$this, 'before_request'));
24 | }
25 |
26 | public function before_request(&$url, &$headers, &$data, &$type, &$options) {
27 | $headers['Hotdog'] = $this->password;
28 | }
29 | }
30 | ```
31 |
32 | We then use this in our request calls:
33 |
34 | ```
35 | $options = array(
36 | 'auth' => new MySoftware_Auth_Hotdog('yummy')
37 | );
38 | $response = Requests::get('http://hotdogbin.org/admin', array(), $options);
39 | ```
40 |
41 | (For more information on how to register and use hooks, see the [hooking
42 | system documentation][hooks])
43 |
44 | [hooks]: hooks.md
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/src/Transport/Stream.php:
--------------------------------------------------------------------------------
1 | source = $source;
32 | }
33 |
34 | /**
35 | * @return bool
36 | */
37 | public function isGzipHeader()
38 | {
39 | return $this->gzip;
40 | }
41 |
42 | /**
43 | * @return callable|null
44 | */
45 | public function getClosure()
46 | {
47 | return $this->callable;
48 | }
49 |
50 | /**
51 | * @return resource
52 | */
53 | public function getStream()
54 | {
55 | return $this->source;
56 | }
57 |
58 | /**
59 | * @param callable $callable
60 | */
61 | public function closure(callable $callable)
62 | {
63 | $this->callable=$callable;
64 | }
65 |
66 | /**
67 | *
68 | */
69 | public function enableGzipHeader()
70 | {
71 | $this->gzip=true;
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/tests/WithClient.php:
--------------------------------------------------------------------------------
1 | restartClickHouseClient();
24 | $this->tmpPath = getenv('CLICKHOUSE_TMPPATH') . DIRECTORY_SEPARATOR;
25 | }
26 |
27 | public function restartClickHouseClient()
28 | {
29 | $config = [
30 | 'host' => getenv('CLICKHOUSE_HOST'),
31 | 'port' => getenv('CLICKHOUSE_PORT'),
32 | 'username' => getenv('CLICKHOUSE_USER'),
33 | 'password' => getenv('CLICKHOUSE_PASSWORD'),
34 |
35 | ];
36 |
37 | $this->client = new Client($config);
38 | $databaseName = getenv('CLICKHOUSE_DATABASE');
39 | if (!$databaseName || $databaseName==='default') {
40 | throw new \Exception('Change CLICKHOUSE_DATABASE, not use default');
41 | }
42 | if (empty($GLOBALS['phpCH_needFirstCreateDB'])) { // hack use Global VAR, for once create DB
43 | $GLOBALS['phpCH_needFirstCreateDB']=true;
44 | $this->client->write(sprintf('DROP DATABASE IF EXISTS "%s"', $databaseName));
45 | $this->client->write(sprintf('CREATE DATABASE "%s"', $databaseName));
46 | }
47 | // Change Database
48 | $this->client->database($databaseName);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/include.php:
--------------------------------------------------------------------------------
1 |
10 | * @copyright walkor
11 | * @link http://www.workerman.net/
12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License
13 | */
14 | namespace Workerman\Protocols;
15 |
16 | use Workerman\Connection\TcpConnection;
17 |
18 | /**
19 | * Frame Protocol.
20 | */
21 | class Frame
22 | {
23 | /**
24 | * Check the integrity of the package.
25 | *
26 | * @param string $buffer
27 | * @param TcpConnection $connection
28 | * @return int
29 | */
30 | public static function input($buffer, TcpConnection $connection)
31 | {
32 | if (strlen($buffer) < 4) {
33 | return 0;
34 | }
35 | $unpack_data = unpack('Ntotal_length', $buffer);
36 | return $unpack_data['total_length'];
37 | }
38 |
39 | /**
40 | * Decode.
41 | *
42 | * @param string $buffer
43 | * @return string
44 | */
45 | public static function decode($buffer)
46 | {
47 | return substr($buffer, 4);
48 | }
49 |
50 | /**
51 | * Encode.
52 | *
53 | * @param string $buffer
54 | * @return string
55 | */
56 | public static function encode($buffer)
57 | {
58 | $total_length = 4 + strlen($buffer);
59 | return pack('N', $total_length) . $buffer;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 | matrix:
3 | fast_finish: true
4 | include:
5 | - php: 5.2
6 | - php: 5.3
7 | - php: 5.4
8 | - php: 5.5
9 | - php: 5.6
10 | env: TEST_COVERAGE=1
11 | - php: 7.0
12 | - php: hhvm
13 |
14 | # Use new container infrastructure
15 | sudo: false
16 |
17 | cache:
18 | directories:
19 | - $HOME/.cache/pip
20 | - $HOME/.composer/cache
21 | - vendor
22 |
23 | install:
24 | # Setup the test server
25 | - phpenv local 5.5
26 | - composer install --dev --no-interaction
27 | - TESTPHPBIN=$(phpenv which php)
28 | - phpenv local --unset
29 |
30 | # Setup the proxy
31 | - pip install --user mitmproxy~=0.15
32 |
33 | before_script:
34 | - PHPBIN=$TESTPHPBIN PORT=8080 vendor/bin/start.sh
35 | - export REQUESTS_TEST_HOST_HTTP="localhost:8080"
36 |
37 | # Work out of the tests directory
38 | - cd tests
39 | - PROXYBIN="$HOME/.local/bin/mitmdump" PORT=9002 utils/proxy/start.sh
40 | - PROXYBIN="$HOME/.local/bin/mitmdump" PORT=9003 AUTH="test:pass" utils/proxy/start.sh
41 | - export REQUESTS_HTTP_PROXY="localhost:9002"
42 | - export REQUESTS_HTTP_PROXY_AUTH="localhost:9003"
43 | - export REQUESTS_HTTP_PROXY_AUTH_USER="test"
44 | - export REQUESTS_HTTP_PROXY_AUTH_PASS="pass"
45 |
46 | # Ensure the HTTPS test instance on Heroku is spun up
47 | - curl -s -I http://requests-php-tests.herokuapp.com/ > /dev/null
48 |
49 | script:
50 | - phpunit --coverage-clover clover.xml
51 |
52 | after_script:
53 | - utils/proxy/stop.sh
54 | - cd ..
55 | - phpenv local 5.5
56 | - PATH=$PATH vendor/bin/stop.sh
57 | - test $TEST_COVERAGE && bash <(curl -s https://codecov.io/bash)
58 | - phpenv local --unset
59 |
--------------------------------------------------------------------------------
/ws.php:
--------------------------------------------------------------------------------
1 | count = 4;
7 | $wsapp->name = 'ws';
8 |
9 | $wsapp->on('/', function($params) {
10 | return array('code' => '200');
11 | });
12 |
13 | $wsapp->on('/api', function($params) {
14 | if ($params->action == 'subscribe') {
15 | return $params;
16 | }
17 | return array('code' => '404');
18 | });
19 |
20 | WSApp::runAll();
21 |
22 | // JavaScript Client
23 | // var ws = new WebSocket('ws://127.0.0.1:2000/');
24 | // ws.onopen = function(e) {
25 | // console.log("[onopen]"+e);
26 | // var data = {
27 | // action: 'aaa',
28 | // params: {
29 | // a: 111,
30 | // b: 'abc'
31 | // }
32 | // }
33 | // ws.send(JSON.stringify(data));
34 | // }
35 | // ws.onmessage = function(e) {
36 | // console.log("[onmessage]"+e.data);
37 | // }
38 | // ws.onclose = function(e) {
39 | // console.log("[onclose]"+e);
40 | // }
41 | // ws.onerror = function(e) {
42 | // console.log("[onerror]"+e);
43 | // }
44 |
45 | // var ws = new WebSocket('ws://127.0.0.1:2000/api');
46 | // ws.onopen = function(e) {
47 | // console.log("[onopen]"+e);
48 | // var data = {
49 | // action: 'subscribe',
50 | // params: {
51 | // a: 111,
52 | // b: 'abc'
53 | // }
54 | // }
55 | // ws.send(JSON.stringify(data));
56 | // }
57 | // ws.onmessage = function(e) {
58 | // console.log("[onmessage]"+e.data);
59 | // }
60 | // ws.onclose = function(e) {
61 | // console.log("[onclose]"+e);
62 | // }
63 | // ws.onerror = function(e) {
64 | // console.log("[onerror]"+e);
65 | // }
--------------------------------------------------------------------------------
/api.php:
--------------------------------------------------------------------------------
1 | count = 8;
10 | $app->name = 'api';
11 |
12 | $app->onWorkerStart = function ($worker) {
13 | require_once __DIR__ . '/lib/auth.php';
14 | require_once __DIR__ . '/lib/db.php';
15 | require_once __DIR__ . '/lib/clickhouse.php';
16 | require_once __DIR__ . '/lib/cache.php';
17 | require_once __DIR__ . '/lib/kafka.php';
18 | require_once __DIR__ . '/config.php';
19 | ini_set("precision", "-1");
20 | ini_set("serialize_precision", "-1");
21 |
22 | echo "[" . date('Y-m-d H:i:s') . "] Worker start[" . $worker->id . "]\n";
23 | };
24 |
25 | ///////////////////////////////// API接口定义开始
26 |
27 | $app->get('/', function ($req) {
28 | return 'OK';
29 | });
30 |
31 | $app->post('/', function ($req) {
32 | return 'OK';
33 | });
34 |
35 | $app->get('/health/check', function ($req) {
36 | return 'OK';
37 | });
38 |
39 | $app->before('/api', function ($req) {
40 | return Auth::verify_api($req);
41 | });
42 |
43 | $app->get('/tables', function ($req) {
44 | if (CACHE::exists('tables')) {
45 | return json_decode(CACHE::get('tables'));
46 | } else {
47 | $tables = DB::query('show tables');
48 | CACHE::set('tables', json_encode($tables), 5);
49 | return json_decode(CACHE::get('tables'));
50 | }
51 | });
52 |
53 | ///////////////////////////////// API接口定义结束
54 |
55 |
56 | App::$logFile = './logs/workerman_api.log';
57 | App::$stdoutFile = './logs/api.log';
58 |
59 | App::runAll();
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Hooks.php:
--------------------------------------------------------------------------------
1 | 0 is executed later
36 | */
37 | public function register($hook, $callback, $priority = 0) {
38 | if (!isset($this->hooks[$hook])) {
39 | $this->hooks[$hook] = array();
40 | }
41 | if (!isset($this->hooks[$hook][$priority])) {
42 | $this->hooks[$hook][$priority] = array();
43 | }
44 |
45 | $this->hooks[$hook][$priority][] = $callback;
46 | }
47 |
48 | /**
49 | * Dispatch a message
50 | *
51 | * @param string $hook Hook name
52 | * @param array $parameters Parameters to pass to callbacks
53 | * @return boolean Successfulness
54 | */
55 | public function dispatch($hook, $parameters = array()) {
56 | if (empty($this->hooks[$hook])) {
57 | return false;
58 | }
59 |
60 | foreach ($this->hooks[$hook] as $priority => $hooked) {
61 | foreach ($hooked as $callback) {
62 | call_user_func_array($callback, $parameters);
63 | }
64 | }
65 |
66 | return true;
67 | }
68 | }
--------------------------------------------------------------------------------
/vendor/rmccue/requests/tests/Response/Headers.php:
--------------------------------------------------------------------------------
1 | assertEquals('text/plain', $headers['Content-Type']);
9 | }
10 | public function testCaseInsensitiveArrayAccess() {
11 | $headers = new Requests_Response_Headers();
12 | $headers['Content-Type'] = 'text/plain';
13 |
14 | $this->assertEquals('text/plain', $headers['CONTENT-TYPE']);
15 | $this->assertEquals('text/plain', $headers['content-type']);
16 | }
17 |
18 | /**
19 | * @depends testArrayAccess
20 | */
21 | public function testIteration() {
22 | $headers = new Requests_Response_Headers();
23 | $headers['Content-Type'] = 'text/plain';
24 | $headers['Content-Length'] = 10;
25 |
26 | foreach ($headers as $name => $value) {
27 | switch (strtolower($name)) {
28 | case 'content-type':
29 | $this->assertEquals('text/plain', $value);
30 | break;
31 | case 'content-length':
32 | $this->assertEquals(10, $value);
33 | break;
34 | default:
35 | throw new Exception('Invalid name: ' . $name);
36 | }
37 | }
38 | }
39 |
40 | /**
41 | * @expectedException Requests_Exception
42 | */
43 | public function testInvalidKey() {
44 | $headers = new Requests_Response_Headers();
45 | $headers[] = 'text/plain';
46 | }
47 |
48 | public function testMultipleHeaders() {
49 | $headers = new Requests_Response_Headers();
50 | $headers['Accept'] = 'text/html;q=1.0';
51 | $headers['Accept'] = '*/*;q=0.1';
52 |
53 | $this->assertEquals('text/html;q=1.0,*/*;q=0.1', $headers['Accept']);
54 | }
55 | }
--------------------------------------------------------------------------------
/vendor/composer/autoload_static.php:
--------------------------------------------------------------------------------
1 |
11 | array (
12 | 'Workerman\\MySQL\\' => 16,
13 | 'Workerman\\' => 10,
14 | ),
15 | 'C' =>
16 | array (
17 | 'ClickHouseDB\\' => 13,
18 | ),
19 | );
20 |
21 | public static $prefixDirsPsr4 = array (
22 | 'Workerman\\MySQL\\' =>
23 | array (
24 | 0 => __DIR__ . '/..' . '/workerman/mysql/src',
25 | ),
26 | 'Workerman\\' =>
27 | array (
28 | 0 => __DIR__ . '/..' . '/workerman/workerman',
29 | ),
30 | 'ClickHouseDB\\' =>
31 | array (
32 | 0 => __DIR__ . '/..' . '/smi2/phpclickhouse/src',
33 | ),
34 | );
35 |
36 | public static $prefixesPsr0 = array (
37 | 'R' =>
38 | array (
39 | 'Requests' =>
40 | array (
41 | 0 => __DIR__ . '/..' . '/rmccue/requests/library',
42 | ),
43 | ),
44 | );
45 |
46 | public static function getInitializer(ClassLoader $loader)
47 | {
48 | return \Closure::bind(function () use ($loader) {
49 | $loader->prefixLengthsPsr4 = ComposerStaticInit69a2fae334d91f62c7fef4b45f917045::$prefixLengthsPsr4;
50 | $loader->prefixDirsPsr4 = ComposerStaticInit69a2fae334d91f62c7fef4b45f917045::$prefixDirsPsr4;
51 | $loader->prefixesPsr0 = ComposerStaticInit69a2fae334d91f62c7fef4b45f917045::$prefixesPsr0;
52 |
53 | }, null, ClassLoader::class);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Exception/HTTP.php:
--------------------------------------------------------------------------------
1 | reason = $reason;
40 | }
41 |
42 | $message = sprintf('%d %s', $this->code, $this->reason);
43 | parent::__construct($message, 'httpresponse', $data, $this->code);
44 | }
45 |
46 | /**
47 | * Get the status message
48 | */
49 | public function getReason() {
50 | return $this->reason;
51 | }
52 |
53 | /**
54 | * Get the correct exception class for a given error code
55 | *
56 | * @param int|bool $code HTTP status code, or false if unavailable
57 | * @return string Exception class name to use
58 | */
59 | public static function get_class($code) {
60 | if (!$code) {
61 | return 'Requests_Exception_HTTP_Unknown';
62 | }
63 |
64 | $class = sprintf('Requests_Exception_HTTP_%d', $code);
65 | if (class_exists($class)) {
66 | return $class;
67 | }
68 |
69 | return 'Requests_Exception_HTTP_Unknown';
70 | }
71 | }
--------------------------------------------------------------------------------
/vendor/workerman/workerman/Protocols/ProtocolInterface.php:
--------------------------------------------------------------------------------
1 |
10 | * @copyright walkor
11 | * @link http://www.workerman.net/
12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License
13 | */
14 | namespace Workerman\Protocols;
15 |
16 | use Workerman\Connection\ConnectionInterface;
17 |
18 | /**
19 | * Protocol interface
20 | */
21 | interface ProtocolInterface
22 | {
23 | /**
24 | * Check the integrity of the package.
25 | * Please return the length of package.
26 | * If length is unknow please return 0 that mean wating more data.
27 | * If the package has something wrong please return false the connection will be closed.
28 | *
29 | * @param ConnectionInterface $connection
30 | * @param string $recv_buffer
31 | * @return int|false
32 | */
33 | public static function input($recv_buffer, ConnectionInterface $connection);
34 |
35 | /**
36 | * Decode package and emit onMessage($message) callback, $message is the result that decode returned.
37 | *
38 | * @param ConnectionInterface $connection
39 | * @param string $recv_buffer
40 | * @return mixed
41 | */
42 | public static function decode($recv_buffer, ConnectionInterface $connection);
43 |
44 | /**
45 | * Encode package brefore sending to client.
46 | *
47 | * @param ConnectionInterface $connection
48 | * @param mixed $data
49 | * @return string
50 | */
51 | public static function encode($data, ConnectionInterface $connection);
52 | }
53 |
--------------------------------------------------------------------------------
/lib/kafka.php:
--------------------------------------------------------------------------------
1 | set('queue.buffering.max.kbytes', 2000000);
13 | $conf->set('queue.buffering.max.messages', 1000000);
14 | $rk = new RdKafka\Producer($conf);
15 | $rk->setLogLevel(LOG_DEBUG);
16 | $rk->addBrokers(Kafka::$brokers);
17 | self::$_producer = $rk;
18 | }
19 | return self::$_producer;
20 | }
21 |
22 | public static function getConsumer()
23 | {
24 | if (!isset(self::$_consumer)) {
25 | $rk = new RdKafka\Consumer();
26 | $rk->setLogLevel(LOG_DEBUG);
27 | $rk->addBrokers(Kafka::$brokers);
28 | self::$_consumer = $rk;
29 | }
30 | return self::$_consumer;
31 | }
32 |
33 | public static function produce($topic, $message)
34 | {
35 | if (defined('KAFKA_BROKERS')) {
36 | $rk = Kafka::getProducer();
37 | $topic = $rk->newTopic($topic);
38 | $topic->produce(RD_KAFKA_PARTITION_UA, 0, $message);
39 | }
40 | }
41 |
42 | public static function consume($topic, $offset = RD_KAFKA_OFFSET_END)
43 | {
44 | if (defined('KAFKA_BROKERS')) {
45 | $has_consumer = isset(self::$_consumer);
46 | $rk = Kafka::getConsumer();
47 | $topic = $rk->newTopic($topic);
48 | if (!$has_consumer) {
49 | $topic->consumeStart(0, $offset);
50 | }
51 | $msg = $topic->consume(0, 1000);
52 | if ($msg and $msg->payload) {
53 | return $msg->payload;
54 | }
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/cluster/cluster_08_drop_partitions.php:
--------------------------------------------------------------------------------
1 | settings()->set('replication_alter_partitions_sync',2);
13 | $db->settings()->set('experimental_allow_extended_storage_definition_syntax',1);
14 |
15 |
16 | for ( $looop=1;$looop<100;$looop++)
17 | {
18 |
19 | $db->write("DROP TABLE IF EXISTS testoperation_log");
20 | $db->write("
21 | CREATE TABLE IF NOT EXISTS `testoperation_log` (
22 | `event_date` Date default toDate(time),
23 | `event` String DEFAULT '',
24 | `time` DateTime default now()
25 | ) ENGINE=MergeTree ORDER BY time PARTITION BY event_date
26 |
27 | ");
28 |
29 | echo "INSERT DATA....\n";
30 | for ($z=0;$z<1000;$z++)
31 | {
32 | $dataInsert=['time'=>strtotime('-'.mt_rand(0,4000).' day'),'event'=>strval($z)];
33 | try {
34 | $db->insertAssocBulk('testoperation_log',$dataInsert);
35 | echo "$z\r";
36 | }
37 | catch (Exception $exception)
38 | {
39 | die("Error:".$exception->getMessage());
40 | }
41 |
42 | }
43 | echo "INSER OK\n DROP PARTITION...\n";
44 |
45 | $partitons=($db->partitions('testoperation_log'));
46 | foreach ($partitons as $part)
47 | {
48 | echo "$looop\t\t".$part['partition']."\t".$part['name']."\t".$part['active']."\r";
49 |
50 | $db->dropPartition('default.testoperation_log',$part['partition']);
51 | }
52 | echo "SELECT count() ...".str_repeat(" ",300)."\n";
53 | print_r($db->select('SELECT count() FROM default.testoperation_log')->rows());
54 | }
55 |
56 | echo "\n----\nEND\n";
57 | // ----------------------------------------------------------------------
58 |
59 |
--------------------------------------------------------------------------------
/vendor/composer/autoload_real.php:
--------------------------------------------------------------------------------
1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27 | if ($useStaticLoader) {
28 | require_once __DIR__ . '/autoload_static.php';
29 |
30 | call_user_func(\Composer\Autoload\ComposerStaticInit69a2fae334d91f62c7fef4b45f917045::getInitializer($loader));
31 | } else {
32 | $map = require __DIR__ . '/autoload_namespaces.php';
33 | foreach ($map as $namespace => $path) {
34 | $loader->set($namespace, $path);
35 | }
36 |
37 | $map = require __DIR__ . '/autoload_psr4.php';
38 | foreach ($map as $namespace => $path) {
39 | $loader->setPsr4($namespace, $path);
40 | }
41 |
42 | $classMap = require __DIR__ . '/autoload_classmap.php';
43 | if ($classMap) {
44 | $loader->addClassMap($classMap);
45 | }
46 | }
47 |
48 | $loader->register(true);
49 |
50 | return $loader;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/vendor/workerman/workerman/Protocols/Text.php:
--------------------------------------------------------------------------------
1 |
10 | * @copyright walkor
11 | * @link http://www.workerman.net/
12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License
13 | */
14 | namespace Workerman\Protocols;
15 |
16 | use Workerman\Connection\TcpConnection;
17 |
18 | /**
19 | * Text Protocol.
20 | */
21 | class Text
22 | {
23 | /**
24 | * Check the integrity of the package.
25 | *
26 | * @param string $buffer
27 | * @param TcpConnection $connection
28 | * @return int
29 | */
30 | public static function input($buffer, TcpConnection $connection)
31 | {
32 | // Judge whether the package length exceeds the limit.
33 | if (strlen($buffer) >= $connection::$maxPackageSize) {
34 | $connection->close();
35 | return 0;
36 | }
37 | // Find the position of "\n".
38 | $pos = strpos($buffer, "\n");
39 | // No "\n", packet length is unknown, continue to wait for the data so return 0.
40 | if ($pos === false) {
41 | return 0;
42 | }
43 | // Return the current package length.
44 | return $pos + 1;
45 | }
46 |
47 | /**
48 | * Encode.
49 | *
50 | * @param string $buffer
51 | * @return string
52 | */
53 | public static function encode($buffer)
54 | {
55 | // Add "\n"
56 | return $buffer . "\n";
57 | }
58 |
59 | /**
60 | * Decode.
61 | *
62 | * @param string $buffer
63 | * @return string
64 | */
65 | public static function decode($buffer)
66 | {
67 | // Remove "\n"
68 | return trim($buffer);
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/tests/TableSizeTest.php:
--------------------------------------------------------------------------------
1 | client->write(' DROP TABLE IF EXISTS ' . $table_name_A . ' ; ');
25 | $this->client->write(' DROP TABLE IF EXISTS ' . $table_name_B . ' ; ');
26 | $this->client->write(' CREATE TABLE ' . $table_name_A . ' (number UInt64) ENGINE = Log;');
27 | $this->client->write(' CREATE TABLE ' . $table_name_B . ' (number UInt64) ENGINE = Log;');
28 | $this->client->write(' INSERT INTO ' . $table_name_A . ' SELECT number FROM system.numbers LIMIT 30');
29 | $this->client->write(' INSERT INTO ' . $table_name_B . ' SELECT number FROM system.numbers LIMIT 30');
30 |
31 |
32 | $size=$this->client->tablesSize();
33 |
34 | $this->assertArrayHasKey($table_name_A, $size);
35 | $this->assertArrayHasKey($table_name_B, $size);
36 |
37 |
38 | $size=$this->client->tableSize($table_name_A);
39 | $this->assertArrayHasKey('table', $size);
40 | $this->assertArrayHasKey('database', $size);
41 | $this->assertArrayHasKey('sizebytes', $size);
42 | $this->assertArrayHasKey('size', $size);
43 | $this->assertArrayHasKey('min_date', $size);
44 | $this->assertArrayHasKey('max_date', $size);
45 |
46 | $this->client->write(' DROP TABLE IF EXISTS ' . $table_name_A . ' ; ');
47 | $this->client->write(' DROP TABLE IF EXISTS ' . $table_name_B . ' ; ');
48 |
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/bin/create_pear_package.php:
--------------------------------------------------------------------------------
1 | ' . PHP_EOL;
13 | echo PHP_EOL;
14 | echo ' version:' . PHP_EOL;
15 | echo ' Version of the package, in the form of major.minor.bug' . PHP_EOL;
16 | echo PHP_EOL;
17 | echo ' stability:' . PHP_EOL;
18 | echo ' One of alpha, beta, stable' . PHP_EOL;
19 | die();
20 | }
21 |
22 | if (!isset($argv[2])) {
23 | die('You must provide the stability (alpha, beta, or stable)');
24 | }
25 |
26 | $context = array(
27 | 'date' => gmdate('Y-m-d'),
28 | 'time' => gmdate('H:m:00'),
29 | 'version' => $argv[1],
30 | 'api_version' => $argv[1],
31 | 'stability' => $argv[2],
32 | 'api_stability' => $argv[2],
33 | );
34 |
35 | $context['files'] = '';
36 | $path = realpath(dirname(__FILE__).'/../library/Requests');
37 | foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
38 | if (preg_match('/\.php$/', $file)) {
39 | $name = str_replace($path . DIRECTORY_SEPARATOR, '', $file);
40 | $name = str_replace(DIRECTORY_SEPARATOR, '/', $name);
41 | $context['files'][] = "\t\t\t\t\t" . '';
42 | }
43 | }
44 |
45 | $context['files'] = implode("\n", $context['files']);
46 |
47 | $template = file_get_contents(dirname(__FILE__).'/../package.xml.tpl');
48 | $content = preg_replace_callback('/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/', 'replace_parameters', $template);
49 | file_put_contents(dirname(__FILE__).'/../package.xml', $content);
50 |
51 | function replace_parameters($matches) {
52 | global $context;
53 |
54 | return isset($context[$matches[1]]) ? $context[$matches[1]] : null;
55 | }
56 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/src/Transport/StreamInsert.php:
--------------------------------------------------------------------------------
1 | curlerRolling = $curlerRolling;
42 | } else {
43 | $this->curlerRolling = new CurlerRolling();
44 | }
45 | $this->source = $source;
46 | $this->request = $request;
47 | }
48 |
49 | /**
50 | * @param callable $callback function for stream read data
51 | * @return \ClickHouseDB\Statement
52 | * @throws \Exception
53 | */
54 | public function insert($callback)
55 | {
56 | try {
57 | if (!is_callable($callback)) {
58 | throw new \InvalidArgumentException('Argument $callback can not be called as a function');
59 | }
60 |
61 | //
62 | $this->request->header('Transfer-Encoding', 'chunked');
63 | $this->request->setReadFunction($callback);
64 | $this->curlerRolling->execOne($this->request, true);
65 | $statement = new Statement($this->request);
66 | $statement->error();
67 | return $statement;
68 | } finally {
69 | fclose($this->source);
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/tests/InsertAssocTest.php:
--------------------------------------------------------------------------------
1 | 1,
21 | 'two' => 2,
22 | 'thr' => 3,
23 | ];
24 | $exceptColumns = ['one','two','thr'];
25 | $exceptValues = [[1,2,3]];
26 | list($actualColumns, $actualValues) = $this->client->prepareInsertAssocBulk($toInsert);
27 | $this->assertEquals($exceptValues, $actualValues);
28 | $this->assertEquals($exceptColumns, $actualColumns);
29 | }
30 |
31 | public function testPrepareManyRowSuccess()
32 | {
33 | $oneRow = [
34 | 'one' => 1,
35 | 'two' => 2,
36 | 'thr' => 3,
37 | ];
38 | $toInsert = [$oneRow, $oneRow, $oneRow];
39 | $exceptColumns = ['one','two','thr'];
40 | $exceptValues = [[1,2,3],[1,2,3],[1,2,3]];
41 | list($actualColumns, $actualValues) = $this->client->prepareInsertAssocBulk($toInsert);
42 | $this->assertEquals($exceptValues, $actualValues);
43 | $this->assertEquals($exceptColumns, $actualColumns);
44 | }
45 |
46 | public function testPrepareManyRowFail()
47 | {
48 | $oneRow = [
49 | 'one' => 1,
50 | 'two' => 2,
51 | 'thr' => 3,
52 | ];
53 | $failRow = [
54 | 'two' => 2,
55 | 'one' => 1,
56 | 'thr' => 3,
57 | ];
58 | $toInsert = [$oneRow, $oneRow, $failRow];
59 |
60 | $this->expectException(QueryException::class);
61 | $this->expectExceptionMessage("Fields not match: two,one,thr and one,two,thr on element 2");
62 |
63 | list($_, $__) = $this->client->prepareInsertAssocBulk($toInsert);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/vendor/workerman/workerman/Autoloader.php:
--------------------------------------------------------------------------------
1 |
10 | * @copyright walkor
11 | * @link http://www.workerman.net/
12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License
13 | */
14 | namespace Workerman;
15 |
16 | /**
17 | * Autoload.
18 | */
19 | class Autoloader
20 | {
21 | /**
22 | * Autoload root path.
23 | *
24 | * @var string
25 | */
26 | protected static $_autoloadRootPath = '';
27 |
28 | /**
29 | * Set autoload root path.
30 | *
31 | * @param string $root_path
32 | * @return void
33 | */
34 | public static function setRootPath($root_path)
35 | {
36 | self::$_autoloadRootPath = $root_path;
37 | }
38 |
39 | /**
40 | * Load files by namespace.
41 | *
42 | * @param string $name
43 | * @return boolean
44 | */
45 | public static function loadByNamespace($name)
46 | {
47 | $class_path = str_replace('\\', DIRECTORY_SEPARATOR, $name);
48 | if (strpos($name, 'Workerman\\') === 0) {
49 | $class_file = __DIR__ . substr($class_path, strlen('Workerman')) . '.php';
50 | } else {
51 | if (self::$_autoloadRootPath) {
52 | $class_file = self::$_autoloadRootPath . DIRECTORY_SEPARATOR . $class_path . '.php';
53 | }
54 | if (empty($class_file) || !is_file($class_file)) {
55 | $class_file = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . "$class_path.php";
56 | }
57 | }
58 |
59 | if (is_file($class_file)) {
60 | require_once($class_file);
61 | if (class_exists($name, false)) {
62 | return true;
63 | }
64 | }
65 | return false;
66 | }
67 | }
68 |
69 | spl_autoload_register('\Workerman\Autoloader::loadByNamespace');
--------------------------------------------------------------------------------
/vendor/rmccue/requests/package.xml.tpl:
--------------------------------------------------------------------------------
1 |
2 |
8 | Requests
9 | pear.ryanmccue.info
10 | A HTTP library written in PHP, for human beings.
11 |
12 | Requests is a HTTP library written in PHP, for human beings. It is
13 | roughly based on the API from the excellent Requests Python library.
14 | Requests is ISC Licensed (similar to the new BSD license) and has
15 | no dependencies.
16 |
17 |
18 | Ryan McCue
19 | rmccue
20 | me+pear@ryanmccue dot info
21 | yes
22 |
23 | {{ date }}
24 |
25 |
26 | {{ version }}
27 | {{ api_version }}
28 |
29 |
30 | {{ stability }}
31 | {{ stability }}
32 |
33 | ISC
34 | -
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | {{ files }}
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | 5.2.0
53 |
54 |
55 | 1.4.0
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/tests/FormatQueryTest.php:
--------------------------------------------------------------------------------
1 | client->ping();
24 | }
25 |
26 | public function testCreateTableTEMPORARYNoSession()
27 | {
28 | $query="SELECT 2*number as FORMAT FROM system.numbers LIMIT 1,1 format TSV";
29 | $st = $this->client->select($query);
30 | $this->assertEquals($query, $st->sql());
31 | $this->assertEquals('TSV', $st->getFormat());
32 | $this->assertEquals("2\n", $st->rawData());
33 |
34 |
35 |
36 | $query="SELECT number as format_id FROM system.numbers LIMIT 3 FORMAT CSVWithNames";
37 | $st = $this->client->select($query);
38 | $this->assertEquals($query, $st->sql());
39 | $this->assertEquals('CSVWithNames', $st->getFormat());
40 | $this->assertEquals("\"format_id\"\n0\n1\n2\n", $st->rawData());
41 |
42 |
43 |
44 | $query="SELECT number as format_id FROM system.numbers LIMIT 1,1 FORMAT CSV";
45 | $st = $this->client->select($query);
46 | $this->assertEquals($query, $st->sql());
47 | $this->assertEquals('CSV', $st->getFormat());
48 | }
49 |
50 | public function testClientTimeoutSettings()
51 | {
52 | $this->client->database('default');
53 |
54 | $timeout = 1.5;
55 | $this->client->setTimeout($timeout); // 1500 ms
56 | $this->assertSame($timeout, $this->client->getTimeout());
57 |
58 | $timeout = 10;
59 | $this->client->setTimeout($timeout); // 10 seconds
60 | $this->assertSame($timeout, $this->client->getTimeout());
61 |
62 | $timeout = 5;
63 | $this->client->setConnectTimeOut($timeout); // 5 seconds
64 | $this->assertSame($timeout, $this->client->getConnectTimeOut());
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam07_where_in.php:
--------------------------------------------------------------------------------
1 | attachFile($file_name_data1, 'namex', ['site_id' => 'Int32', 'site_hash' => 'String'], \ClickHouseDB\Query\WhereInFile::FORMAT_CSV);
34 | $whereIn->attachFile($file_name_data2, 'site_keys', ['site_id' => 'Int32', 'site_hash' => 'String'], \ClickHouseDB\Query\WhereInFile::FORMAT_CSV);
35 |
36 | $result = $db->select('select 1', [], $whereIn);
37 | print_r($result->rows());
38 |
39 | // ----------------------------------------------- ASYNC ------------------------------------------------------------------------------------------
40 | echo "\n----------------------- ASYNC ------------ \n";
41 |
42 |
43 | $bindings['limit'] = 3;
44 |
45 | $statements = [];
46 | $whereIn = new \ClickHouseDB\Query\WhereInFile();
47 | $whereIn->attachFile($file_name_data1, 'namex', ['site_id' => 'Int32', 'site_hash' => 'String'], \ClickHouseDB\Query\WhereInFile::FORMAT_CSV);
48 |
49 | $statements[0] = $db->selectAsync('select 3', $bindings, $whereIn);
50 |
51 |
52 | // change data file - for statement two
53 | $whereIn = new \ClickHouseDB\Query\WhereInFile();
54 | $whereIn->attachFile($file_name_data2, 'namex', ['site_id' => 'Int32', 'site_hash' => 'String'], \ClickHouseDB\Query\WhereInFile::FORMAT_CSV);
55 |
56 | $statements[1] = $db->selectAsync('select 2', $bindings, $whereIn);
57 | $db->executeAsync();
58 |
59 |
60 | foreach ($statements as $statement) {
61 | print_r($statement->rows());
62 | }
63 |
64 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Auth/Basic.php:
--------------------------------------------------------------------------------
1 | user, $this->pass) = $args;
46 | }
47 | }
48 |
49 | /**
50 | * Register the necessary callbacks
51 | *
52 | * @see curl_before_send
53 | * @see fsockopen_header
54 | * @param Requests_Hooks $hooks Hook system
55 | */
56 | public function register(Requests_Hooks &$hooks) {
57 | $hooks->register('curl.before_send', array(&$this, 'curl_before_send'));
58 | $hooks->register('fsockopen.after_headers', array(&$this, 'fsockopen_header'));
59 | }
60 |
61 | /**
62 | * Set cURL parameters before the data is sent
63 | *
64 | * @param resource $handle cURL resource
65 | */
66 | public function curl_before_send(&$handle) {
67 | curl_setopt($handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
68 | curl_setopt($handle, CURLOPT_USERPWD, $this->getAuthString());
69 | }
70 |
71 | /**
72 | * Add extra headers to the request before sending
73 | *
74 | * @param string $out HTTP header string
75 | */
76 | public function fsockopen_header(&$out) {
77 | $out .= sprintf("Authorization: Basic %s\r\n", base64_encode($this->getAuthString()));
78 | }
79 |
80 | /**
81 | * Get the authentication string (user:pass)
82 | *
83 | * @return string
84 | */
85 | public function getAuthString() {
86 | return $this->user . ':' . $this->pass;
87 | }
88 | }
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/tests/StrictQuoteLineTest.php:
--------------------------------------------------------------------------------
1 | client->write('DROP TABLE IF EXISTS cities');
25 | $this->client->write('
26 | CREATE TABLE IF NOT EXISTS cities (
27 | date Date,
28 | city String,
29 | keywords Array(String),
30 | nums Array(UInt8)
31 | ) ENGINE = MergeTree(date, (date), 8192)
32 | ');
33 | parent::setUp();
34 | }
35 |
36 | /**
37 | * @group test
38 | *
39 | * @return void
40 | */
41 | public function testQuoteValueCSV()
42 | {
43 | $strict = new StrictQuoteLine('CSV');
44 |
45 | $rows = [
46 | ['2018-04-01', '"That works"', ['\"That does not\"', 'That works'], [8, 7]],
47 | ['2018-04-02', 'That works', ['\""That does not\""', '"\'\""That works"""\"'], [1, 0]],
48 | ['2018-04-03', 'That works', ['\"\"That does not"\'""', '""""That works""""'], [9, 121]],
49 | ];
50 |
51 | $fileName = $this->tmpPath . '__test_quote_value.csv';
52 |
53 | @unlink($fileName);
54 | foreach ($rows as $row) {
55 | file_put_contents($fileName, $strict->quoteRow($row) . "\n", FILE_APPEND);
56 | }
57 |
58 | $this->client->insertBatchFiles('cities', [$fileName], ['date', 'city', 'keywords', 'nums']);
59 | $statement = $this->client->select('SELECT * FROM cities');
60 |
61 | $result = array_map('array_values', $statement->rows());
62 | foreach ($result as $key => $value) {
63 | // check correct quote string
64 | $this->assertEmpty(array_diff($rows[$key][2], $value[2]));
65 | $this->assertEmpty(array_diff($rows[$key][3], $value[3]));
66 | }
67 |
68 | $rows[0][2][1] = 'Not the same string';
69 | $this->assertCount(1, array_diff($rows[0][2], $result[0][2]));
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/tests/StreamTest.php:
--------------------------------------------------------------------------------
1 | closure($callable);
30 |
31 | $state=$this->client->streamRead($streamRead,'SELECT sin(number) as sin,cos(number) as cos FROM {table_name} LIMIT 2 FORMAT JSONEachRow', ['table_name'=>'system.numbers']);
32 | rewind($stream);
33 | $bufferCheck='';
34 | while (($buffer = fgets($stream, 4096)) !== false) {
35 | $bufferCheck=$bufferCheck.$buffer;
36 | }
37 | fclose($stream);
38 |
39 | $checkString='{"max":0,"cos":1}';
40 |
41 | $this->assertContains($checkString,$bufferCheck);
42 |
43 | }
44 | public function testStreamInsert()
45 | {
46 |
47 | $this->client->write('DROP TABLE IF EXISTS _phpCh_SteamTest');
48 | $this->client->write('CREATE TABLE _phpCh_SteamTest (a Int32) Engine=Log');
49 |
50 |
51 | $stream = fopen('php://memory','r+');
52 | for($f=0;$f<121123;$f++)
53 | fwrite($stream, json_encode(['a'=>$f]).PHP_EOL );
54 | rewind($stream);
55 |
56 | $streamWrite=new \ClickHouseDB\Transport\StreamWrite($stream);
57 |
58 | $streamWrite->applyGzip();
59 |
60 | $callable = function ($ch, $fd, $length) use ($stream) {
61 | return ($line = fread($stream, $length)) ? $line : '';
62 | };
63 |
64 |
65 | $streamWrite->closure($callable);
66 |
67 | $state=$this->client->streamWrite($streamWrite,'INSERT INTO {table_name} FORMAT JSONEachRow', ['table_name'=>'_phpCh_SteamTest']);
68 | $sum=$this->client->select("SELECT sum(a) as s FROM _phpCh_SteamTest ")->fetchOne('s');
69 | $this->assertEquals(7335330003, $sum);
70 |
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/src/Query/WhereInFile.php:
--------------------------------------------------------------------------------
1 | _files[$table_name] = [
41 | 'filename' => $file_name,
42 | 'structure' => $structure,
43 | 'format' => $format
44 | ];
45 | }
46 |
47 | /**
48 | * @return int
49 | */
50 | public function size()
51 | {
52 | return sizeof($this->_files);
53 | }
54 |
55 | /**
56 | * @return array
57 | */
58 | public function fetchFiles()
59 | {
60 | $out = [];
61 | foreach ($this->_files as $table => $data) {
62 | $out[$table] = realpath($data['filename']);
63 | }
64 |
65 | return $out;
66 | }
67 |
68 | /**
69 | * @param string $table
70 | * @return string
71 | */
72 | public function fetchStructure($table)
73 | {
74 | $structure = $this->_files[$table]['structure'];
75 |
76 | $out = [];
77 | foreach ($structure as $name => $type) {
78 | $out[] = $name . ' ' . $type;
79 | }
80 |
81 | return implode(',', $out);
82 | }
83 |
84 | /**
85 | * @return array
86 | */
87 | public function fetchUrlParams()
88 | {
89 | $out = [];
90 | foreach ($this->_files as $table => $data) {
91 | $out[$table . '_structure'] = $this->fetchStructure($table);
92 | $out[$table . '_format'] = $data['format'];
93 | }
94 |
95 | return $out;
96 | }
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/vendor/workerman/workerman/Events/EventInterface.php:
--------------------------------------------------------------------------------
1 |
10 | * @copyright walkor
11 | * @link http://www.workerman.net/
12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License
13 | */
14 | namespace Workerman\Events;
15 |
16 | interface EventInterface
17 | {
18 | /**
19 | * Read event.
20 | *
21 | * @var int
22 | */
23 | const EV_READ = 1;
24 |
25 | /**
26 | * Write event.
27 | *
28 | * @var int
29 | */
30 | const EV_WRITE = 2;
31 |
32 | /**
33 | * Except event
34 | *
35 | * @var int
36 | */
37 | const EV_EXCEPT = 3;
38 |
39 | /**
40 | * Signal event.
41 | *
42 | * @var int
43 | */
44 | const EV_SIGNAL = 4;
45 |
46 | /**
47 | * Timer event.
48 | *
49 | * @var int
50 | */
51 | const EV_TIMER = 8;
52 |
53 | /**
54 | * Timer once event.
55 | *
56 | * @var int
57 | */
58 | const EV_TIMER_ONCE = 16;
59 |
60 | /**
61 | * Add event listener to event loop.
62 | *
63 | * @param mixed $fd
64 | * @param int $flag
65 | * @param callable $func
66 | * @param mixed $args
67 | * @return bool
68 | */
69 | public function add($fd, $flag, $func, $args = null);
70 |
71 | /**
72 | * Remove event listener from event loop.
73 | *
74 | * @param mixed $fd
75 | * @param int $flag
76 | * @return bool
77 | */
78 | public function del($fd, $flag);
79 |
80 | /**
81 | * Remove all timers.
82 | *
83 | * @return void
84 | */
85 | public function clearAllTimer();
86 |
87 | /**
88 | * Main loop.
89 | *
90 | * @return void
91 | */
92 | public function loop();
93 |
94 | /**
95 | * Destroy loop.
96 | *
97 | * @return mixed
98 | */
99 | public function destroy();
100 |
101 | /**
102 | * Get Timer count.
103 | *
104 | * @return mixed
105 | */
106 | public function getTimerCount();
107 | }
108 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/LICENSE:
--------------------------------------------------------------------------------
1 | Requests
2 | ========
3 |
4 | Copyright (c) 2010-2012 Ryan McCue and contributors
5 |
6 | Permission to use, copy, modify, and/or distribute this software for any
7 | purpose with or without fee is hereby granted, provided that the above
8 | copyright notice and this permission notice appear in all copies.
9 |
10 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 |
18 |
19 | ComplexPie IRI Parser
20 | =====================
21 |
22 | Copyright (c) 2007-2010, Geoffrey Sneddon and Steve Minutillo.
23 | All rights reserved.
24 |
25 | Redistribution and use in source and binary forms, with or without
26 | modification, are permitted provided that the following conditions are met:
27 |
28 | * Redistributions of source code must retain the above copyright notice,
29 | this list of conditions and the following disclaimer.
30 |
31 | * Redistributions in binary form must reproduce the above copyright notice,
32 | this list of conditions and the following disclaimer in the documentation
33 | and/or other materials provided with the distribution.
34 |
35 | * Neither the name of the SimplePie Team nor the names of its contributors
36 | may be used to endorse or promote products derived from this software
37 | without specific prior written permission.
38 |
39 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
40 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
42 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
43 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
44 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
45 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
46 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49 | POSSIBILITY OF SUCH DAMAGE.
50 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/tests/UriTest.php:
--------------------------------------------------------------------------------
1 | '11.12.13.14',
22 | 'port' => 8123,
23 | 'username' => 'uu',
24 | 'password' => 'pp',
25 |
26 | ];
27 | $cli = new \ClickHouseDB\Client($config);
28 |
29 |
30 | //
31 | $this->assertEquals('http://11.12.13.14:8123' , $cli->transport()->getUri());
32 |
33 |
34 | $cli->https(true);
35 |
36 | $this->assertEquals('https://11.12.13.14:8123' , $cli->transport()->getUri());
37 |
38 | $config['host']='blabla.com';
39 | $cli = new \ClickHouseDB\Client($config);
40 | $cli->https(true);
41 |
42 | $this->assertEquals('https://blabla.com:8123' , $cli->transport()->getUri());
43 |
44 |
45 | $config['host']='blabla.com:8111';
46 | $cli = new \ClickHouseDB\Client($config);
47 | $this->assertEquals('http://blabla.com:8111' , $cli->transport()->getUri());
48 |
49 | $config['host']='blabla.com/urls';
50 | $cli = new \ClickHouseDB\Client($config);
51 | $this->assertEquals('http://blabla.com/urls' , $cli->transport()->getUri());
52 |
53 |
54 | $config['host']='blabla.com';
55 | $config['port']=0;
56 | $cli = new \ClickHouseDB\Client($config);
57 | $this->assertEquals('http://blabla.com' , $cli->transport()->getUri());
58 |
59 | $config['host']='blabla.com';
60 | $config['port']=false;
61 | $cli = new \ClickHouseDB\Client($config);
62 | $this->assertEquals('http://blabla.com' , $cli->transport()->getUri());
63 |
64 | $config['host']='blabla.com:8222/path1/path';
65 | $config['port']=false;
66 | $cli = new \ClickHouseDB\Client($config);
67 | $this->assertEquals('http://blabla.com:8222/path1/path' , $cli->transport()->getUri());
68 |
69 |
70 | $config['host']='blabla.com:1234/path1/path';
71 | $config['port']=3344;
72 | $cli = new \ClickHouseDB\Client($config);
73 | $this->assertEquals('http://blabla.com:1234/path1/path' , $cli->transport()->getUri());
74 |
75 |
76 | // exit resetup
77 | $this->restartClickHouseClient();
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Response/Headers.php:
--------------------------------------------------------------------------------
1 | data[$key])) {
29 | return null;
30 | }
31 |
32 | return $this->flatten($this->data[$key]);
33 | }
34 |
35 | /**
36 | * Set the given item
37 | *
38 | * @throws Requests_Exception On attempting to use dictionary as list (`invalidset`)
39 | *
40 | * @param string $key Item name
41 | * @param string $value Item value
42 | */
43 | public function offsetSet($key, $value) {
44 | if ($key === null) {
45 | throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset');
46 | }
47 |
48 | $key = strtolower($key);
49 |
50 | if (!isset($this->data[$key])) {
51 | $this->data[$key] = array();
52 | }
53 |
54 | $this->data[$key][] = $value;
55 | }
56 |
57 | /**
58 | * Get all values for a given header
59 | *
60 | * @param string $key
61 | * @return array Header values
62 | */
63 | public function getValues($key) {
64 | $key = strtolower($key);
65 | if (!isset($this->data[$key])) {
66 | return null;
67 | }
68 |
69 | return $this->data[$key];
70 | }
71 |
72 | /**
73 | * Flattens a value into a string
74 | *
75 | * Converts an array into a string by imploding values with a comma, as per
76 | * RFC2616's rules for folding headers.
77 | *
78 | * @param string|array $value Value to flatten
79 | * @return string Flattened value
80 | */
81 | public function flatten($value) {
82 | if (is_array($value)) {
83 | $value = implode(',', $value);
84 | }
85 |
86 | return $value;
87 | }
88 |
89 | /**
90 | * Get an iterator for the data
91 | *
92 | * Converts the internal
93 | * @return ArrayIterator
94 | */
95 | public function getIterator() {
96 | return new Requests_Utility_FilteredIterator($this->data, array($this, 'flatten'));
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Utility/CaseInsensitiveDictionary.php:
--------------------------------------------------------------------------------
1 | $value) {
30 | $this->offsetSet($key, $value);
31 | }
32 | }
33 |
34 | /**
35 | * Check if the given item exists
36 | *
37 | * @param string $key Item key
38 | * @return boolean Does the item exist?
39 | */
40 | public function offsetExists($key) {
41 | $key = strtolower($key);
42 | return isset($this->data[$key]);
43 | }
44 |
45 | /**
46 | * Get the value for the item
47 | *
48 | * @param string $key Item key
49 | * @return string Item value
50 | */
51 | public function offsetGet($key) {
52 | $key = strtolower($key);
53 | if (!isset($this->data[$key])) {
54 | return null;
55 | }
56 |
57 | return $this->data[$key];
58 | }
59 |
60 | /**
61 | * Set the given item
62 | *
63 | * @throws Requests_Exception On attempting to use dictionary as list (`invalidset`)
64 | *
65 | * @param string $key Item name
66 | * @param string $value Item value
67 | */
68 | public function offsetSet($key, $value) {
69 | if ($key === null) {
70 | throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset');
71 | }
72 |
73 | $key = strtolower($key);
74 | $this->data[$key] = $value;
75 | }
76 |
77 | /**
78 | * Unset the given header
79 | *
80 | * @param string $key
81 | */
82 | public function offsetUnset($key) {
83 | unset($this->data[strtolower($key)]);
84 | }
85 |
86 | /**
87 | * Get an iterator for the data
88 | *
89 | * @return ArrayIterator
90 | */
91 | public function getIterator() {
92 | return new ArrayIterator($this->data);
93 | }
94 |
95 | /**
96 | * Get the headers as an array
97 | *
98 | * @return array Header data
99 | */
100 | public function getAll() {
101 | return $this->data;
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/tests/Auth/Basic.php:
--------------------------------------------------------------------------------
1 | markTestSkipped($transport . ' is not available');
18 | return;
19 | }
20 |
21 | $options = array(
22 | 'auth' => array('user', 'passwd'),
23 | 'transport' => $transport,
24 | );
25 | $request = Requests::get(httpbin('/basic-auth/user/passwd'), array(), $options);
26 | $this->assertEquals(200, $request->status_code);
27 |
28 | $result = json_decode($request->body);
29 | $this->assertEquals(true, $result->authenticated);
30 | $this->assertEquals('user', $result->user);
31 | }
32 |
33 | /**
34 | * @dataProvider transportProvider
35 | */
36 | public function testUsingInstantiation($transport) {
37 | if (!call_user_func(array($transport, 'test'))) {
38 | $this->markTestSkipped($transport . ' is not available');
39 | return;
40 | }
41 |
42 | $options = array(
43 | 'auth' => new Requests_Auth_Basic(array('user', 'passwd')),
44 | 'transport' => $transport,
45 | );
46 | $request = Requests::get(httpbin('/basic-auth/user/passwd'), array(), $options);
47 | $this->assertEquals(200, $request->status_code);
48 |
49 | $result = json_decode($request->body);
50 | $this->assertEquals(true, $result->authenticated);
51 | $this->assertEquals('user', $result->user);
52 | }
53 |
54 | /**
55 | * @dataProvider transportProvider
56 | */
57 | public function testPOSTUsingInstantiation($transport) {
58 | if (!call_user_func(array($transport, 'test'))) {
59 | $this->markTestSkipped($transport . ' is not available');
60 | return;
61 | }
62 |
63 | $options = array(
64 | 'auth' => new Requests_Auth_Basic(array('user', 'passwd')),
65 | 'transport' => $transport,
66 | );
67 | $data = 'test';
68 | $request = Requests::post(httpbin('/post'), array(), $data, $options);
69 | $this->assertEquals(200, $request->status_code);
70 |
71 | $result = json_decode($request->body);
72 |
73 | $auth = $result->headers->Authorization;
74 | $auth = explode(' ', $auth);
75 |
76 | $this->assertEquals(base64_encode('user:passwd'), $auth[1]);
77 | $this->assertEquals('test', $result->data);
78 | }
79 |
80 | /**
81 | * @expectedException Requests_Exception
82 | */
83 | public function testMissingPassword() {
84 | $auth = new Requests_Auth_Basic(array('user'));
85 | }
86 |
87 | }
--------------------------------------------------------------------------------
/vendor/rmccue/requests/tests/Encoding.php:
--------------------------------------------------------------------------------
1 | $set) {
66 | $real_set = self::mapData($key, $set);
67 | $data = array_merge($data, $real_set);
68 | }
69 | return $data;
70 | }
71 |
72 | /**
73 | * @dataProvider encodedData
74 | */
75 | public function testDecompress($original, $encoded) {
76 | $decoded = Requests::decompress($encoded);
77 | $this->assertEquals($original, $decoded);
78 | }
79 |
80 | /**
81 | * @dataProvider encodedData
82 | */
83 | public function testCompatibleInflate($original, $encoded) {
84 | $decoded = Requests::compatible_gzinflate($encoded);
85 | $this->assertEquals($original, $decoded);
86 | }
87 |
88 | protected function bin2hex($field) {
89 | $field = bin2hex($field);
90 | $field = chunk_split($field,2,"\\x");
91 | $field = "\\x" . substr($field,0,-2);
92 | return $field;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam20_FormatLine_TSV.php:
--------------------------------------------------------------------------------
1 | enableExtremes(true)->enableHttpCompression();
12 |
13 | $db->write("DROP TABLE IF EXISTS xxxx");
14 | $db->write('
15 | CREATE TABLE IF NOT EXISTS xxxx (
16 | event_date Date,
17 | url_hash String,
18 | site_id Int32,
19 | views Int32
20 | )
21 | ENGINE = SummingMergeTree(event_date, (site_id, url_hash), 8192)
22 | ');
23 |
24 | // ARRAY TO TABLE
25 |
26 | $rows=[
27 | ['2017-01-01','XXXXX',123,1],
28 | ['2017-01-02','XXXXX',123,1],
29 | ['2017-01-03','XXXXX',123,1],
30 | ['2017-01-04','XXXXX',123,1],
31 | ['2017-01-05','XXXXX',123,1],
32 | ['2017-01-06','XXXXX',123,1],
33 | ['2017-01-07','XXXXX',123,1]
34 | ];
35 |
36 |
37 |
38 | // Write to file array
39 | $temp_file_name='/tmp/_test_data.TSV';
40 |
41 |
42 | if (file_exists($temp_file_name)) unlink('/tmp/_test_data.TSV');
43 | foreach ($rows as $row)
44 | {
45 |
46 | file_put_contents($temp_file_name,\ClickHouseDB\Quote\FormatLine::TSV($row)."\n",FILE_APPEND);
47 |
48 | }
49 |
50 | echo "CONTENT FILES:\n";
51 | echo file_get_contents($temp_file_name);
52 | echo "------\n";
53 |
54 | //
55 | $db->insertBatchTSVFiles('xxxx', [$temp_file_name], [
56 | 'event_date',
57 | 'url_hash',
58 | 'site_id',
59 | 'views'
60 | ]);
61 |
62 |
63 |
64 | print_r($db->select('SELECT * FROM xxxx')->rows());
65 |
66 |
67 |
68 | /**
69 | CONTENT FILES:
70 | 2017-01-01 XXXXX 123 1
71 | 2017-01-02 XXXXX 123 1
72 | 2017-01-03 XXXXX 123 1
73 | 2017-01-04 XXXXX 123 1
74 | 2017-01-05 XXXXX 123 1
75 | 2017-01-06 XXXXX 123 1
76 | 2017-01-07 XXXXX 123 1
77 | ------
78 | Array
79 | (
80 | [0] => Array
81 | (
82 | [event_date] => 2017-01-01
83 | [url_hash] => XXXXX
84 | [site_id] => 123
85 | [views] => 1
86 | )
87 |
88 | [1] => Array
89 | (
90 | [event_date] => 2017-01-02
91 | [url_hash] => XXXXX
92 | [site_id] => 123
93 | [views] => 1
94 | )
95 |
96 | [2] => Array
97 | (
98 | [event_date] => 2017-01-03
99 | [url_hash] => XXXXX
100 | [site_id] => 123
101 | [views] => 1
102 | )
103 |
104 | [3] => Array
105 | (
106 | [event_date] => 2017-01-04
107 | [url_hash] => XXXXX
108 | [site_id] => 123
109 | [views] => 1
110 | )
111 |
112 | [4] => Array
113 | (
114 | [event_date] => 2017-01-05
115 | [url_hash] => XXXXX
116 | [site_id] => 123
117 | [views] => 1
118 | )
119 |
120 | [5] => Array
121 | (
122 | [event_date] => 2017-01-06
123 | [url_hash] => XXXXX
124 | [site_id] => 123
125 | [views] => 1
126 | )
127 |
128 | [6] => Array
129 | (
130 | [event_date] => 2017-01-07
131 | [url_hash] => XXXXX
132 | [site_id] => 123
133 | [views] => 1
134 | )
135 |
136 | )
137 | *
138 | */
139 |
--------------------------------------------------------------------------------
/vendor/workerman/mysql/README.md:
--------------------------------------------------------------------------------
1 | # Workerman\Mysql\Connection
2 |
3 | Long-living MySQL connection for daemon.
4 |
5 | # Install
6 | ```composer require workerman/mysql```
7 |
8 | # Usage
9 | ```php
10 | $db = new Workerman\MySQL\Connection($mysql_host, $mysql_port, $user, $password, $db_bname);
11 |
12 | // Get all rows.
13 | $db1->select('ID,Sex')->from('Persons')->where('sex= :sex')->bindValues(array('sex'=>'M'))->query();
14 | // Equivalent to.
15 | $db1->select('ID,Sex')->from('Persons')->where("sex='F'")->query();
16 | // Equivalent to.
17 | $db->query("SELECT ID,Sex FROM `Persons` WHERE sex='M'");
18 |
19 |
20 | // Get one row.
21 | $db->select('ID,Sex')->from('Persons')->where('sex= :sex')->bindValues(array('sex'=>'M'))->row();
22 | // Equivalent to.
23 | $db->select('ID,Sex')->from('Persons')->where("sex= 'F' ")->row();
24 | // Equivalent to.
25 | $db->row("SELECT ID,Sex FROM `Persons` WHERE sex='M'");
26 |
27 |
28 | // Get a column.
29 | $db->select('ID')->from('Persons')->where('sex= :sex')->bindValues(array('sex'=>'M'))->column();
30 | // Equivalent to.
31 | $db->select('ID')->from('Persons')->where("sex= 'F' ")->column();
32 | // Equivalent to.
33 | $db->column("SELECT `ID` FROM `Persons` WHERE sex='M'");
34 |
35 | // Get single.
36 | $db->select('ID,Sex')->from('Persons')->where('sex= :sex')->bindValues(array('sex'=>'M'))->single();
37 | // Equivalent to.
38 | $db->select('ID,Sex')->from('Persons')->where("sex= 'F' ")->single();
39 | // Equivalent to.
40 | $db->single("SELECT ID,Sex FROM `Persons` WHERE sex='M'");
41 |
42 | // Complex query.
43 | $db->select('*')->from('table1')->innerJoin('table2','table1.uid = table2.uid')->where('age > :age')
44 | ->groupBy(array('aid'))->having('foo="foo"')->orderByASC/*orderByDESC*/(array('did'))
45 | ->limit(10)->offset(20)->bindValues(array('age' => 13));
46 | // Equivalent to.
47 | $db->query(SELECT * FROM `table1` INNER JOIN `table2` ON `table1`.`uid` = `table2`.`uid` WHERE age > 13
48 | GROUP BY aid HAVING foo="foo" ORDER BY did LIMIT 10 OFFSET 20“);
49 |
50 | // Insert.
51 | $insert_id = $db->insert('Persons')->cols(array(
52 | 'Firstname'=>'abc',
53 | 'Lastname'=>'efg',
54 | 'Sex'=>'M',
55 | 'Age'=>13))->query();
56 | // Equivalent to.
57 | $insert_id = $db->query("INSERT INTO `Persons` ( `Firstname`,`Lastname`,`Sex`,`Age`)
58 | VALUES ( 'abc', 'efg', 'M', 13)");
59 |
60 | // Updagte.
61 | $row_count = $db->update('Persons')->cols(array('sex'))->where('ID=1')
62 | ->bindValue('sex', 'F')->query();
63 | // Equivalent to.
64 | $row_count = $db->update('Persons')->cols(array('sex'=>'F'))->where('ID=1')->query();
65 | // Equivalent to.
66 | $row_count = $db->query("UPDATE `Persons` SET `sex` = 'F' WHERE ID=1");
67 |
68 | // Delete.
69 | $row_count = $db->delete('Persons')->where('ID=9')->query();
70 | // Equivalent to.
71 | $row_count = $db->query("DELETE FROM `Persons` WHERE ID=9");
72 |
73 | // Transaction.
74 | $db1->beginTrans();
75 | ....
76 | $db1->commitTrans(); // or $db1->rollBackTrans();
77 |
78 | ```
79 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/docs/usage-advanced.md:
--------------------------------------------------------------------------------
1 | Advanced Usage
2 | ==============
3 |
4 | Session Handling
5 | ----------------
6 | Making multiple requests to the same site with similar options can be a pain,
7 | since you end up repeating yourself. The Session object can be used to set
8 | default parameters for these.
9 |
10 | Let's simulate communicating with GitHub.
11 |
12 | ```php
13 | $session = new Requests_Session('https://api.github.com/');
14 | $session->headers['X-ContactAuthor'] = 'rmccue';
15 | $session->useragent = 'My-Awesome-App';
16 |
17 | $response = $session->get('/zen');
18 | ```
19 |
20 | You can use the `url`, `headers`, `data` and `options` properties of the Session
21 | object to set the defaults for this session, and the constructor also takes
22 | parameters in the same order as `Requests::request()`. Accessing any other
23 | properties will set the corresponding key in the options array; that is:
24 |
25 | ```php
26 | // Setting the property...
27 | $session->useragent = 'My-Awesome-App';
28 |
29 | // ...is the same as setting the option
30 | $session->options['useragent'] = 'My-Awesome-App';
31 | ```
32 |
33 |
34 | Secure Requests with SSL
35 | ------------------------
36 | By default, HTTPS requests will use the most secure options available:
37 |
38 | ```php
39 | $response = Requests::get('https://httpbin.org/');
40 | ```
41 |
42 | Requests bundles certificates from the [Mozilla certificate authority list][],
43 | which is the same list of root certificates used in most browsers. If you're
44 | accessing sites with certificates from other CAs, or self-signed certificates,
45 | you can point Requests to a custom CA list in PEM form (the same format
46 | accepted by cURL and OpenSSL):
47 |
48 | ```php
49 | $options = array(
50 | 'verify' => '/path/to/cacert.pem'
51 | );
52 | $response = Requests::get('https://httpbin.org/', array(), $options);
53 | ```
54 |
55 | Alternatively, if you want to disable verification completely, this is possible
56 | with `'verify' => false`, but note that this is extremely insecure and should be
57 | avoided.
58 |
59 | ### Security Note
60 | Requests supports SSL across both cURL and fsockopen in a transparent manner.
61 | Unlike other PHP HTTP libraries, support for verifying the certificate name is
62 | built-in; that is, a request for `https://github.com/` will actually verify the
63 | certificate's name even with the fsockopen transport. This makes Requests the
64 | first and currently only PHP HTTP library that supports full SSL verification.
65 |
66 | (Note that WordPress now also supports this verification, thanks to efforts by
67 | the Requests development team.)
68 |
69 | (See also the [related PHP][php-bug-47030] and [OpenSSL-related][php-bug-55820]
70 | bugs in PHP for more information on Subject Alternate Name field.)
71 |
72 | [Mozilla certificate authority list]: http://www.mozilla.org/projects/security/certs/
73 | [php-bug-47030]: https://bugs.php.net/bug.php?id=47030
74 | [php-bug-55820]:https://bugs.php.net/bug.php?id=55820
75 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/.travis.yml:
--------------------------------------------------------------------------------
1 | dist: trusty
2 | language: php
3 | sudo: false
4 |
5 | cache:
6 | directories:
7 | - $HOME/.composer/cache
8 |
9 | php:
10 | - 7.1
11 | - 7.2
12 | - nightly
13 |
14 | services:
15 | - docker
16 |
17 | before_install:
18 | - docker-compose -f tests/docker-compose.yaml up -d
19 | - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
20 |
21 | install:
22 | - travis_retry composer update -n --prefer-dist
23 |
24 | script: ./vendor/bin/phpunit
25 |
26 | jobs:
27 | allow_failures:
28 | - php: nightly
29 | - env: DEV_DEPENDENCIES
30 |
31 | include:
32 | - stage: Test
33 | env: LOWEST_DEPENDENCIES
34 | install:
35 | - travis_retry composer update -n --prefer-dist --prefer-lowest
36 |
37 | - stage: Test
38 | env: LOWEST_DEPENDENCIES
39 | php: 7.2
40 | install:
41 | - travis_retry composer update -n --prefer-dist --prefer-lowest
42 |
43 | - stage: Test
44 | env: LOWEST_DEPENDENCIES
45 | php: nightly
46 | install:
47 | - travis_retry composer update -n --prefer-dist --prefer-lowest
48 |
49 | - stage: Test
50 | env: DEV_DEPENDENCIES
51 | php: nightly
52 | install:
53 | - composer config minimum-stability dev
54 | - travis_retry composer update -n --prefer-dist
55 |
56 | - stage: Test
57 | env: COVERAGE
58 | php: 7.1
59 | before_script:
60 | - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
61 | - if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi
62 | script:
63 | - ./vendor/bin/phpunit --coverage-clover ./build/logs/clover.xml
64 | after_script:
65 | - wget https://github.com/scrutinizer-ci/ocular/releases/download/1.5.2/ocular.phar
66 | - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
67 |
68 | - stage: Pull request coding standard
69 | if: type = pull_request
70 | php: 7.1
71 | install: travis_retry composer install --prefer-dist
72 | script:
73 | - |
74 | if [ $TRAVIS_BRANCH != "master" ]; then
75 | git remote set-branches --add origin $TRAVIS_BRANCH;
76 | git fetch origin $TRAVIS_BRANCH;
77 | fi
78 | - git merge-base origin/$TRAVIS_BRANCH $TRAVIS_PULL_REQUEST_SHA || git fetch origin +refs/pull/$TRAVIS_PULL_REQUEST/merge --unshallow
79 | - wget https://github.com/diff-sniffer/git/releases/download/0.1.0/git-phpcs.phar
80 | - php git-phpcs.phar origin/$TRAVIS_BRANCH...$TRAVIS_PULL_REQUEST_SHA
81 |
82 | # - stage: Coding standard
83 | # if: NOT type = pull_request
84 | # php: 7.1
85 | # install: travis_retry composer install --prefer-dist
86 | # script:
87 | # - ./vendor/bin/phpcs
88 |
89 | - stage: Static Analysis
90 | script: vendor/bin/phpstan analyse -c phpstan.neon src tests
91 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/src/Query/WriteToFile.php:
--------------------------------------------------------------------------------
1 | setFormat($format);
64 | }
65 | $this->file_name = $file_name;
66 | }
67 |
68 | /**
69 | * @return bool
70 | */
71 | public function getGzip()
72 | {
73 | return $this->gzip;
74 | }
75 |
76 | /**
77 | * @param bool $flag
78 | */
79 | public function setGzip($flag)
80 | {
81 | $this->gzip = $flag;
82 | }
83 |
84 | /**
85 | * @param string $format
86 | */
87 | public function setFormat($format)
88 | {
89 | if (!in_array($format, $this->support_format))
90 | {
91 | throw new QueryException('Unsupport format: ' . $format);
92 | }
93 | $this->format = $format;
94 | }
95 | /**
96 | * @return int
97 | */
98 | public function size()
99 | {
100 | return filesize($this->file_name);
101 | }
102 |
103 | /**
104 | * @return string
105 | */
106 | public function fetchFile()
107 | {
108 | return $this->file_name;
109 | }
110 |
111 | /**
112 | * @return string
113 | */
114 | public function fetchFormat()
115 | {
116 | return $this->format;
117 | }
118 |
119 | }
120 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/docs/hooks.md:
--------------------------------------------------------------------------------
1 | Hooks
2 | =====
3 | Requests has a hook system that you can use to manipulate parts of the request
4 | process along with internal transport hooks.
5 |
6 | Check out the [API documentation for `Requests_Hooks`][requests_hooks] for more
7 | information on how to use the hook system.
8 |
9 | Available Hooks
10 | ---------------
11 |
12 | * `requests.before_request`
13 |
14 | Alter the request before it's sent to the transport.
15 |
16 | Parameters: `string &$url`, `array &$headers`, `array|string &$data`,
17 | `string &$type`, `array &$options`
18 |
19 | * `requests.before_parse`
20 |
21 | Alter the raw HTTP response before parsing
22 |
23 | Parameters: `string &$response`
24 |
25 | * `requests.after_request`
26 |
27 | Alter the response object before it's returned to the user
28 |
29 | Parameters: `Requests_Response &$return`
30 |
31 | * `curl.before_request`
32 |
33 | Set cURL options before the transport sets any (note that Requests may
34 | override these)
35 |
36 | Parameters: `cURL resource &$fp`
37 |
38 | * `curl.before_send`
39 |
40 | Set cURL options just before the request is actually sent via `curl_exec`
41 |
42 | Parameters: `cURL resource &$fp`
43 |
44 | * `curl.after_request`
45 |
46 | Alter the raw HTTP response before returning for parsing
47 |
48 | Parameters: `string &$response, array &$info`
49 |
50 | `$info` contains the associated array as defined in [curl-getinfo-returnvalues](http://php.net/manual/en/function.curl-getinfo.php#refsect1-function.curl-getinfo-returnvalues)
51 |
52 | * `fsockopen.before_request`
53 |
54 | Run events before the transport does anything
55 |
56 | * `fsockopen.after_headers`
57 |
58 | Add extra headers before the body begins (i.e. before `\r\n\r\n`)
59 |
60 | Parameters: `string &$out`
61 |
62 | * `fsockopen.before_send`
63 |
64 | Add body data before sending the request
65 |
66 | Parameters: `string &$out`
67 |
68 | * `fsockopen.after_send`
69 |
70 | Run events after writing the data to the socket
71 |
72 | * `fsockopen.after_request`
73 |
74 | Alter the raw HTTP response before returning for parsing
75 |
76 | Parameters: `string &$response, array &$info`
77 |
78 | `$info` contains the associated array as defined in [stream-get-meta-data-returnvalues](http://php.net/manual/en/function.stream-get-meta-data.php#refsect1-function.stream-get-meta-data-returnvalues)
79 |
80 |
81 | Registering Hooks
82 | -----------------
83 | Note: if you're doing this in an authentication handler, see the [Custom
84 | Authentication guide][authentication-custom] instead.
85 |
86 | [authentication-custom]: authentication-custom.md
87 |
88 | In order to register your own hooks, you need to instantiate `Requests_hooks`
89 | and pass this in via the 'hooks' option.
90 |
91 | ```php
92 | $hooks = new Requests_Hooks();
93 | $hooks->register('requests.after_request', 'mycallback');
94 |
95 | $request = Requests::get('http://httpbin.org/get', array(), array('hooks' => $hooks));
96 | ```
97 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/src/Query/Query.php:
--------------------------------------------------------------------------------
1 | sql = $sql;
37 | $this->degenerations = $degenerations;
38 | }
39 |
40 | /**
41 | * @param string|null $format
42 | */
43 | public function setFormat($format)
44 | {
45 | $this->format = $format;
46 | }
47 |
48 |
49 | private function applyFormatQuery()
50 | {
51 | // FORMAT\s(\w)*$
52 | if (null === $this->format) {
53 | return false;
54 | }
55 | $supportFormats =
56 | "FORMAT\\s+TSV|FORMAT\\s+TSVRaw|FORMAT\\s+TSVWithNames|FORMAT\\s+TSVWithNamesAndTypes|FORMAT\\s+Vertical|FORMAT\\s+JSONCompact|FORMAT\\s+JSONEachRow|FORMAT\\s+TSKV|FORMAT\\s+TabSeparatedWithNames|FORMAT\\s+TabSeparatedWithNamesAndTypes|FORMAT\\s+TabSeparatedRaw|FORMAT\\s+BlockTabSeparated|FORMAT\\s+CSVWithNames|FORMAT\\s+CSV|FORMAT\\s+JSON|FORMAT\\s+TabSeparated";
57 |
58 | $matches = [];
59 | if (preg_match_all('%(' . $supportFormats . ')%ius', $this->sql, $matches)) {
60 |
61 | // skip add "format json"
62 | if (isset($matches[0]))
63 | {
64 |
65 | $this->format = trim(str_ireplace('format', '', $matches[0][0]));
66 |
67 | }
68 | } else {
69 | $this->sql = $this->sql . ' FORMAT ' . $this->format;
70 | }
71 |
72 |
73 |
74 |
75 |
76 |
77 | }
78 |
79 | /**
80 | * @return null|string
81 | */
82 | public function getFormat()
83 | {
84 |
85 | return $this->format;
86 | }
87 |
88 | public function toSql()
89 | {
90 | if ($this->format !== null) {
91 | $this->applyFormatQuery();
92 | }
93 |
94 | if (sizeof($this->degenerations))
95 | {
96 | foreach ($this->degenerations as $degeneration)
97 | {
98 | if ($degeneration instanceof Degeneration) {
99 | $this->sql = $degeneration->process($this->sql);
100 | }
101 | }
102 | }
103 |
104 | return $this->sql;
105 | }
106 |
107 | /**
108 | * @return string
109 | */
110 | public function __toString()
111 | {
112 | return $this->toSql();
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/vendor/workerman/workerman/Connection/ConnectionInterface.php:
--------------------------------------------------------------------------------
1 |
10 | * @copyright walkor
11 | * @link http://www.workerman.net/
12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License
13 | */
14 | namespace Workerman\Connection;
15 |
16 | /**
17 | * ConnectionInterface.
18 | */
19 | abstract class ConnectionInterface
20 | {
21 | /**
22 | * Statistics for status command.
23 | *
24 | * @var array
25 | */
26 | public static $statistics = array(
27 | 'connection_count' => 0,
28 | 'total_request' => 0,
29 | 'throw_exception' => 0,
30 | 'send_fail' => 0,
31 | );
32 |
33 | /**
34 | * Emitted when data is received.
35 | *
36 | * @var callback
37 | */
38 | public $onMessage = null;
39 |
40 | /**
41 | * Emitted when the other end of the socket sends a FIN packet.
42 | *
43 | * @var callback
44 | */
45 | public $onClose = null;
46 |
47 | /**
48 | * Emitted when an error occurs with connection.
49 | *
50 | * @var callback
51 | */
52 | public $onError = null;
53 |
54 | /**
55 | * Sends data on the connection.
56 | *
57 | * @param string $send_buffer
58 | * @return void|boolean
59 | */
60 | abstract public function send($send_buffer);
61 |
62 | /**
63 | * Get remote IP.
64 | *
65 | * @return string
66 | */
67 | abstract public function getRemoteIp();
68 |
69 | /**
70 | * Get remote port.
71 | *
72 | * @return int
73 | */
74 | abstract public function getRemotePort();
75 |
76 | /**
77 | * Get remote address.
78 | *
79 | * @return string
80 | */
81 | abstract public function getRemoteAddress();
82 |
83 | /**
84 | * Get local IP.
85 | *
86 | * @return string
87 | */
88 | abstract public function getLocalIp();
89 |
90 | /**
91 | * Get local port.
92 | *
93 | * @return int
94 | */
95 | abstract public function getLocalPort();
96 |
97 | /**
98 | * Get local address.
99 | *
100 | * @return string
101 | */
102 | abstract public function getLocalAddress();
103 |
104 | /**
105 | * Is ipv4.
106 | *
107 | * @return bool
108 | */
109 | abstract public function isIPv4();
110 |
111 | /**
112 | * Is ipv6.
113 | *
114 | * @return bool
115 | */
116 | abstract public function isIPv6();
117 |
118 | /**
119 | * Close connection.
120 | *
121 | * @param $data
122 | * @return void
123 | */
124 | abstract public function close($data = null);
125 | }
126 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam23_streams.php:
--------------------------------------------------------------------------------
1 | write('DROP TABLE IF EXISTS _phpCh_SteamTest');
10 |
11 |
12 |
13 | $client->write('CREATE TABLE _phpCh_SteamTest (a Int32) Engine=Log');
14 |
15 |
16 |
17 |
18 |
19 | echo "\n\n------------------------------------ 0 ---------------------------------------------------------------------------------\n\n";
20 |
21 |
22 |
23 |
24 | $stream = fopen('php://memory','r+');
25 | for($f=0;$f<121123;$f++)
26 | fwrite($stream, json_encode(['a'=>$f]).PHP_EOL );
27 | rewind($stream);
28 |
29 | echo "\nstreamWrite....\n";
30 |
31 |
32 | $streamWrite=new ClickHouseDB\Transport\StreamWrite($stream);
33 |
34 | $streamWrite->applyGzip();
35 |
36 | $callable = function ($ch, $fd, $length) use ($stream) {
37 | return ($line = fread($stream, $length)) ? $line : '';
38 | };
39 |
40 |
41 | $streamWrite->closure($callable);
42 |
43 | $r=$client->streamWrite($streamWrite,'INSERT INTO {table_name} FORMAT JSONEachRow', ['table_name'=>'_phpCh_SteamTest']);
44 |
45 | print_r($r->info_upload());
46 |
47 |
48 | print_r($client->select("SELECT sum(a) as s FROM _phpCh_SteamTest ")->fetchOne('s'));
49 |
50 | echo "\n\n------------------------------------ 1 ---------------------------------------------------------------------------------\n\n";
51 |
52 |
53 | $stream = fopen('php://memory','r+');
54 |
55 | $streamRead=new ClickHouseDB\Transport\StreamRead($stream);
56 |
57 | $r=$client->streamRead($streamRead,'SELECT sin(number) as sin,cos(number) as cos FROM {table_name} LIMIT 4 FORMAT JSONEachRow', ['table_name'=>'system.numbers']);
58 | rewind($stream);
59 | while (($buffer = fgets($stream, 4096)) !== false) {
60 | echo ">>> ".$buffer;
61 | }
62 | fclose($stream);
63 |
64 |
65 |
66 | echo "\n\n---------------------------------- 2 --------------------------------------------------------------------------------------\n\n";
67 |
68 |
69 |
70 | $stream = fopen('php://memory','r+');
71 | $streamRead=new ClickHouseDB\Transport\StreamRead($stream);
72 | $callable = function ($ch, $string) use ($stream) {
73 | // some magic for _BLOCK_ data
74 | fwrite($stream, str_ireplace('"sin"','"max"',$string));
75 | return strlen($string);
76 | };
77 |
78 | $streamRead->closure($callable);
79 |
80 | $r=$client->streamRead($streamRead,'SELECT sin(number) as sin,cos(number) as cos FROM {table_name} LIMIT 44 FORMAT JSONEachRow', ['table_name'=>'system.numbers']);
81 |
82 | echo "size_download:".($r->info()['size_download'])."\n";
83 |
84 |
85 |
86 | rewind($stream);
87 |
88 |
89 |
90 | while (($buffer = fgets($stream, 4096)) !== false) {
91 | echo "".$buffer;
92 | }
93 | fclose($stream);
94 | // ------------------------------------------------------------------------------------------------------------------------
95 |
96 |
97 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/vendor/rmccue/requests/tests/IDNAEncoder.php:
--------------------------------------------------------------------------------
1 | assertEquals($expected, $result);
23 | }
24 |
25 | /**
26 | * @expectedException Requests_Exception
27 | */
28 | public function testASCIITooLong() {
29 | $data = str_repeat("abcd", 20);
30 | $result = Requests_IDNAEncoder::encode($data);
31 | }
32 |
33 | /**
34 | * @expectedException Requests_Exception
35 | */
36 | public function testEncodedTooLong() {
37 | $data = str_repeat("\xe4\xbb\x96", 60);
38 | $result = Requests_IDNAEncoder::encode($data);
39 | }
40 |
41 | /**
42 | * @expectedException Requests_Exception
43 | */
44 | public function testAlreadyPrefixed() {
45 | $result = Requests_IDNAEncoder::encode("xn--\xe4\xbb\x96");
46 | }
47 |
48 | public function testASCIICharacter() {
49 | $result = Requests_IDNAEncoder::encode("a");
50 | $this->assertEquals('a', $result);
51 | }
52 |
53 | public function testTwoByteCharacter() {
54 | $result = Requests_IDNAEncoder::encode("\xc2\xb6"); // Pilcrow character
55 | $this->assertEquals('xn--tba', $result);
56 | }
57 |
58 | public function testThreeByteCharacter() {
59 | $result = Requests_IDNAEncoder::encode("\xe2\x82\xac"); // Euro symbol
60 | $this->assertEquals('xn--lzg', $result);
61 | }
62 |
63 | public function testFourByteCharacter() {
64 | $result = Requests_IDNAEncoder::encode("\xf0\xa4\xad\xa2"); // Chinese symbol?
65 | $this->assertEquals('xn--ww6j', $result);
66 | }
67 |
68 | /**
69 | * @expectedException Requests_Exception
70 | */
71 | public function testFiveByteCharacter() {
72 | $result = Requests_IDNAEncoder::encode("\xfb\xb6\xb6\xb6\xb6");
73 | }
74 |
75 | /**
76 | * @expectedException Requests_Exception
77 | */
78 | public function testSixByteCharacter() {
79 | $result = Requests_IDNAEncoder::encode("\xfd\xb6\xb6\xb6\xb6\xb6");
80 | }
81 |
82 | /**
83 | * @expectedException Requests_Exception
84 | */
85 | public function testInvalidASCIICharacterWithMultibyte() {
86 | $result = Requests_IDNAEncoder::encode("\0\xc2\xb6");
87 | }
88 |
89 | /**
90 | * @expectedException Requests_Exception
91 | */
92 | public function testUnfinishedMultibyte() {
93 | $result = Requests_IDNAEncoder::encode("\xc2");
94 | }
95 |
96 | /**
97 | * @expectedException Requests_Exception
98 | */
99 | public function testPartialMultibyte() {
100 | $result = Requests_IDNAEncoder::encode("\xc2\xc2\xb6");
101 | }
102 | }
--------------------------------------------------------------------------------
/vendor/rmccue/requests/library/Requests/Response.php:
--------------------------------------------------------------------------------
1 | headers = new Requests_Response_Headers();
21 | $this->cookies = new Requests_Cookie_Jar();
22 | }
23 |
24 | /**
25 | * Response body
26 | *
27 | * @var string
28 | */
29 | public $body = '';
30 |
31 | /**
32 | * Raw HTTP data from the transport
33 | *
34 | * @var string
35 | */
36 | public $raw = '';
37 |
38 | /**
39 | * Headers, as an associative array
40 | *
41 | * @var Requests_Response_Headers Array-like object representing headers
42 | */
43 | public $headers = array();
44 |
45 | /**
46 | * Status code, false if non-blocking
47 | *
48 | * @var integer|boolean
49 | */
50 | public $status_code = false;
51 |
52 | /**
53 | * Protocol version, false if non-blocking
54 | * @var float|boolean
55 | */
56 | public $protocol_version = false;
57 |
58 | /**
59 | * Whether the request succeeded or not
60 | *
61 | * @var boolean
62 | */
63 | public $success = false;
64 |
65 | /**
66 | * Number of redirects the request used
67 | *
68 | * @var integer
69 | */
70 | public $redirects = 0;
71 |
72 | /**
73 | * URL requested
74 | *
75 | * @var string
76 | */
77 | public $url = '';
78 |
79 | /**
80 | * Previous requests (from redirects)
81 | *
82 | * @var array Array of Requests_Response objects
83 | */
84 | public $history = array();
85 |
86 | /**
87 | * Cookies from the request
88 | *
89 | * @var Requests_Cookie_Jar Array-like object representing a cookie jar
90 | */
91 | public $cookies = array();
92 |
93 | /**
94 | * Is the response a redirect?
95 | *
96 | * @return boolean True if redirect (3xx status), false if not.
97 | */
98 | public function is_redirect() {
99 | $code = $this->status_code;
100 | return in_array($code, array(300, 301, 302, 303, 307)) || $code > 307 && $code < 400;
101 | }
102 |
103 | /**
104 | * Throws an exception if the request was not successful
105 | *
106 | * @throws Requests_Exception If `$allow_redirects` is false, and code is 3xx (`response.no_redirects`)
107 | * @throws Requests_Exception_HTTP On non-successful status code. Exception class corresponds to code (e.g. {@see Requests_Exception_HTTP_404})
108 | * @param boolean $allow_redirects Set to false to throw on a 3xx as well
109 | */
110 | public function throw_for_status($allow_redirects = true) {
111 | if ($this->is_redirect()) {
112 | if (!$allow_redirects) {
113 | throw new Requests_Exception('Redirection not allowed', 'response.no_redirects', $this);
114 | }
115 | }
116 | elseif (!$this->success) {
117 | $exception = Requests_Exception_HTTP::get_class($this->status_code);
118 | throw new $exception(null, $this);
119 | }
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/lib/cache.php:
--------------------------------------------------------------------------------
1 | connect(REDIS_HOST, REDIS_PORT);
8 | }
9 | return self::$_instance;
10 | }
11 |
12 | public static function exists($key) {
13 | if (defined('REDIS_LOG') && REDIS_LOG) {
14 | echo "[".date('Y-m-d H:i:s')."][REDIS][exists] ".$key."\n";
15 | }
16 | return CACHE::getInstance()->exists($key);
17 | }
18 |
19 | public static function get($key) {
20 | if (defined('REDIS_LOG') && REDIS_LOG) {
21 | echo "[".date('Y-m-d H:i:s')."][REDIS][get] ".$key."\n";
22 | }
23 | if (CACHE::getInstance()->exists($key)) {
24 | $r = CACHE::getInstance()->get($key);
25 | return $r;
26 | }
27 | }
28 |
29 | public static function set($key, $val, $exp=null) {
30 | if (defined('REDIS_LOG') && REDIS_LOG) {
31 | echo "[".date('Y-m-d H:i:s')."][REDIS][set] ".$key."\n";
32 | }
33 | CACHE::getInstance()->set($key, $val, $exp);
34 | }
35 |
36 | public static function setEx($key, $exp, $val) {
37 | if (defined('REDIS_LOG') && REDIS_LOG) {
38 | echo "[".date('Y-m-d H:i:s')."][REDIS][setEx] ".$key."\n";
39 | }
40 | CACHE::getInstance()->setEx($key, $exp, $val);
41 | }
42 |
43 | public static function del($key) {
44 | if (defined('REDIS_LOG') && REDIS_LOG) {
45 | echo "[".date('Y-m-d H:i:s')."][REDIS][del] ".$key."\n";
46 | }
47 | CACHE::getInstance()->del($key);
48 | }
49 |
50 | public static function mGet($keys) {
51 | if (defined('REDIS_LOG') && REDIS_LOG) {
52 | echo "[".date('Y-m-d H:i:s')."][REDIS][mGet] ".implode('_', $keys)."\n";
53 | }
54 | CACHE::getInstance()->mGet($keys);
55 | }
56 |
57 | public static function mSet($kvs) {
58 | if (defined('REDIS_LOG') && REDIS_LOG) {
59 | echo "[".date('Y-m-d H:i:s')."][REDIS][mSet] ".implode('_', array_keys($kvs))."\n";
60 | }
61 | CACHE::getInstance()->mSet($kvs);
62 | }
63 |
64 | public static function sAdd($key, $val) {
65 | if (defined('REDIS_LOG') && REDIS_LOG) {
66 | echo "[".date('Y-m-d H:i:s')."][REDIS][sAdd] ".$key."\n";
67 | }
68 | CACHE::getInstance()->sAdd($key, $val);
69 | }
70 |
71 | public static function sIsMember($key, $val) {
72 | if (defined('REDIS_LOG') && REDIS_LOG) {
73 | echo "[".date('Y-m-d H:i:s')."][REDIS][sIsMember] ".$key."\n";
74 | }
75 | CACHE::getInstance()->sIsMember($key, $val);
76 | }
77 |
78 | public static function sContains($key, $val) {
79 | if (defined('REDIS_LOG') && REDIS_LOG) {
80 | echo "[".date('Y-m-d H:i:s')."][REDIS][sContains] ".$key."\n";
81 | }
82 | CACHE::getInstance()->sContains($key, $val);
83 | }
84 |
85 | public static function sSize($key) {
86 | if (defined('REDIS_LOG') && REDIS_LOG) {
87 | echo "[".date('Y-m-d H:i:s')."][REDIS][sSize] ".$key."\n";
88 | }
89 | CACHE::getInstance()->sSize($key);
90 | }
91 |
92 | public static function flushAll() {
93 | if (defined('REDIS_LOG') && REDIS_LOG) {
94 | echo "[".date('Y-m-d H:i:s')."][REDIS][flushAll] "."\n";
95 | }
96 | CACHE::getInstance()->flushAll();
97 | }
98 | }
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam15_direct_write_result.php:
--------------------------------------------------------------------------------
1 | enableHttpCompression(true);
13 |
14 | $db->write("DROP TABLE IF EXISTS summing_url_views");
15 | $db->write('
16 | CREATE TABLE IF NOT EXISTS summing_url_views (
17 | event_date Date DEFAULT toDate(event_time),
18 | event_time DateTime,
19 | url_hash String,
20 | site_id Int32,
21 | views Int32,
22 | v_00 Int32,
23 | v_55 Int32
24 | )
25 | ENGINE = SummingMergeTree(event_date, (site_id, url_hash, event_time, event_date), 8192)
26 | ');
27 |
28 | echo "Table EXISTS: " . json_encode($db->showTables()) . "\n";
29 |
30 | echo $db->showCreateTable('summing_url_views');
31 |
32 | // -------------------------------- CREATE csv file ----------------------------------------------------------------
33 |
34 |
35 | $file_data_names = [
36 | '/tmp/clickHouseDB_test.1.data',
37 | '/tmp/clickHouseDB_test.2.data',
38 | ];
39 |
40 | foreach ($file_data_names as $file_name) {
41 | \ClickHouseDB\Example\Helper::makeSomeDataFile($file_name, 2);
42 | }
43 |
44 | // ----------------------------------------------------------------------------------------------------
45 |
46 | echo "insert ALL file async:\n";
47 |
48 | $time_start = microtime(true);
49 | $result_insert = $db->insertBatchFiles('summing_url_views', $file_data_names, [
50 | 'event_time', 'url_hash', 'site_id', 'views', 'v_00', 'v_55'
51 | ]);
52 |
53 | echo "use time:" . round(microtime(true) - $time_start, 2) . "\n";
54 | print_r($db->select('select sum(views) from summing_url_views')->rows());
55 | // ------------------------------------------------------------------------------------------------
56 | $WriteToFile=new ClickHouseDB\Query\WriteToFile('/tmp/_1_select.csv');
57 | $statement=$db->select('select * from summing_url_views',[],null,$WriteToFile);
58 | print_r($statement->info());
59 |
60 | //
61 | $db->selectAsync('select * from summing_url_views limit 4',[],null,new ClickHouseDB\Query\WriteToFile('/tmp/_2_select.csv'));
62 | $db->selectAsync('select * from summing_url_views limit 4',[],null,new ClickHouseDB\Query\WriteToFile('/tmp/_3_select.tab',true,'TabSeparatedWithNames'));
63 | $db->selectAsync('select * from summing_url_views limit 4',[],null,new ClickHouseDB\Query\WriteToFile('/tmp/_4_select.tab',true,'TabSeparated'));
64 | $statement=$db->selectAsync('select * from summing_url_views limit 54',[],null,new ClickHouseDB\Query\WriteToFile('/tmp/_5_select.csv',true,ClickHouseDB\Query\WriteToFile::FORMAT_CSV));
65 | $db->executeAsync();
66 |
67 | print_r($statement->info());
68 | echo "END SELECT\n";
69 |
70 |
71 | echo "TRY GZIP\n";
72 |
73 | $WriteToFile=new ClickHouseDB\Query\WriteToFile('/tmp/_0_select.csv.gz');
74 | $WriteToFile->setFormat(ClickHouseDB\Query\WriteToFile::FORMAT_TabSeparatedWithNames);
75 | $WriteToFile->setGzip(true);// cat /tmp/_0_select.csv.gz | gzip -dc > /tmp/w.result
76 |
77 | $statement=$db->select('select * from summing_url_views',[],null,$WriteToFile);
78 | print_r($statement->info());
79 |
80 | echo "OK!\n\n";
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam05_error_async.php:
--------------------------------------------------------------------------------
1 | selectAsync('SELECT {num} as num',['num'=>$f]);
17 | }
18 | $db->executeAsync();
19 | for ($f=0;$f<1000;$f++)
20 | {
21 | $c=$list[$f];
22 |
23 | echo $f."\t";
24 | $ret='-';
25 | try{
26 | $ret=$c->fetchOne('num');
27 | }catch (Exception $e)
28 | {
29 |
30 | }
31 |
32 |
33 | echo "$ret\n";
34 | }
35 |
36 | // -------------------------------- ------- ----------------------------------------------------------------
37 |
38 |
39 |
40 |
41 | $db->write("DROP TABLE IF EXISTS summing_url_views");
42 | $db->write('
43 | CREATE TABLE IF NOT EXISTS summing_url_views (
44 | event_date Date DEFAULT toDate(event_time),
45 | event_time DateTime,
46 | url_hash String,
47 | site_id Int32,
48 | views Int32,
49 | v_00 Int32,
50 | v_55 Int32
51 | )
52 | ENGINE = SummingMergeTree(event_date, (site_id, url_hash, event_time, event_date), 8192)
53 | ');
54 |
55 | echo "Table EXISTSs:" . json_encode($db->showTables()) . "\n";
56 |
57 | // -------------------------------- CREATE csv file ----------------------------------------------------------------
58 | $file_data_names = [
59 | '/tmp/clickHouseDB_test.1.data',
60 | '/tmp/clickHouseDB_test.2.data',
61 | ];
62 |
63 | foreach ($file_data_names as $file_name) {
64 | \ClickHouseDB\Example\Helper::makeSomeDataFile($file_name, 1);
65 | }
66 | // ----------------------------------------------------------------------------------------------------
67 |
68 | echo "insert ONE file:\n";
69 |
70 | $time_start = microtime(true);
71 | $version_test = 3;
72 |
73 | if ($version_test == 1) {
74 | $statselect1 = $db->selectAsync('SELECT * FROM summing_url_views LIMIT 1');
75 | $statselect2 = $db->selectAsync('SELECT * FROM summing_url_views LIMIT 1');
76 |
77 | $stat = $db->insertBatchFiles('summing_url_views', ['/tmp/clickHouseDB_test.1.data'], [
78 | 'event_time', 'url_hash', 'site_id', 'views', 'v_00', 'v_55'
79 | ]);
80 |
81 | // 'Exception' with message 'Queue must be empty, before insertBatch,need executeAsync'
82 | }
83 |
84 | //
85 | if ($version_test == 2) {
86 | $statselect1 = $db->selectAsync('SELECT * FROM summing_url_views LIMIT 1');
87 | print_r($statselect1->rows());
88 | // 'Exception' with message 'Not have response'
89 | }
90 |
91 | // good
92 | if ($version_test == 3) {
93 | $statselect2 = $db->selectAsync('SELECT * FROM summing_url_views LIMIT 1');
94 | $db->executeAsync();
95 |
96 | $stat = $db->insertBatchFiles('summing_url_views', ['/tmp/clickHouseDB_test.1.data'], [
97 | 'event_time', 'url_hash', 'site_id', 'views', 'v_00', 'v_55'
98 | ]);
99 |
100 | $statselect1 = $db->selectAsync('SELECT * FROM summing_url_views LIMIT 1');
101 | $db->executeAsync();
102 |
103 | print_r($statselect1->rows());
104 | }
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/vendor/smi2/phpclickhouse/example/exam09_drop_partitions.php:
--------------------------------------------------------------------------------
1 | write("DROP TABLE IF EXISTS summing_partions_views");
15 | $db->write('
16 | CREATE TABLE IF NOT EXISTS summing_partions_views (
17 | event_date Date DEFAULT toDate(event_time),
18 | event_time DateTime,
19 | site_id Int32,
20 | hash_id Int32,
21 | views Int32
22 | )
23 | ENGINE = SummingMergeTree(event_date, (site_id,hash_id, event_time, event_date), 8192)
24 | ');
25 |
26 | echo "Table EXISTS:" . json_encode($db->showTables()) . "\n";
27 | echo "----------------------------------- CREATE csv file -----------------------------------------------------------------\n";
28 |
29 |
30 | $file_data_names = [
31 | '/tmp/clickHouseDB_test.part.1.data',
32 | '/tmp/clickHouseDB_test.part.2.data',
33 | '/tmp/clickHouseDB_test.part.3.data',
34 | ];
35 |
36 | $c = 0;
37 | foreach ($file_data_names as $file_name) {
38 | $c++;
39 | \ClickHouseDB\Example\Helper::makeSomeDataFileBigOldDates($file_name, $c);
40 | }
41 |
42 |
43 | echo "--------------------------------------- insert -------------------------------------------------------------\n";
44 | echo "insert ALL file async + GZIP:\n";
45 |
46 | $db->enableHttpCompression(true);
47 | $time_start = microtime(true);
48 |
49 | $result_insert = $db->insertBatchFiles('summing_partions_views', $file_data_names, [
50 | 'event_time', 'site_id', 'hash_id', 'views'
51 | ]);
52 |
53 | echo "use time:" . round(microtime(true) - $time_start, 2) . " sec.\n";
54 |
55 | foreach ($result_insert as $fileName => $state) {
56 | echo "$fileName => " . json_encode($state->info_upload()) . "\n";
57 | }
58 | }
59 |
60 |
61 | echo "--------------------------------------- select -------------------------------------------------------------\n";
62 |
63 | print_r($db->select('select min(event_date),max(event_date) from summing_partions_views ')->rows());
64 |
65 | echo "--------------------------------------- list partitions -------------------------------------------------------------\n";
66 |
67 | echo "databaseSize : " . json_encode($db->databaseSize()) . "\n";
68 | echo "tableSize : " . json_encode($db->tableSize('summing_partions_views')) . "\n";
69 | echo "partitions : " . json_encode($db->partitions('summing_partions_views', 2)) . "\n";
70 |
71 |
72 | echo "--------------------------------------- drop partitions -------------------------------------------------------------\n";
73 |
74 | echo "dropOldPartitions -30 days : " . json_encode($db->dropOldPartitions('summing_partions_views', 30)) . "\n";
75 |
76 | echo "--------------------------------------- list partitions -------------------------------------------------------------\n";
77 |
78 | echo "databaseSize : " . json_encode($db->databaseSize()) . "\n";
79 | echo "tableSize : " . json_encode($db->tableSize('summing_partions_views')) . "\n";
80 | echo "partitions : " . json_encode($db->partitions('summing_partions_views', 2)) . "\n";
81 |
82 |
--------------------------------------------------------------------------------