Compare commits

...

16 Commits

Author SHA1 Message Date
Michael RICOIS
8bd783baf1 Fix chemin d'accès au repertoire log 2017-03-27 11:53:17 +02:00
Michael RICOIS
3fe674505e Path shared en tant que variables 2017-03-06 16:58:58 +01:00
Michael RICOIS
cc5023bc74 Log path related to project 2017-03-02 15:58:17 +01:00
Michael RICOIS
1eb28ff84b composer update 2017-02-07 09:55:50 +01:00
Michael RICOIS
048e2e326d Autre test 2017-01-06 10:54:05 +01:00
Michael RICOIS
653439a146 Ajout source Insee 2017-01-05 14:54:15 +01:00
Michael RICOIS
93eac66503 Packages update 2017-01-03 10:16:39 +01:00
Michael RICOIS
9521489bfb Typo 2016-11-10 11:54:55 +01:00
Michael RICOIS
3764cfb81a Enable 2016-11-10 11:50:40 +01:00
Michael RICOIS
189ef33daf Libraries update 2016-09-09 15:39:25 +02:00
Michael RICOIS
a3d0a4b3b8 Update crony 2016-08-09 16:49:46 +02:00
Michael RICOIS
9c601e7067 Correction lien FTP 2016-07-01 09:07:57 +02:00
Michael RICOIS
9f827356e0 Be quiet 2016-06-30 11:12:18 +02:00
Michael RICOIS
c5a7bce6bf Correction option 2016-06-30 10:44:12 +02:00
Michael RICOIS
3ba4b42aeb Tout les fichiers Inpi, dans sources/documents 2016-06-30 10:37:31 +02:00
Michael RICOIS
c1a5168cad First file 2016-06-28 21:13:14 +02:00
6 changed files with 661 additions and 0 deletions

4
.gitignore vendored Executable file
View File

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

12
bin/job.php Executable 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();

171
bin/sourceInpi.php Executable file
View File

