Skip to content

Commit a37a42f

Browse files
committed
initial commit
0 parents  commit a37a42f

File tree

14 files changed

+2217
-0
lines changed

14 files changed

+2217
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build
2+
vendor
3+
.phpstan.lock
4+
.phpunit.lock
5+
.php_cs.cache

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM php:7.3
2+
3+
RUN apt-get update && \
4+
apt-get upgrade -y && \
5+
apt-get install -y git && \
6+
apt-get install -y zip unzip && \
7+
apt-get install -y gnupg && \
8+
apt-get install -y wget
9+
10+
RUN wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add -
11+
RUN echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list
12+
13+
RUN apt-get update && \
14+
apt-get install -y mongodb-org
15+
16+
RUN docker-php-ext-install pcntl sysvmsg
17+
RUN pecl install mongodb && docker-php-ext-enable mongodb pcntl sysvmsg
18+
19+
# Install Composer
20+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

cgi-bin/cli.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
require "vendor/autoload.php";
5+
6+
define('SCHEDULERTESTING_PATH', realpath(__DIR__.DIRECTORY_SEPARATOR.'..'));
7+
define('SCHEDULERTESTING_CONFIG_DIR', constant('SCHEDULERTESTING_PATH').DIRECTORY_SEPARATOR.'config');
8+
9+
$composer = require 'vendor/autoload.php';
10+
$dic = SchedulerTesting\Bootstrap\ContainerBuilder::get($composer);
11+
$logger = $dic->get(\Psr\Log\LoggerInterface::class);
12+
13+
$shortopts = "c:";
14+
15+
$longopts = array(
16+
"controller:"
17+
);
18+
$options = getopt($shortopts, $longopts);
19+
20+
21+
if (isset($options['c'])) {
22+
switch ($options['c']) {
23+
case 'addJob':
24+
$logger->debug('add new job', [
25+
'category' => 'cli.php'
26+
]);
27+
$dic->get(SchedulerTesting\Job\JobHandling::class)->addJob();
28+
break;
29+
case 'runScheduler':
30+
$logger->debug('start scheduler', [
31+
'category' => 'cli.php'
32+
]);
33+
$dic->get(SchedulerTesting\Bootstrap\Cli::class)->process();
34+
break;
35+
case 'flushJobs':
36+
$logger->debug('flush all scheduler jobs', [
37+
'category' => 'cli.php'
38+
]);
39+
$dic->get(SchedulerTesting\Job\JobHandling::class)->flushJobs();
40+
break;
41+
default:
42+
$logger->error('undefined controller set', [
43+
'category' => 'cli.php'
44+
]);
45+
break;
46+
}
47+
} else {
48+
$logger->error('no controller set', [
49+
'category' => 'cli.php'
50+
]);
51+
}
52+
53+
?>

composer.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"autoload": {
3+
"psr-4": {
4+
"SchedulerTesting\\": "src/lib/"
5+
}
6+
},
7+
"require": {
8+
"ext-mongodb": "*",
9+
"mongodb/mongodb": "*",
10+
"psr/log": "^1.0.0",
11+
"gyselroth/mongodb-php-task-scheduler": "^4.0.0-alpha6",
12+
"monolog/monolog": "^2.0.0-beta1",
13+
"bramus/monolog-colored-line-formatter": "~2.0",
14+
"gyselroth/micro-container": "^2.3.3",
15+
"psr/container": "^1.0.0",
16+
"hassankhan/config": "^2.0.0",
17+
"symfony/yaml": "~3.1"
18+
}
19+
}

0 commit comments

Comments
 (0)