-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtaskconfig.example.php
More file actions
executable file
·584 lines (559 loc) · 26.3 KB
/
taskconfig.example.php
File metadata and controls
executable file
·584 lines (559 loc) · 26.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
<?php
/*
* define your tasks here
*
* Syntax: 'taskname' => array('Classname', 'method')
* OR 'taskname' => array('Classname', 'method', array('some' => 'additional', 'config' => 'parameters))
* OR 'taskname' => 'Classname' to use the method 'execute' and no config parameters
*
* the defined method is called with the parameters $params, $config, $job and $worker
*/
$config['tasks'] = array();
/*
* stores/caches the given params as data
* params:
* any string, number, bool or array to store under the given key
*/
$config['tasks']['store'] = array('\\CacheQueue\\Task\\Misc', 'store');
/*
* reads and stores the content of a url
* params:
* an array of
* 'url' => 'the absolute URL (or anything which is readable by fopen) to get the content from (see http://www.php.net/manual/en/wrappers.php)'
* 'context' => '(optional), an array of context options to use or false/null to nut use a context (see http://www.php.net/manual/en/function.stream-context-create.php)'
* 'format' => '(optional), either 'json' to json_decode the value before saved, or 'xml' to docode as xml and save as SimpleXMLElement'
* 'disableErrorLog' => (optional) true to not log errors (url not found, 404 error, ..)
*/
$config['tasks']['loadurl'] = array('\\CacheQueue\\Task\\Misc', 'loadUrl');
/*
* get donreach share counts of an url
*
* @see https://donreach.com/social-share-count
*
* params:
* an array with
* 'url' => 'the url to get the social shares for'
* 'providers' => 'comma separated list of providers, e.g. "twitter,facebook,linkedin" or "all"'
*
* options:
* 'endpoint' => 'the donreach api url, e.g. "https://count.donreach.com/"'
*/
$config['tasks']['donreach'] = array('\\CacheQueue\\Task\\Social', 'getDonReachShares', array(
'endpoint' => 'https://count.donreach.com/'
));
/*
* get the retweets of a url
*
* params:
* the absolute URL to get twitter retweets for as string
*/
$config['tasks']['retweets'] = array('\\CacheQueue\\Task\\Social', 'getRetweets');
/*
* get the likes of a url
* params:
* the absolute URL to get facebook likes for as string
*/
$config['tasks']['likes'] = array('\\CacheQueue\\Task\\Social', 'getLikes');
/*
* get the google plus one hits of a url
* params:
* the absolute URL to get google plus ones for as string
*/
$config['tasks']['plusones'] = array('\\CacheQueue\\Task\\Social', 'getPlusOnes');
/*
* get the xing shares of a url
* params:
* the absolute URL to get xing shares for as string
*/
$config['tasks']['xingshares'] = array('\\CacheQueue\\Task\\Social', 'getXingShares');
/*
* get twitter timeline
* you need a twitter app to use this.
* https://dev.twitter.com/
*
* params:
* an array with
* 'screen_name' => 'the twitter screen_name (optional if user_id is provided)'
* 'user_id' => 'the twitter user_id (optional if screen_name is provided)'
* 'limit' => 'max number of results (optional, default 30)'
* 'filter' => 'a regular expression to fiter the tweets for (optional, default none)' //example: "/#blog/i"
* 'update' => 'true to keep old entries if not enough new data, false to completely overwrite old data. (optional, default false)'
*
* options:
* 'consumerKey' => 'the consumer key of your twitter application'
* 'consumerSecret' => 'the consumer secret of your twitter application'
*/
$config['tasks']['timeline'] = array('\\CacheQueue\\Task\\Social', 'getTwitterTimeline', array(
'consumerKey' => 'the consumer key of your twitter application',
'consumerSecret' => 'the consumer secret of your twitter application'
));
/*
* get twitter search results
* you need a twitter app to use this.
* https://dev.twitter.com/
*
* params: all available params at https://dev.twitter.com/docs/api/1.1/get/search/tweets
* an array with any valid parameter available at https://dev.twitter.com/docs/api/1.1/get/search/tweets
* only required parameter is the search query "q" (parameters MUST NOT be URL-Encoded)
*
* options:
* 'consumerKey' => 'the consumer key of your twitter application'
* 'consumerSecret' => 'the consumer secret of your twitter application'
*/
$config['tasks']['twittersearch'] = array('\\CacheQueue\\Task\\Social', 'getTwitterSearchResults', array(
'consumerKey' => 'the consumer key of your twitter application',
'consumerSecret' => 'the consumer secret of your twitter application'
));
/*
* oAuth2 / API v3 version!
*
* get analytics metric (pageviews, visits, ...) of a given url or set of urls
* you need a registered oAuth2 application on the server/task side,
* and an Analytics Account and a refresh token on the client side
*
* this task requires the "google/apiclient": "1.0.*" in you composer.json
*
* register your oAuth2 application here to get a consumerKey/Secret
* https://code.google.com/apis/console/
*
* You can retrieve a refresh token here:
* https://developers.google.com/oauthplayground/
* first, click the configuration button, check "Use your own OAuth credentials"
* and add your client ID/secret, then
* select "Google Analytics API v3" on the left and choose "https://www.googleapis.com/auth/analytics.readonly", click "Authorize APIs", then "Exchange authorization code for tokens"
* use the refresh token on the client side when queueing the analytics task
*
* params:
* an array with
* 'metric' => 'the metric to recieve (without the "ga:"-prefix, e.g. 'pageviews', 'visits', ...)',
* 'pagePath' => 'the (absolute) path to get pageviews for (e.g. /blog/my-post/) / can be a regular expression for some operators'
* 'hostname' => 'the hostname to filter for. (optional, e.g. example.com)'
* 'operator' => 'the filter operator for the pagePath (not URL encoded). optional, default is '==' (see https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters)
* 'refreshToken' => 'the oAuth2 refresh token'
* 'profileId' => 'the Google Analytics profile ID'
* 'dateFrom' => 'the start date (optional), format YYYY-MM-DD, default is 2005-01-01
* 'dateTo' => 'the end date (optional), format YYYY-MM-DD, default is current day
* 'splitDays' => optional, default false; split the request in date-ranges of splitDays each and merge them afterwards.
* this is to prevent sampling of the google data. recommended value depends on actual page size and age.
* keep in mind that large date-ranges result in many requests, so for a dateFrom 1 month ago, you should use a
* splitDays of 10 days or more, not recommended for ranges > 2 month
* 'bulkCacheTime' => do a bulk request, cache the result for this many seconds and filter the result locally (optional, default = 0)
* using a bulk-cache will reduce the number of google API requests, but may result in slower execution and older data
* 'bulkCacheFilters' => a filter rule for the bulkcache (example: "ga:hostname==example.com;ga:pagePath=~^/blog/", optional), the bulkcache will contain all urls (see https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters)
* 'bulkCacheSplitDays' => optional, default false; split the bulk requests in date-ranges of bulkCacheSplitDays each and merge them afterwards.
* this is to prevent sampling of the google data. recommended value depends on actual page size and age.
* keep in mind that large date-ranges result in many requests, so for a dateFrom 1 month ago, you should use a
* bulkCacheSplitDays of 10 days or more, not recommended for ranges > 2 month
*
* options:
* 'applicationName' => 'name of your application'
* 'clientKey' => 'the client key'
* 'clientSecret' => 'the client secret'
* 'googleConfigIniLocation' => 'location of the google client config.ini file' (optional)
*/
$config['tasks']['gametric'] = array('\\CacheQueue\\Task\\Analytics', 'getMetric', array(
'applicationName' => 'yourApp',
'clientKey' => 'yourkey.apps.googleusercontent.com',
'clientSecret' => 'YourClientSecret',
'googleConfigIniLocation' => null
));
/*
* get analytics pageviews of a given url or set of urls
*
* @deprecated
* same as gametric task with metric 'pageviews'
*/
$config['tasks']['pageviews'] = array('\\CacheQueue\\Task\\Analytics', 'getPageviews', array(
'applicationName' => 'yourApp',
'clientKey' => 'yourkey.apps.googleusercontent.com',
'clientSecret' => 'YourClientSecret',
'googleConfigIniLocation' => null
));
/*
* get analytics visits of a given url or set of urls
*
* @deprecated
* same as gametric task with metric 'visits'
*/
$config['tasks']['visits'] = array('\\CacheQueue\\Task\\Analytics', 'getVisits', array(
'applicationName' => 'yourApp',
'clientKey' => 'yourkey.apps.googleusercontent.com',
'clientSecret' => 'YourClientSecret',
'googleConfigIniLocation' => null
));
/*
* oAuth2 / API v3 version!
*
* get analytics eventdata (count and score) of a specific event
* you need a registered oAuth2 application on the server/task side,
* and an Analytics Account and a refresh token on the client side
*
* this task requires the "google/apiclient": "1.0.*" in you composer.json
*
* register your oAuth2 application here to get a consumerKey/Secret
* https://code.google.com/apis/console/
*
* You can retrieve a refresh token here:
* https://developers.google.com/oauthplayground/
* first, click the configuration button, check "Use your own OAuth credentials"
* and add your client ID/secret, then
* select "Google Analytics API v3" on the left and choose "https://www.googleapis.com/auth/analytics.readonly", click "Authorize APIs", then "Exchange authorization code for tokens"
* use the refresh token on the client side when queueing the analytics task
*
* params:
* an array with
* 'eventCategory' => 'the event category'
* 'eventAction' => 'the event action'
* 'refreshToken' => 'the oAuth2 refresh token'
* 'profileId' => 'the Google Analytics profile ID'
* 'dateFrom' => 'the start date (optional), format YYYY-MM-DD, default is 2005-01-01
* 'dateTo' => 'the end date (optional), format YYYY-MM-DD, default is current day
*
* options:
* 'clientKey' => 'the client key'
* 'clientSecret' => 'the client secret'
* 'googleConfigIniLocation' => 'location of the google client config.ini file' (optional)
*/
$config['tasks']['eventdata'] = array('\\CacheQueue\\Task\\Analytics', 'getEventData', array(
'clientKey' => 'yourkey.apps.googleusercontent.com',
'clientSecret' => 'YourClientSecret',
'googleConfigIniLocation' => null
));
/*
* oAuth2 / API v3 version!
*
* get list of urls ith the most pageviews/visits
* you need a registered oAuth2 application on the server/task side,
* and an Analytics Account and a refresh token on the client side
*
* this task requires the "google/apiclient": "1.0.*" in you composer.json
*
* register your oAuth2 application here to get a consumerKey/Secret
* https://code.google.com/apis/console/
*
* You can retrieve a refresh token here:
* https://developers.google.com/oauthplayground/
* first, click the configuration button, check "Use your own OAuth credentials"
* and add your client ID/secret, then
* select "Google Analytics API v3" on the left and choose "https://www.googleapis.com/auth/analytics.readonly", click "Authorize APIs", then "Exchange authorization code for tokens"
* use the refresh token on the client side when queueing the analytics task
*
* params:
* an array with
* 'pagePath' => 'the (absolute) path to get pageviews for (e.g. /blog/my-post/) / can be a regular expression for some operators'
* 'hostname' => 'the hostname to filter for. (optional, e.g. example.com)'
* 'operator' => 'the filter operator for the pagePath (not URL encoded). optional, default is '==' (see https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters)
* 'count' => 'limit results to this number (overwrites count option)',
* 'metric' => 'the metric to use (pageviews, uniquePageviews, visits, .., default = pageviews)',
* 'dateFrom' => 'only consider pageviews newer than his date (format Y-m-d). optional, default is 2005-01-01.',
* 'dateTo' => 'only consider pageviews older than his date (format Y-m-d). optional, default is the current day.'
* 'refreshToken' => 'the oAuth2 refresh token'
* 'profileId' => 'the Google Analytics profile ID'
*
* options:
* 'clientKey' => 'the client key'
* 'clientSecret' => 'the client secret',
* 'count' => 'limit results to this number (can be overwritten by the count parameter)'
* 'googleConfigIniLocation' => 'location of the google client config.ini file' (optional)
*/
$config['tasks']['topurls'] = array('\\CacheQueue\\Task\\Analytics', 'getTopUrls', array(
'clientKey' => 'yourkey.apps.googleusercontent.com',
'clientSecret' => 'YourClientSecret',
'count' => 20,
'googleConfigIniLocation' => null
));
/*
* oAuth2 / API v3 version!
*
* get list of keywords with the most pageviews/visits
* you need a registered oAuth2 application on the server/task side,
* and an Analytics Account and a refresh token on the client side
*
* this task requires the "google/apiclient": "1.0.*" in you composer.json
*
* register your oAuth2 application here to get a consumerKey/Secret
* https://code.google.com/apis/console/
*
* You can retrieve a refresh token here:
* https://developers.google.com/oauthplayground/
* first, click the configuration button, check "Use your own OAuth credentials"
* and add your client ID/secret, then
* select "Google Analytics API v3" on the left and choose "https://www.googleapis.com/auth/analytics.readonly", click "Authorize APIs", then "Exchange authorization code for tokens"
* use the refresh token on the client side when queueing the analytics task
*
* params:
* an array with
* 'pagePath' => 'the (absolute) path to get pageviews for (e.g. /blog/my-post/) / can be a regular expression for some operators'
* 'hostname' => 'the hostname to filter for. (optional, e.g. example.com)'
* 'operator' => 'the filter operator for the pagePath (not URL encoded). optional, default is '==' (see https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters)
* 'count' => 'limit results to this number (overwrites count option)',
* 'metric' => 'the metric to use (pageviews, uniquePageviews, visits, .., default = pageviews)',
* 'dateFrom' => 'only consider pageviews newer than his date (format Y-m-d). optional, default is 2005-01-01.',
* 'dateTo' => 'only consider pageviews older than his date (format Y-m-d). optional, default is the current day.'
* 'refreshToken' => 'the oAuth2 refresh token'
* 'profileId' => 'the Google Analytics profile ID'
*
* options:
* 'clientKey' => 'the client key'
* 'clientSecret' => 'the client secret',
* 'count' => 'limit results to this number (can be overwritten by the count parameter)'
* 'googleConfigIniLocation' => 'location of the google client config.ini file' (optional)
*/
$config['tasks']['topkeywords'] = array('\\CacheQueue\\Task\\Analytics', 'getTopKeywords', array(
'clientKey' => 'yourkey.apps.googleusercontent.com',
'clientSecret' => 'YourClientSecret',
'count' => 100,
'googleConfigIniLocation' => null
));
/*
* oAuth2 / API v3 version!
*
* perform a custom analytics api request
* you need a registered oAuth2 application on the server/task side,
* and an Analytics Account and a refresh token on the client side
*
* this task requires the "google/apiclient": "1.0.*" in you composer.json
*
* register your oAuth2 application here to get a consumerKey/Secret
* https://code.google.com/apis/console/
*
* You can retrieve a refresh token here:
* https://developers.google.com/oauthplayground/
* first, click the configuration button, check "Use your own OAuth credentials"
* and add your client ID/secret, then
* select "Google Analytics API v3" on the left and choose "https://www.googleapis.com/auth/analytics.readonly", click "Authorize APIs", then "Exchange authorization code for tokens"
* use the refresh token on the client side when queueing the analytics task
*
* params:
* an array with
* 'profileId' => 'the Google Analytics profile ID',
* 'refreshToken' => 'the oAuth2 refresh token'
* 'metrics' => 'list of metrics e.g. 'ga:sessions,ga:pageviews' ',
* 'dateFrom' => 'the start date (optional), format YYYY-MM-DD, default is 2005-01-01
* 'dateTo' => 'the end date (optional), format YYYY-MM-DD, default is current day
* 'dimensions' => (optional) 'A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city''
* 'filters' => (optional) 'A comma-separated list of dimension or metric filters to be applied to Analytics data.'
* 'sort' => (optional) 'A comma-separated list of dimensions or metrics that determine the sort order for Analytics',
* 'maxResults' => (optional) 'The maximum number of entries to include in this feed.',
* 'startIndex' => (optional) 'An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.'
* 'segment' => (optional) 'An Analytics segment to be applied to data.',
* 'samplingLevel' => (optional) 'The desired sampling level.'
*
* options:
* 'applicationName' => 'name of your application'
* 'clientKey' => 'the client key'
* 'clientSecret' => 'the client secret'
* 'googleConfigIniLocation' => 'location of the google client config.ini file' (optional)
*
* returns:
* array(
* 'totalResults' => number of total results,
* 'totalsForAllResults' => array of aggregated totals for each metric
* 'containsSampledData' => boolean indication if results are based on sampled data
* 'results' => array of individual result rows, each containing an array of metric/dimension => value pairs
* )
*/
$config['tasks']['analytics'] = array('\\CacheQueue\\Task\\Analytics', 'customRequest', array(
'applicationName' => 'yourApp',
'clientKey' => 'yourkey.apps.googleusercontent.com',
'clientSecret' => 'YourClientSecret',
'googleConfigIniLocation' => null
));
/*
*
* get piwik metrics
* returns an array with responding metric data or false if the request fails
*
* params:
* an array with
* 'action' => 'the API-method to request (the part after "Action." (e.g. "get", "getPageUrl", "getPageUrls", ... see http://piwik.org/docs/analytics-api/reference/#Actions)
* 'period' => 'the period',
* 'date' => 'the date',
* 'segment' => 'the segment to filter for (optional, see http://piwik.org/docs/analytics-api/segmentation/),
* 'idSite' => 'the id of your site (optional, overwrites the idSite-option)',
* 'parameter' => additional parameters for the API as string (url=foo&whatever=bar) or as array(key => value), optional / example: array('pageUrl' => 'http%3A%2F%2Fexample.com%2Fpath%2F', 'expanded' => '1')
* 'returnSingle' => true or false (optional, default=false) if true, returns only the first result row, useful for 1-row-responses like "getPageUrl", "getPageTitle" or with filter_truncate=0,
* 'token' => 'your API token (token_auth) (optional if the token is supplied as option)'
*
* options:
* 'piwikUrl' => 'url to your piwik installation'
* 'token' => 'your API token (token_auth) (optional if the token is supplied as parameter)'
* 'idSite' => 'id of your site' (default="all")
* 'timeout' => 'number of seconds for a connection to wait for response (optional, default=15)'
*/
$config['tasks']['piwik'] = array('\\CacheQueue\\Task\\Piwik', 'doAction', array(
'piwikUrl' => 'https://piwik.example.com/',
'token' => '1234518881c0d5289e5feb3b0795b696',
//'idSite' => '1'
));
/*
* call the mailchimp api
*
* @see http://apidocs.mailchimp.com/api/2.0/
*
* this task requires the "mailchimp/mailchimp": ">=2.0.0" in you composer.json
* also, add the mailchimp repository to your composer.json:
* "repositories": [
* {
* "type": "vcs",
* "url": "https://bitbucket.org/mailchimp/mailchimp-api-php"
* }
* ],
*
* params:
* an array with
* 'method' => 'the API method to call',
* 'parameter' => required parameter for the method (optional, depends on method)
* as array('parameter_name' => 'parameter_value')
* see http://apidocs.mailchimp.com/api/1.3/#method-&-error-code-docs
*
* 'apiKey' => 'your mailchimp api key' (optional, overwrites the apiKey option)
* 'options' => array of options for the mailchimp client (optional, overwrites/merges the options option)
*
* options:
* 'apiKey' => 'your mailchimp api key'
* 'options' => array of options for the mailchimp client
*/
$config['tasks']['mailchimp'] = array('\\CacheQueue\\Task\\MailChimp', 'execute', array(
'apiKey' => 'your mailchimp api key',
'timeout' => 300,
'options' => array(
//'timeout' => 300, //server call timeout in seconds, default=600
//'debug' => false,
//'ssl_verifypeer' => null,
//'ssl_verifyhost' => null,
//'ssl_cainfo' => null
)
));
/*
* run a Symfony 1.x task
*
* the key will save the status code of the Symfony task.
*
* params:
* the Symfony cli command as string (Example: "cc", "doctrine:build --all --and-load")
*
* options:
* 'symfonyBaseDir' => 'full path to your symfony base'
* (usually where your symfony cli file is located,
* example: "/var/www/mySymfonyProject")
*/
$config['tasks']['symfony'] = array('\\CacheQueue\\Task\\Symfony', 'runTask', array(
'symfonyBaseDir' => "/var/www/mySymfonyProject"
));
/*
* run an SQL query (using PDO)
*
* if the 'return' parameter is not defined, the task returns true on success or false on failure
* for return = 'rowCount', returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
* for return = 'column', returns a single column
* for return = 'row', returns a row column
* for return = 'all', returns all rows as array
*
* params:
* an array with
* 'query' => 'a valid SQL statement' (can contain placeholders)
* 'parameter' => an array with the placeholder values (optional)
* 'return' => rowCount, column, row or all (optional)
* 'fetchStyle' => only for return = 'row' or return = 'all', the PDO::FETCH_STYLE (optional, default = PDO::FETCH_ASSOC)
* 'fetchArgument' => only for return = 'all' and certain fetchStyles (optional, see http://www.php.net/manual/de/pdostatement.fetchall.php)
* 'column' => only for return = 'column', the column number to return (optional, default = 0)
*
* 'dns' => 'a valid PDO DNS' (optional, overwrites the config-dns, see http://www.php.net/manual/de/pdo.connections.php)
* 'user' => 'username for the sql user' (optional, overwrites the config-user),
* 'pass' => 'password for the sql user' (optional, overwrites the config-pass,
* 'options' => 'additional driver options' (optional, overwrites the config-options)
*
*
*
* options:
* an array with
* 'dns' => 'a valid PDO DNS' (see http://www.php.net/manual/de/pdo.connections.php)
* 'user' => 'username for the sql user'
* 'pass' => 'password for the sql user'
* 'options' => 'additional driver options' (optional)
*/
$config['tasks']['pdo'] = array('\\CacheQueue\\Task\\PDO', 'execute', array(
'dns' => 'mysql:host=localhost;dbname=test',
'user' => 'root',
'pass' => 'rootpass',
'options' => array()
));
/*
* run multiple SQL query (using PDO)
*
* works the same way as the single query task, except that the parameters
* query, parameter, return, fetchStyle, fetchArgument and column must be arrays
* where the queries are grouped by array-key (can be numeric or string keys)
* the result is an array of the single results
*
* example for the params:
* array(
* 'query' => array('foobar'=>'SELECT foo, bar FROM baz WHERE foobar = ?', 'count'=>'SELECT COUNT(*) FROM baz', 'del'=>'DELETE FROM bar WHERE abc > ?'),
* 'parameter => array('foobar' => array('foobaz'), 'del' => array(1337)), //no parameter for second query
* 'return => array('foobar' => 'all', 'count' => 'column', 'del' => 'rowCount')
* )
* possible response:
* array(
* 'foobar' => array(array('foo'=>'foo1','bar'=>'bar1'),array('foo'=>'foo2','bar'=>'bar2')),
* 'count' => 987,
* 'del' => 125
* );
*
*
* if the 'return' parameter is not defined, the task returns true on success or false on failure
* for return = 'rowCount', returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
* for return = 'column', returns a single column
* for return = 'row', returns a row column
* for return = 'all', returns all rows as array
*
* params:
* an array with
* 'query' => 'a valid SQL statement' (can contain placeholders)
* 'parameter' => an array with the placeholder values (optional)
* 'return' => rowCount, column, row or all (optional)
* 'fetchStyle' => only for return = 'row' or return = 'all', the PDO::FETCH_STYLE (optional, default = PDO::FETCH_ASSOC)
* 'fetchArgument' => only for return = 'all' and certain fetchStyles (optional, see http://www.php.net/manual/de/pdostatement.fetchall.php)
* 'column' => only for return = 'column', the column number to return (optional, default = 0)
*
* 'dns' => 'a valid PDO DNS' (optional, overwrites the config-dns, see http://www.php.net/manual/de/pdo.connections.php)
* 'user' => 'username for the sql user' (optional, overwrites the config-user),
* 'pass' => 'password for the sql user' (optional, overwrites the config-pass,
* 'options' => 'additional driver options' (optional, overwrites the config-options)
*
*
*
* options:
* an array with
* 'dns' => 'a valid PDO DNS' (see http://www.php.net/manual/de/pdo.connections.php)
* 'user' => 'username for the sql user'
* 'pass' => 'password for the sql user'
* 'options' => 'additional driver options' (optional)
*/
$config['tasks']['pdomulti'] = array('\\CacheQueue\\Task\\PDO', 'execute', array(
'dns' => 'mysql:host=localhost;dbname=test',
'user' => 'root',
'pass' => 'rootpass',
'options' => array()
));
/*
* this is an fully featured example of a task declaration
* copy&paste this for your own tasks ;)
*
* params:
* an array with
* 'foo' => 'the foo'
* 'bar' => 'some bar or baz'
*
* options:
* an array with
* 'some' => 'options'
* 'for' => 'this task'
*/
$config['tasks']['example'] = array('YourClass', 'yourMethod', array(
'some' => 'options',
'for' => 'this task',
'defaultBar' => 'some bar or baz',
'login' => 'foobar',
'password' => 'password'
));