Some fixes

This commit is contained in:
Jeroen De Meerleer 2020-10-05 22:08:52 +02:00
parent d20324b52a
commit 9261b67cef
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
2 changed files with 554 additions and 86 deletions

592
composer.lock generated
View File

@ -8,27 +8,29 @@
"packages": [ "packages": [
{ {
"name": "guzzlehttp/guzzle", "name": "guzzlehttp/guzzle",
"version": "6.3.3", "version": "6.5.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/guzzle.git", "url": "https://github.com/guzzle/guzzle.git",
"reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
"reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*",
"guzzlehttp/promises": "^1.0", "guzzlehttp/promises": "^1.0",
"guzzlehttp/psr7": "^1.4", "guzzlehttp/psr7": "^1.6.1",
"php": ">=5.5" "php": ">=5.5",
"symfony/polyfill-intl-idn": "^1.17.0"
}, },
"require-dev": { "require-dev": {
"ext-curl": "*", "ext-curl": "*",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
"psr/log": "^1.0" "psr/log": "^1.1"
}, },
"suggest": { "suggest": {
"psr/log": "Required for using the Log middleware" "psr/log": "Required for using the Log middleware"
@ -36,16 +38,16 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "6.3-dev" "dev-master": "6.5-dev"
} }
}, },
"autoload": { "autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": { "psr-4": {
"GuzzleHttp\\": "src/" "GuzzleHttp\\": "src/"
} },
"files": [
"src/functions_include.php"
]
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -69,7 +71,7 @@
"rest", "rest",
"web service" "web service"
], ],
"time": "2018-04-22T15:46:56+00:00" "time": "2020-06-16T21:01:06+00:00"
}, },
{ {
"name": "guzzlehttp/promises", "name": "guzzlehttp/promises",
@ -124,32 +126,37 @@
}, },
{ {
"name": "guzzlehttp/psr7", "name": "guzzlehttp/psr7",
"version": "1.4.2", "version": "1.6.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/psr7.git", "url": "https://github.com/guzzle/psr7.git",
"reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" "reference": "239400de7a173fe9901b9ac7c06497751f00727a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a",
"reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", "reference": "239400de7a173fe9901b9ac7c06497751f00727a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.4.0", "php": ">=5.4.0",
"psr/http-message": "~1.0" "psr/http-message": "~1.0",
"ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
}, },
"provide": { "provide": {
"psr/http-message-implementation": "1.0" "psr/http-message-implementation": "1.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.0" "ext-zlib": "*",
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
},
"suggest": {
"zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.4-dev" "dev-master": "1.6-dev"
} }
}, },
"autoload": { "autoload": {
@ -179,13 +186,59 @@
"keywords": [ "keywords": [
"http", "http",
"message", "message",
"psr-7",
"request", "request",
"response", "response",
"stream", "stream",
"uri", "uri",
"url" "url"
], ],
"time": "2017-03-20T17:10:46+00:00" "time": "2019-07-01T23:21:34+00:00"
},
{
"name": "paragonie/random_compat",
"version": "v9.99.99",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
"shasum": ""
},
"require": {
"php": "^7"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*",
"vimeo/psalm": "^1"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"polyfill",
"pseudorandom",
"random"
],
"time": "2018-07-02T15:55:56+00:00"
}, },
{ {
"name": "psr/http-message", "name": "psr/http-message",
@ -238,17 +291,57 @@
"time": "2016-08-06T14:39:51+00:00" "time": "2016-08-06T14:39:51+00:00"
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "ralouphie/getallheaders",
"version": "v1.9.0", "version": "3.0.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git", "url": "https://github.com/ralouphie/getallheaders.git",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19" "reference": "120b605dfeb996808c31b6477290a714d356e822"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19", "reference": "120b605dfeb996808c31b6477290a714d356e822",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^5 || ^6.5"
},
"type": "library",
"autoload": {
"files": [
"src/getallheaders.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ralph Khattar",
"email": "ralph.khattar@gmail.com"
}
],
"description": "A polyfill for getallheaders.",
"time": "2019-03-08T08:55:37+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.18.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "1c302646f6efc070cd46856e600e5e0684d6b454"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454",
"reference": "1c302646f6efc070cd46856e600e5e0684d6b454",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -260,7 +353,11 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.9-dev" "dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
} }
}, },
"autoload": { "autoload": {
@ -276,13 +373,13 @@
"MIT" "MIT"
], ],
"authors": [ "authors": [
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
},
{ {
"name": "Gert de Pagter", "name": "Gert de Pagter",
"email": "BackEndTea@gmail.com" "email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
} }
], ],
"description": "Symfony polyfill for ctype functions", "description": "Symfony polyfill for ctype functions",
@ -293,20 +390,200 @@
"polyfill", "polyfill",
"portable" "portable"
], ],
"time": "2018-08-06T14:22:27+00:00" "funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-intl-idn",
"version": "v1.9.0", "version": "v1.18.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" "reference": "bc6549d068d0160e0f10f7a5a23c7d1406b95ebe"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/bc6549d068d0160e0f10f7a5a23c7d1406b95ebe",
"reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", "reference": "bc6549d068d0160e0f10f7a5a23c7d1406b95ebe",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/polyfill-intl-normalizer": "^1.10",
"symfony/polyfill-php70": "^1.10",
"symfony/polyfill-php72": "^1.10"
},
"suggest": {
"ext-intl": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Idn\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Laurent Bassin",
"email": "laurent@bassin.info"
},
{
"name": "Trevor Rowbotham",
"email": "trevor.rowbotham@pm.me"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"idn",
"intl",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.18.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
"reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e",
"reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-intl": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"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 for intl's Normalizer class and related functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"intl",
"normalizer",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.18.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a",
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -318,7 +595,11 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.9-dev" "dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
} }
}, },
"autoload": { "autoload": {
@ -352,36 +633,199 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2018-08-06T14:22:27+00:00" "funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
}, },
{ {
"name": "twig/twig", "name": "symfony/polyfill-php70",
"version": "v2.5.0", "version": "v1.18.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/twigphp/Twig.git", "url": "https://github.com/symfony/polyfill-php70.git",
"reference": "6a5f676b77a90823c2d4eaf76137b771adf31323" "reference": "0dd93f2c578bdc9c72697eaa5f1dd25644e618d3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/6a5f676b77a90823c2d4eaf76137b771adf31323", "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0dd93f2c578bdc9c72697eaa5f1dd25644e618d3",
"reference": "6a5f676b77a90823c2d4eaf76137b771adf31323", "reference": "0dd93f2c578bdc9c72697eaa5f1dd25644e618d3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.0", "paragonie/random_compat": "~1.0|~2.0|~9.99",
"symfony/polyfill-ctype": "^1.8", "php": ">=5.3.3"
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {
"psr/container": "^1.0",
"symfony/debug": "^2.7",
"symfony/phpunit-bridge": "^3.3"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.5-dev" "dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php70\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"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 7.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "symfony/polyfill-php72",
"version": "v1.18.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "639447d008615574653fb3bc60d1986d7172eaae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/639447d008615574653fb3bc60d1986d7172eaae",
"reference": "639447d008615574653fb3bc60d1986d7172eaae",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php72\\": ""
},
"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 7.2+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "twig/twig",
"version": "v2.13.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "46a612ba1bbf6ee1c58acabacd868212ff8a2911"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/46a612ba1bbf6ee1c58acabacd868212ff8a2911",
"reference": "46a612ba1bbf6ee1c58acabacd868212ff8a2911",
"shasum": ""
},
"require": {
"php": ">=7.1.3",
"symfony/polyfill-ctype": "^1.8",
"symfony/polyfill-mbstring": "^1.3"
},
"require-dev": {
"psr/container": "^1.0",
"symfony/phpunit-bridge": "^4.4.9|^5.0.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.13-dev"
} }
}, },
"autoload": { "autoload": {
@ -403,15 +847,14 @@
"homepage": "http://fabien.potencier.org", "homepage": "http://fabien.potencier.org",
"role": "Lead Developer" "role": "Lead Developer"
}, },
{
"name": "Twig Team",
"role": "Contributors"
},
{ {
"name": "Armin Ronacher", "name": "Armin Ronacher",
"email": "armin.ronacher@active-4.com", "email": "armin.ronacher@active-4.com",
"role": "Project Founder" "role": "Project Founder"
},
{
"name": "Twig Team",
"homepage": "https://twig.symfony.com/contributors",
"role": "Contributors"
} }
], ],
"description": "Twig, the flexible, fast, and secure template language for PHP", "description": "Twig, the flexible, fast, and secure template language for PHP",
@ -419,7 +862,29 @@
"keywords": [ "keywords": [
"templating" "templating"
], ],
"time": "2018-07-13T07:18:09+00:00" "funding": [
{
"url": "https://certification.symfony.com/",
"type": "custom"
},
{
"url": "https://live.symfony.com/",
"type": "custom"
},
{
"url": "https://symfony.com/cloud/",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/twig/twig",
"type": "tidelift"
}
],
"time": "2020-07-05T13:08:05+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],
@ -429,5 +894,6 @@
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": [],
"platform-dev": [] "platform-dev": [],
"plugin-api-version": "1.1.0"
} }

