First file

This commit is contained in:
Michael RICOIS 2016-06-28 21:13:14 +02:00
parent 45423ad1d2
commit c1a5168cad
5 changed files with 619 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
/.settings/
/vendor/
/.buildpath
/.project

12
bin/job.php Normal file
View File

@ -0,0 +1,12 @@
<?php
require_once __DIR__ . '/../vendor/autoload.php';
$jobby = new Jobby\Jobby();
// Get Jobs config from database
// For each jobs add it to the queue
// Run
$jobby->run();

159
bin/sourceInpi.php Normal file
View File

@ -0,0 +1,159 @@
<?php
require_once __DIR__ . '/../vendor/autoload.php';
$jobby = new Jobby\Jobby();
/**
* Télécharge les fichiers OpenData Inpi
* wget
* --no-host-directories | -nH
* --recursive | -r
* --timestamping | -N
* --level=inf | -l inf
* --directory-prefix=/home/data/sources/inpi/ | -P/home/data/sources/inpi/
* --ftp-user=
* --ftp-password=
*/
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7)
# | | | | |
# * * * * * user-name command to be executed
// MARQUE
$jobby->add('FRMARQUE', [
'command' => 'wget --nH -r -N -linf -P/home/data/sources/inpi/FRMARQUE'.
' --ftp-user=Frmarque --ftp-password="F?marQu1" ftp://www.inpi.net/',
'schedule' => '01 19 * * 5',
'output' => '/home/scores/batch/shared/log/sourceinpi.log',
'enabled' => true,
'debug' => true,
]);
// MARQUES - Décisions d'opposition
$jobby->add('FRJUROPP', [
'command' => 'wget --nH -r -N -linf -P/home/data/sources/inpi/FRJUROPP'.
' --ftp-user=Frjuropp --ftp-password="F?jurOp2" ftp://www.inpi.net/',
'schedule' => '01 19 * * 5',
'output' => '/home/scores/batch/shared/log/sourceinpi.log',
'enabled' => false,
'debug' => true,
]);
// DESSINS & MODELES FR
$jobby->add('FRDESMOD', [
'command' => 'wget --nH -r -N -linf -P/home/data/sources/inpi/FRDESMOD'.
' --ftp-user=Frdesmod --ftp-password="F?d&mOd1" ftp://www.inpi.net/',
'schedule' => '01 19 * * 5',
'output' => '/home/scores/batch/shared/log/sourceinpi.log',
'enabled' => false,
'debug' => true,
]);
// DESSINS & MODELES INTERNATIONAL
$jobby->add('ITDESMOD', [
'command' => 'wget --nH -r -N -linf -P/home/data/sources/inpi/ITDESMOD'.
' --ftp-user=Itdesmod --ftp-password="I?td&Mo2" ftp://www.inpi.net/',
'schedule' => '01 19 * * 5',
'output' => '/home/scores/batch/shared/log/sourceinpi.log',
'enabled' => false,
'debug' => true,
]);
// BREVETS Notices FR
$jobby->add('BFRBIBLI', [
'command' => 'wget --nH -r -N -linf -P/home/data/sources/inpi/BFRBIBLI'.
' --ftp-user=Bfrbibli --ftp-password="B?rbiBl1" ftp://www.inpi.net/',
'schedule' => '01 19 * * 5',
'output' => '/home/scores/batch/shared/log/sourceinpi.log',
'enabled' => false,
'debug' => true,
]);
// BREVETS Fasicules PDF
$jobby->add('BFRFAPDF', [
'command' => 'wget --nH -r -N -linf -P/home/data/sources/inpi/BFRFAPDF'.
' --ftp-user=Bfrfapdf --ftp-password="B?rfaPd2" ftp://www.inpi.net/',
'schedule' => '01 19 * * 5',
'output' => '/home/scores/batch/shared/log/sourceinpi.log',
'enabled' => false,
'debug' => true,
]);
// BREVETS Fasicules TIFF - Impossible à récup en auto
$jobby->add('BFRFASCI', [
'command' => 'wget --nH -r -N -linf -P/home/data/sources/inpi/BFRFASCI'.
' --ftp-user=Bfrfasci --ftp-password="B?rfaSc1" ftp://www.inpi.net/',
'schedule' => '01 19 * * 5',
'output' => '/home/scores/batch/shared/log/sourceinpi.log',
'enabled' => false,
'debug' => true,
]);
// BREVETS Texte Intégrale OCRisés
$jobby->add('BFRTEXTE', [
'command' => 'wget --nH -r -N -linf -P/home/data/sources/inpi/BFRTEXTE'.
' --ftp-user=BfrTexte --ftp-password="B?rteXt1" ftp://www.inpi.net/',
'schedule' => '01 19 * * 5',
'output' => '/home/scores/batch/shared/log/sourceinpi.log',
'enabled' => false,
'debug' => true,
]);
// BREVETS européens Na
$jobby->add('BEPPHNAT', [
'command' => 'wget --nH -r -N -linf -P/home/data/sources/inpi/BEPPHNAT'.
' --ftp-user=Bepphnat --ftp-password="B?pphNa2" ftp://www.inpi.net/',
'schedule' => '01 19 * * 5',
'output' => '/home/scores/batch/shared/log/sourceinpi.log',
'enabled' => false,
'debug' => true,
]);
// BREVETS européens Fascicules traduits
$jobby->add('BEPFASCI', [
'command' => 'wget --nH -r -N -linf -P/home/data/sources/inpi/BEPFASCI'.
' --ftp-user=Bepfasci --ftp-password="B?pfaSc1" ftp://www.inpi.net/',
'schedule' => '01 19 * * 5',
'output' => '/home/scores/batch/shared/log/sourceinpi.log',
'enabled' => false,
'debug' => true,
]);
// Run
$jobby->run();