@ -0,0 +1,171 @@
<?php
require_once __DIR__ . '/../vendor/autoload.php';
$pathShared = realpath(__DIR__ . '/../../../shared');
/**
* Télécharge les fichiers OpenData Inpi
* wget
* --quiet | -q
* --no-host-directories | -q -nH
* --recursive | -r
* --continue | -c
* --timestamping | -N
* --level=inf | -l inf
* --directory-prefix=/home/data/sources/inpi/ | -P/home/data/sources/inpi/
* --ftp-user=
* --ftp-password=
*/
$jobby = new Jobby\Jobby();
# 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 -q -nH -r -c -N -linf'.
' -P'.$pathShared.'/sources/inpi/documents/FRMARQUE'.
' --ftp-user=Frmarque --ftp-password="F?marQu1" ftp://www.inpi.net',
'schedule' => '01 19 * * 1-5',
'output' => $pathShared.'/log/sourceinpi.log',
'enabled' => true,
'debug' => true,
]);
// MARQUES - Décisions d'opposition
$jobby->add('FRJUROPP', [
'command' => 'wget -q -nH -r -c -N -linf'.
' -P'.$pathShared.'/sources/inpi/documents/FRJUROPP'.
' --ftp-user=Frjuropp --ftp-password="F?jurOp2" ftp://www.inpi.net',
'schedule' => '01 19 * * 1-5',
'output' => $pathShared.'/log/sourceinpi.log',
'enabled' => true,
'debug' => true,
]);
// DESSINS & MODELES FR
$jobby->add('FRDESMOD', [
'command' => 'wget -q -nH -r -c -N -linf'.
' -P'.$pathShared.'/sources/inpi/documents/FRDESMOD'.
' --ftp-user=Frdesmod --ftp-password="F?d&mOd1" ftp://www.inpi.net',
'schedule' => '01 19 * * 1-5',
'output' => $pathShared.'/log/sourceinpi.log',
'enabled' => true,
'debug' => true,
]);
// DESSINS & MODELES INTERNATIONAL
$jobby->add('ITDESMOD', [
'command' => 'wget -q -nH -r -c -N -linf'.
' -P'.$pathShared.'/sources/inpi/documents/ITDESMOD'.
' --ftp-user=Itdesmod --ftp-password="I?td&Mo2" ftp://www.inpi.net',
'schedule' => '01 19 * * 1-5',
'output' => $pathShared.'/log/sourceinpi.log',
'enabled' => false,
'debug' => true,
]);
// BREVETS Notices FR
$jobby->add('BFRBIBLI', [
'command' => 'wget -q -nH -r -c -N -linf'.
' -P'.$pathShared.'/sources/inpi/documents/BFRBIBLI'.
' --ftp-user=Bfrbibli --ftp-password="B?rbiBl1" ftp://www.inpi.net',
'schedule' => '01 19 * * 1-5',
'output' => $pathShared.'/log/sourceinpi.log',
'enabled' => true,
'debug' => true,
]);
// BREVETS Fasicules PDF
$jobby->add('BFRFAPDF', [
'command' => 'wget -q -nH -r -c -N -linf'.
' -P'.$pathShared.'/sources/inpi/documents/BFRFAPDF'.
' --ftp-user=Bfrfapdf --ftp-password="B?rfaPd2" ftp://www.inpi.net',
'schedule' => '01 19 * * 1-5',
'output' => $pathShared.'/log/sourceinpi.log',
'enabled' => true,
'debug' => true,
]);
// BREVETS Fasicules TIFF - Impossible à récup en auto
$jobby->add('BFRFASCI', [
'command' => 'wget -q -nH -r -c -N -linf'.
' -P'.$pathShared.'/sources/inpi/documents/BFRFASCI'.
' --ftp-user=Bfrfasci --ftp-password="B?rfaSc1" ftp://www.inpi.net',
'schedule' => '01 19 * * 1-5',
'output' => $pathShared.'/log/sourceinpi.log',
'enabled' => true,
'debug' => true,
]);
// BREVETS Texte Intégrale OCRisés
$jobby->add('BFRTEXTE', [
'command' => 'wget -q -nH -r -c -N -linf'.
' -P'.$pathShared.'/sources/inpi/documents/BFRTEXTE'.
' --ftp-user=BfrTexte --ftp-password="B?rteXt1" ftp://www.inpi.net',
'schedule' => '01 19 * * 1-5',
'output' => $pathShared.'/log/sourceinpi.log',
'enabled' => true,
'debug' => true,
]);
// BREVETS européens Na
$jobby->add('BEPPHNAT', [
'command' => 'wget -q -nH -r -c -N -linf'.
' -P'.$pathShared.'/sources/inpi/documents/BEPPHNAT'.
' --ftp-user=Bepphnat --ftp-password="B?pphNa2" ftp://www.inpi.net',
'schedule' => '01 19 * * 1-5',
'output' => $pathShared.'/log/sourceinpi.log',
'enabled' => true,
'debug' => true,
]);
// BREVETS européens Fascicules traduits
$jobby->add('BEPFASCI', [
'command' => 'wget -q -nH -r -c -N -linf'.
' -P'.$pathShared.'/sources/inpi/documents/BEPFASCI'.
' --ftp-user=Bepfasci --ftp-password="B?pfaSc1" ftp://www.inpi.net',
'schedule' => '01 19 * * 1-5',
'output' => $pathShared.'/log/sourceinpi.log',
'enabled' => true,
'debug' => true,
]);
// Run
$jobby->run();

30
bin/sourceInsee.php Normal file
View File

@ -0,0 +1,30 @@
<?php
require_once __DIR__ . '/../vendor/autoload.php';
$pathShared = realpath(__DIR__ . '/../../../shared');
$jobby = new Jobby\Jobby();
# 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('INSEE', [
'command' => 'cd '.$pathShared.'/sources/opendata/insee && curl -s https://www.data.gouv.fr/fr/datasets/base-sirene-des-entreprises-et-de-leurs-etablissements-siren-siret/'.
' | grep http.*zip -o | sort | uniq | wget -c -N -i -',
'schedule' => '01 13,18 * * 1-5',
'output' => $pathShared.'/log/sourceinsee.log',
'enabled' => true,
'debug' => true,
]);
// Run
$jobby->run();

