Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zuiketang
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
zuiketang
Commits
b84a5c0c
Commit
b84a5c0c
authored
Nov 05, 2016
by
xiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改计划任务
parent
e4482af5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
39 deletions
+52
-39
composer.json
src/composer.json
+5
-1
composer.lock
src/composer.lock
+27
-19
TaskController.php
src/console/controllers/TaskController.php
+18
-4
TestController.php
src/console/controllers/TestController.php
+2
-15
No files found.
src/composer.json
View file @
b84a5c0c
...
...
@@ -19,7 +19,7 @@
"light/yii2-xmlparser"
:
"*"
,
"2amigos/yii2-qrcode-helper"
:
"*"
,
"mobiledetect/mobiledetectlib"
:
"^2.8"
,
"hellogerard/jobby"
:
"
^3.2
"
"hellogerard/jobby"
:
"
3.0.3
"
},
"require-dev"
:
{
"yiisoft/yii2-codeception"
:
"*"
,
...
...
@@ -37,6 +37,10 @@
}
},
"repositories"
:
{
"0"
:
{
"type"
:
"vcs"
,
"url"
:
"https://github.com/xiabin/jobby"
},
"packagist"
:
{
"type"
:
"composer"
,
"url"
:
"https://packagist.phpcomposer.com"
...
...
src/composer.lock
View file @
b84a5c0c
...
...
@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "
98389e30accec6e0214a5c62f63fa0c7
",
"content-hash": "
6e4bc99038d76cec792f6922d0ec044b
",
"hash": "
17e02f1f07eb6d2fc16836b687cf5b9a
",
"content-hash": "
0e835b46915328a107628b0a6e87c672
",
"packages": [
{
"name": "2amigos/yii2-qrcode-helper",
...
...
@@ -528,16 +528,16 @@
},
{
"name": "hellogerard/jobby",
"version": "v3.
2.1
",
"version": "v3.
0.3
",
"source": {
"type": "git",
"url": "https://github.com/
jobbyphp
/jobby.git",
"reference": "
9cb65663d35f6abba7e2d28347d74d501ce94861
"
"url": "https://github.com/
xiabin
/jobby.git",
"reference": "
4701b60aeb36f7b90052d17dcd998171d11448c4
"
},
"dist": {
"type": "zip",
"url": "https://
packagist.phpcomposer.com/files/jobbyphp/jobby/9cb65663d35f6abba7e2d28347d74d501ce94861.zip
",
"reference": "
9cb65663d35f6abba7e2d28347d74d501ce94861
",
"url": "https://
api.github.com/repos/xiabin/jobby/zipball/4701b60aeb36f7b90052d17dcd998171d11448c4
",
"reference": "
4701b60aeb36f7b90052d17dcd998171d11448c4
",
"shasum": ""
},
"require": {
...
...
@@ -557,7 +557,11 @@
"Jobby\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"autoload-dev": {
"psr-4": {
"Jobby\\Tests\\": "tests"
}
},
"license": [
"MIT"
],
...
...
@@ -574,7 +578,10 @@
],
"description": "Manage all your cron jobs without modifying crontab. Handles locking, logging, error emails, and more.",
"homepage": "https://github.com/jobbyphp/jobby",
"time": "2016-09-15 20:29:16"
"support": {
"source": "https://github.com/xiabin/jobby/tree/v3.0.3"
},
"time": "2016-07-11 13:54:34"
},
{
"name": "jeremeamia/SuperClosure",
...
...
@@ -881,16 +888,16 @@
},
{
"name": "qiniu/php-sdk",
"version": "v7.
0.8
",
"version": "v7.
1.1
",
"source": {
"type": "git",
"url": "https://github.com/qiniu/php-sdk.git",
"reference": "
d1bca450b56d85beb7ba21f374a47bfeb59c288b
"
"reference": "
e9cdc254c95188c8d13e0f04fab9648d790c42f9
"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/qiniu/php-sdk/
d1bca450b56d85beb7ba21f374a47bfeb59c288b
.zip",
"reference": "
d1bca450b56d85beb7ba21f374a47bfeb59c288b
",
"url": "https://packagist.phpcomposer.com/files/qiniu/php-sdk/
e9cdc254c95188c8d13e0f04fab9648d790c42f9
.zip",
"reference": "
e9cdc254c95188c8d13e0f04fab9648d790c42f9
",
"shasum": ""
},
"require": {
...
...
@@ -928,7 +935,7 @@
"sdk",
"storage"
],
"time": "2016-
07-19 06:18:08
"
"time": "2016-
11-02 03:10:06
"
},
{
"name": "swiftmailer/swiftmailer",
...
...
@@ -1142,16 +1149,16 @@
},
{
"name": "yiisoft/yii2",
"version": "2.0.
9
",
"version": "2.0.
10
",
"source": {
"type": "git",
"url": "https://github.com/yiisoft/yii2-framework.git",
"reference": "
2b75151ea60e1fd820046416eee2e89c3dda1133
"
"reference": "
5bfcb7a6dfa9771e2248eb8c4448613330f343ff
"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/yiisoft/yii2-framework/
2b75151ea60e1fd820046416eee2e89c3dda1133
.zip",
"reference": "
2b75151ea60e1fd820046416eee2e89c3dda1133
",
"url": "https://packagist.phpcomposer.com/files/yiisoft/yii2-framework/
5bfcb7a6dfa9771e2248eb8c4448613330f343ff
.zip",
"reference": "
5bfcb7a6dfa9771e2248eb8c4448613330f343ff
",
"shasum": ""
},
"require": {
...
...
@@ -1232,7 +1239,7 @@
"framework",
"yii2"
],
"time": "2016-
07-11 13:36:42
"
"time": "2016-
10-20 12:02:50
"
},
{
"name": "yiisoft/yii2-bootstrap",
...
...
@@ -1587,6 +1594,7 @@
"codeception",
"yii2"
],
"abandoned": "codeception/codeception",
"time": "2016-03-17 03:41:26"
},
{
...
...
src/console/controllers/TaskController.php
View file @
b84a5c0c
...
...
@@ -16,12 +16,20 @@ class TaskController extends Controller
{
public
function
actionIndex
()
{
$jobby
=
new
Jobby
();
$phpBin
=
'/usr/local/webserver/php537/bin/php -c /usr/local/webserver/php537/etc/crontab.ini '
;
$yiiCommand
=
$phpBin
.
$_SERVER
[
'SCRIPT_FILENAME'
];
if
(
YII_ENV_DEV
)
{
$phpBin
=
'php '
;
}
else
{
$phpBin
=
'/usr/local/webserver/php537/bin/php -c /usr/local/webserver/php537/etc/crontab.ini '
;
}
$jobby
=
new
Jobby
(
[
'phpBinary'
=>
$phpBin
]
);
$yiiCommand
=
realpath
(
$_SERVER
[
'SCRIPT_FILENAME'
]);
$output
=
Yii
::
getAlias
(
'@runtime'
)
.
"/logs/jobs-"
.
date
(
'Y-m-d'
)
.
".log"
;
if
(
YII_
DEBUG
)
{
if
(
YII_
ENV_DEV
)
{
$time
=
date
(
'Y-m-d H:i:s'
);
$jobby
->
add
(
'CommandExample'
,
[
...
...
@@ -56,6 +64,12 @@ class TaskController extends Controller
'output'
=>
$output
,
'enabled'
=>
TRUE
]);
$jobby
->
add
(
'ClearUploadPool'
,
[
'command'
=>
"
$yiiCommand
test/index"
,
'schedule'
=>
'* * * * *'
,
//每隔两小时的第15分钟
'output'
=>
$output
,
'enabled'
=>
TRUE
]);
$jobby
->
run
();
}
...
...
src/console/controllers/TestController.php
View file @
b84a5c0c
...
...
@@ -10,25 +10,12 @@ namespace console\controllers;
use
yii\console\Controller
;
use
yii\log\Logger
;
class
TestController
extends
Controller
{
public
function
actionIndex
(){
$t
=
mktime
();
set_time_limit
(
1000
);
$myFile
=
"./insert.sql"
;
$fhandler
=
fopen
(
$myFile
,
'wb'
);
if
(
$fhandler
){
$sql
=
"268
\t
2
\t
'0,262,268,'
\t
0
\t
'2342'
\t
'423423'
\t
'123123'
\t
'23423423'
\t
'2012-01-09 09:55:43'
\t
'upload/product/20111205153432_53211.jpg'
\t
'upload/product/thumb_20111205153432_53211.jpg'
\t
NULL
\t
NULL
\t
38
\t
'件'
\t
''
\t
123
\t
123
\t
0"
;
$i
=
0
;
while
(
$i
<
10
)
//1,000,000
{
$i
++
;
fwrite
(
$fhandler
,
$sql
.
"
\r\n
"
);
}
echo
"写入成功,耗时:"
,
mktime
()
-
$t
;
}
\Yii
::
getLogger
()
->
log
(
'test/index'
,
Logger
::
LEVEL_INFO
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment