diff --git a/README.md b/README.md index 589b7f4c..039cd909 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,12 @@ Hedera is the main web shop page for Verdnatura. ## Prerequisites Required applications. - * PHP >= 7.0 - * Node.js >= 8.0 - * [php-vn-lib](https://gitea.verdnatura.es/verdnatura/php-vn-lib) + * PHP >= 8.4 + * Node.js >= 20.0 + +Take a look to *debian/control* file to see additional dependencies. + +Copy config.php to *config.my.php* and place your DB config there. ### Installing dependencies and launching diff --git a/config.php b/config.php index 7e853029..160790fd 100644 --- a/config.php +++ b/config.php @@ -24,7 +24,7 @@ return [ ,'port' => 3306 ,'schema' => 'hedera' ,'user' => 'hedera-web' - ,'pass' => '' + ,'pass' => '' // base64 encoded ,'tz' => 'Europe/madrid' ] ]; diff --git a/debian/cron.d b/debian/cron.d index 846174c7..f8bd5beb 100755 --- a/debian/cron.d +++ b/debian/cron.d @@ -3,7 +3,6 @@ MAILTO=webmaster */2 * * * * root hedera-web.php -m edi/load 0 23 * * * root hedera-web.php -m edi/clean 0 5 * * * root hedera-web.php -m edi/update -0 5 * * * root hedera-web.php -m misc/exchange-rate 0 0 * * * root hedera-web.php -m image/sync 0 1 * * * root /usr/share/hedera-web/utils/image-clean.sh > /dev/null 0 */1 * * * root /usr/share/hedera-web/utils/update-browscap.sh > /dev/null diff --git a/rest/misc/exchange-rate.php b/rest/misc/exchange-rate.php deleted file mode 100644 index 6e0dc96d..00000000 --- a/rest/misc/exchange-rate.php +++ /dev/null @@ -1,41 +0,0 @@ - - */ -class ExchangeRate extends Vn\Lib\Method { - function run($db) { - $db->selectDb('vn'); - - // Indica la URL del archivo - - $xml = new SimpleXMLElement( - 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml', 0, TRUE); - - $date = $db->getValue("SELECT MAX(dated) fecha FROM referenceRate"); - $maxDate = $date ? DateTime::createFromFormat('Y-m-d', $date) : NULL; - - foreach ($xml->Cube[0]->Cube as $cube) { - $xmlDate = new DateTime($cube['time']); - - // Si existen datos más recientes de la máxima fecha los añade - - if ($maxDate <= $xmlDate) - foreach ($cube->Cube as $subCube) - if ($subCube['currency'] == 'USD') { - $params = [ - 'date' => $xmlDate, - 'rate' => $subCube['rate'] - ]; - $db->query( - 'REPLACE INTO referenceRate(currencyFk, dated, `value`) - VALUES(2, #date, #rate)', - $params - ); - } - } - - $db->queryFromFile(__DIR__.'/exrate-add'); - } -} diff --git a/rest/misc/exrate-add.sql b/rest/misc/exrate-add.sql deleted file mode 100644 index ada56a9c..00000000 --- a/rest/misc/exrate-add.sql +++ /dev/null @@ -1,6 +0,0 @@ -INSERT INTO reference_rate (moneda_id, date, rate) - SELECT 2, TIMESTAMPADD (DAY, 1, r1.date), r1.rate - FROM reference_rate r1 - LEFT JOIN reference_rate r2 - ON TIMESTAMPADD(DAY, 1, r1.date) = r2.date - WHERE r2.date IS NULL AND r1.date < TIMESTAMPADD (DAY, -2, CURDATE())