12
composer.json Normal file
View File

@ -0,0 +1,12 @@
{
"name": "scores/crony",
"authors": [
{
"name": "mricois",
"email": "mricois@scores-decisions.com"
}
],
"require": {
"hellogerard/jobby": "^3.0"
}
}

432
composer.lock generated Normal file
View File

@ -0,0 +1,432 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "6fc5b43a7356e2bc12e523b81ae96d81",
"content-hash": "4f89e8acc76d59ccae1751b29af1b3ca",
"packages": [
{
"name": "hellogerard/jobby",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/jobbyphp/jobby.git",
"reference": "a0ce1151e4c8fd4923f0c59db9be4fad855d20a4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jobbyphp/jobby/zipball/a0ce1151e4c8fd4923f0c59db9be4fad855d20a4",
"reference": "a0ce1151e4c8fd4923f0c59db9be4fad855d20a4",
"shasum": ""
},
"require": {
"jeremeamia/superclosure": "^2.2",
"mtdowling/cron-expression": "^1.0",
"php": ">=5.4",
"swiftmailer/swiftmailer": "^5.4",
"symfony/process": "^2.7|^3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
"symfony/filesystem": "^2.7|^3.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Jobby\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gerard Sychay",
"email": "hellogerard@gmail.com",
"homepage": "https://github.com/hellogerard"
},
{
"name": "Michael Contento",
"homepage": "https://github.com/michaelcontento"
}
],
"description": "Manage all your cron jobs without modifying crontab. Handles locking, logging, error emails, and more.",
"homepage": "https://github.com/jobbyphp/jobby",
"time": "2016-04-15 18:01:51"
},
{
"name": "jeremeamia/SuperClosure",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/jeremeamia/super_closure.git",
"reference": "29a88be2a4846d27c1613aed0c9071dfad7b5938"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/29a88be2a4846d27c1613aed0c9071dfad7b5938",
"reference": "29a88be2a4846d27c1613aed0c9071dfad7b5938",
"shasum": ""
},
"require": {
"nikic/php-parser": "^1.2|^2.0",
"php": ">=5.4",
"symfony/polyfill-php56": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0|^5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"autoload": {
"psr-4": {
"SuperClosure\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jeremy Lindblom",
"email": "jeremeamia@gmail.com",
"homepage": "https://github.com/jeremeamia",
"role": "Developer"
}
],
"description": "Serialize Closure objects, including their context and binding",
"homepage": "https://github.com/jeremeamia/super_closure",
"keywords": [
"closure",
"function",
"lambda",
"parser",
"serializable",
"serialize",
"tokenizer"
],
"time": "2015-12-05 17:17:57"
},
{
"name": "mtdowling/cron-expression",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/mtdowling/cron-expression.git",
"reference": "c9ee7886f5a12902b225a1a12f36bb45f9ab89e5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mtdowling/cron-expression/zipball/c9ee7886f5a12902b225a1a12f36bb45f9ab89e5",
"reference": "c9ee7886f5a12902b225a1a12f36bb45f9ab89e5",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "~4.0|~5.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Cron": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due",
"keywords": [
"cron",
"schedule"
],
"time": "2016-01-26 21:23:30"
},
{
"name": "nikic/php-parser",
"version": "v2.1.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "47b254ea51f1d6d5dc04b9b299e88346bf2369e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/47b254ea51f1d6d5dc04b9b299e88346bf2369e3",
"reference": "47b254ea51f1d6d5dc04b9b299e88346bf2369e3",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.4"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"bin": [
"bin/php-parse"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"autoload": {
"psr-4": {
"PhpParser\\": "lib/PhpParser"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Nikita Popov"
}
],
"description": "A PHP parser written in PHP",
"keywords": [
"parser",
"php"
],
"time": "2016-04-19 13:41:41"
},
{
"name": "swiftmailer/swiftmailer",
"version": "v5.4.2",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
"reference": "d8db871a54619458a805229a057ea2af33c753e8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/d8db871a54619458a805229a057ea2af33c753e8",
"reference": "d8db871a54619458a805229a057ea2af33c753e8",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"mockery/mockery": "~0.9.1,<0.9.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.4-dev"
}
},
"autoload": {
"files": [
"lib/swift_required.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Chris Corbyn"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Swiftmailer, free feature-rich PHP mailer",
"homepage": "http://swiftmailer.org",
"keywords": [
"email",
"mail",
"mailer"
],
"time": "2016-05-01 08:45:47"
},
{
"name": "symfony/polyfill-php56",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php56.git",
"reference": "3edf57a8fbf9a927533344cef65ad7e1cf31030a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/3edf57a8fbf9a927533344cef65ad7e1cf31030a",
"reference": "3edf57a8fbf9a927533344cef65ad7e1cf31030a",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/polyfill-util": "~1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php56\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"time": "2016-05-18 14:26:46"
},
{
"name": "symfony/polyfill-util",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-util.git",
"reference": "ef830ce3d218e622b221d6bfad42c751d974bf99"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-util/zipball/ef830ce3d218e622b221d6bfad42c751d974bf99",
"reference": "ef830ce3d218e622b221d6bfad42c751d974bf99",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Util\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony utilities for portability of PHP codes",
"homepage": "https://symfony.com",
"keywords": [
"compat",
"compatibility",
"polyfill",
"shim"
],
"time": "2016-05-18 14:26:46"
},
{
"name": "symfony/process",
"version": "v3.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "6350e63ed9c232da50e00f00a7e0330f066387a2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/6350e63ed9c232da50e00f00a7e0330f066387a2",
"reference": "6350e63ed9c232da50e00f00a7e0330f066387a2",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2016-06-06 11:42:41"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}