12
composer.json Executable 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 Executable 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"
],
"content-hash": "4f89e8acc76d59ccae1751b29af1b3ca",
"packages": [
{
"name": "hellogerard/jobby",
"version": "v3.2.2",
"source": {
"type": "git",
"url": "https://github.com/jobbyphp/jobby.git",
"reference": "a5d1c63b0611f7b65c339776230fc594e83c31bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jobbyphp/jobby/zipball/a5d1c63b0611f7b65c339776230fc594e83c31bf",
"reference": "a5d1c63b0611f7b65c339776230fc594e83c31bf",
"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": "2017-01-09T17:13:31+00:00"
},
{
"name": "jeremeamia/SuperClosure",
"version": "2.3.0",
"source": {
"type": "git",
"url": "https://github.com/jeremeamia/super_closure.git",
"reference": "443c3df3207f176a1b41576ee2a66968a507b3db"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/443c3df3207f176a1b41576ee2a66968a507b3db",
"reference": "443c3df3207f176a1b41576ee2a66968a507b3db",
"shasum": ""
},
"require": {
"nikic/php-parser": "^1.2|^2.0|^3.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.3-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": "2016-12-07T09:37:55+00:00"
},
{
"name": "mtdowling/cron-expression",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/mtdowling/cron-expression.git",
"reference": "9504fa9ea681b586028adaaa0877db4aecf32bad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mtdowling/cron-expression/zipball/9504fa9ea681b586028adaaa0877db4aecf32bad",
"reference": "9504fa9ea681b586028adaaa0877db4aecf32bad",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "~4.0|~5.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Cron\\": "src/Cron/"
}
},
"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": "2017-01-23T04:29:33+00:00"
},
{
"name": "nikic/php-parser",
"version": "v3.0.3",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "5b8182cc0abb4b0ff290ba9df6c0e1323286013a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/5b8182cc0abb4b0ff290ba9df6c0e1323286013a",
"reference": "5b8182cc0abb4b0ff290ba9df6c0e1323286013a",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "~4.0|~5.0"
},
"bin": [
"bin/php-parse"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-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": "2017-02-03T21:57:31+00:00"
},
{
"name": "swiftmailer/swiftmailer",
"version": "v5.4.5",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
"reference": "cd142238a339459b10da3d8234220963f392540c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/cd142238a339459b10da3d8234220963f392540c",
"reference": "cd142238a339459b10da3d8234220963f392540c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"mockery/mockery": "~0.9.1",
"symfony/phpunit-bridge": "~3.2"
},
"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-12-29T10:02:40+00:00"
},
{
"name": "symfony/polyfill-php56",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php56.git",
"reference": "1dd42b9b89556f18092f3d1ada22cb05ac85383c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/1dd42b9b89556f18092f3d1ada22cb05ac85383c",
"reference": "1dd42b9b89556f18092f3d1ada22cb05ac85383c",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/polyfill-util": "~1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-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-11-14T01:06:16+00:00"
},
{
"name": "symfony/polyfill-util",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-util.git",
"reference": "746bce0fca664ac0a575e465f65c6643faddf7fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-util/zipball/746bce0fca664ac0a575e465f65c6643faddf7fb",
"reference": "746bce0fca664ac0a575e465f65c6643faddf7fb",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-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-11-14T01:06:16+00:00"
},
{
"name": "symfony/process",
"version": "v3.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "32646a7cf53f3956c76dcb5c82555224ae321858"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/32646a7cf53f3956c76dcb5c82555224ae321858",
"reference": "32646a7cf53f3956c76dcb5c82555224ae321858",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-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": "2017-02-03T12:11:38+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}