View File

@ -30,15 +30,15 @@ if(file_exists('/tmp/webcron.lock') && file_get_contents('/tmp/webcron.lock') +
{ {
die('Script is already running'); die('Script is already running');
} }
unlink('/tmp/webcron.lock'); if(file_exists('/tmp/webcron.lock')) unlink('/tmp/webcron.lock');
file_put_contents('/tmp/webcron.lock', time()); file_put_contents('/tmp/webcron.lock', time());
/** /**
* Reboot finalize * Reboot finalize
*/ */
if (file_exists("cache/get-services.trigger")) { if (file_exists(__DIR__ . "/cache/get-services.trigger")) {
if (file_exists("cache/reboot-time.trigger") && file_get_contents("cache/reboot-time.trigger") < time()) { if (file_exists(__DIR__ . "/cache/reboot-time.trigger") && file_get_contents(__DIR__ . "/cache/reboot-time.trigger") < time()) {
$rebootjobs = unserialize(file_get_contents("cache/get-services.trigger")); $rebootjobs = json_decode(file_get_contents(__DIR__ . "/cache/get-services.trigger"), true);
foreach($rebootjobs as $job) { foreach($rebootjobs as $job) {
$services = array(); $services = array();
@ -62,8 +62,8 @@ if (file_exists("cache/get-services.trigger")) {
$stmt = $db->prepare("INSERT INTO runs(job, statuscode, result, timestamp) VALUES(?, ?, ?, ?)"); $stmt = $db->prepare("INSERT INTO runs(job, statuscode, result, timestamp) VALUES(?, ?, ?, ?)");
$stmt->execute(array($job['jobID'], '0', $services, time())); $stmt->execute(array($job['jobID'], '0', $services, time()));
} }
unlink("cache/get-services.trigger"); unlink(__DIR__ . "/cache/get-services.trigger");
unlink("cache/reboot-time.trigger"); unlink(__DIR__ . "/cache/reboot-time.trigger");
} }
} }
@ -73,8 +73,8 @@ $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
$client = new \GuzzleHttp\Client(); $client = new \GuzzleHttp\Client();
$rebootjobs = array(); $rebootjobs = array();
if (file_exists("cache/get-services.trigger")) { if (file_exists(__DIR__ . "/cache/get-services.trigger")) {
$rebootjobs = unserialize(file_get_contents("cache/get-services.trigger")); $rebootjobs = json_decode(file_get_contents(__DIR__ . "/cache/get-services.trigger"), true);
} }
foreach ($results as $result) { foreach ($results as $result) {
@ -85,29 +85,30 @@ foreach ($results as $result) {
$statuscode = $res->getStatusCode(); $statuscode = $res->getStatusCode();
$body = $res->getBody(); $body = $res->getBody();
} else { } else {
if(strpos($result["url"],"reboot") !== 0) {
if(strpos($result["url"],"reboot") !== 0) { $nosave = false;
$body = ''; $body = '';
$statuscode = 0; $statuscode = 0;
$url = "ssh " . $result['host'] . " '" . $result['url'] . "' 2>&1"; $url = "ssh " . $result['host'] . " '" . $result['url'] . "' 2>&1";
exec($url, $body, $statuscode); exec($url, $body, $statuscode);
$body = implode("\n", $body); $body = implode("\n", $body);
} else { } else {
$rebootjobs = array(); $rebootjobs = array();
if (file_exists('cache/get-services.trigger')) { if (file_exists(__DIR__ . '/cache/get-services.trigger')) {
$rebootjobs = unserialize(file_get_contents('cache/get-services.trigger')); $rebootjobs = json_decode(file_get_contents(__DIR__ . '/cache/get-services.trigger'), true);
} }
if (!job_in_array($result['jobID'], $rebootjobs)) { if (!job_in_array($result['jobID'], $rebootjobs)) {
echo "no hope";
$rebootjobs[] = $result; $rebootjobs[] = $result;
$rebootser = serialize($rebootjobs); $rebootser = json_encode($rebootjobs);
file_put_contents("cache/get-services.trigger", $rebootser); file_put_contents(__DIR__ . "/cache/get-services.trigger", $rebootser);
touch("cache/reboot.trigger"); touch(__DIR__ . "/cache/reboot.trigger");
$nosave = true; $nosave = true;
} }
} }
} }
if($nosave !== true) { if(!$nosave) {
$stmt = $db->prepare("INSERT INTO runs(job, statuscode, result, timestamp) VALUES(?, ?, ?, ?)"); $stmt = $db->prepare("INSERT INTO runs(job, statuscode, result, timestamp) VALUES(?, ?, ?, ?)");
$stmt->execute(array($result['jobID'], $statuscode, $body, time())); $stmt->execute(array($result['jobID'], $statuscode, $body, time()));
} }
@ -126,10 +127,11 @@ if ((get_configvalue('dbclean.enabled') == 'true') && (get_configvalue('dbclean.
unlink('/tmp/webcron.lock'); unlink('/tmp/webcron.lock');
if(file_exists("cache/reboot.trigger")) { if(file_exists(__DIR__ . "/cache/reboot.trigger")) {
unlink("cache/reboot.trigger"); unlink(__DIR__ . "/cache/reboot.trigger");
$count=0; $count=0;
foreach($rebootjobs as $job) { foreach($rebootjobs as $job) {
print_r($job);
if (!(isset($job['done']) && $job['done'] == true)) { if (!(isset($job['done']) && $job['done'] == true)) {
$rebooter = preg_replace("/reboot /", "", $job['url'], 1); $rebooter = preg_replace("/reboot /", "", $job['url'], 1);
$rebooter = urlencode($rebooter); $rebooter = urlencode($rebooter);
@ -145,8 +147,8 @@ if(file_exists("cache/reboot.trigger")) {
$cmd = str_replace("{m}+", intdiv(get_configvalue('jobs.rebootwait'), 60), $cmd); $cmd = str_replace("{m}+", intdiv(get_configvalue('jobs.rebootwait'), 60), $cmd);
$cmd = str_replace("{s}+", get_configvalue('jobs.rebootwait'), $cmd); $cmd = str_replace("{s}+", get_configvalue('jobs.rebootwait'), $cmd);
$url = "ssh " . $job['host'] . " '" . $cmd . " &'"; $url = "ssh " . $job['host'] . " '" . $cmd . " &'";
echo $url;
exec($url); exec($url);
$cmd = ''; $cmd = '';
$rebootjobs[$count]['done'] = true; $rebootjobs[$count]['done'] = true;
@ -154,8 +156,8 @@ if(file_exists("cache/reboot.trigger")) {
$count++; $count++;
} }
$rebootser = serialize($rebootjobs); $rebootser = json_encode($rebootjobs);
file_put_contents("cache/get-services.trigger", $rebootser); file_put_contents(__DIR__ . "/cache/get-services.trigger", $rebootser);
file_put_contents("cache/reboot-time.trigger", time() + (get_configvalue('jobs.reboottime') + get_configvalue('jobs.rebootwait'))); file_put_contents(__DIR__ . "/cache/reboot-time.trigger", time() + (get_configvalue('jobs.reboottime') + get_configvalue('jobs.rebootwait')));
} }
require_once 'include/finalize.inc.php'; require_once 'include/finalize.inc.php';