new version
This commit is contained in:
parent
28f6467bb7
commit
900dbe3b6c
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
vendor/
|
vendor/
|
||||||
|
composer.json
|
||||||
composer.lock
|
composer.lock
|
||||||
composer.sync
|
composer.sync
|
||||||
|
|
||||||
@ -8,3 +9,5 @@ composer.sync
|
|||||||
|
|
||||||
test_code.php
|
test_code.php
|
||||||
modules/
|
modules/
|
||||||
|
|
||||||
|
requirements.txt
|
||||||
|
|||||||
@ -3,7 +3,9 @@ cd "$(dirname ${BASH_SOURCE[0]})"
|
|||||||
while [[ 1 ]]
|
while [[ 1 ]]
|
||||||
do
|
do
|
||||||
killall DbContinuousIntegrationWrapper.sh
|
killall DbContinuousIntegrationWrapper.sh
|
||||||
/usr/bin/php DbContinuousIntegration.php
|
/usr/bin/php composer.json.php > composer.json
|
||||||
|
touch -t $(/usr/bin/mysql -se "SELECT DATE_FORMAT(LastUpdated, '%Y%m%d%H%i.%s') FROM SYS_PRD_BND.Composer ORDER BY LastUpdated DESC LIMIT 1") composer.json
|
||||||
make
|
make
|
||||||
|
/usr/bin/php DbContinuousIntegration.php
|
||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
|
|||||||
4
Makefile
4
Makefile
@ -1,8 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
composer.sync: composer.json
|
composer.sync: composer.json
|
||||||
COMPOSER_ALLOW_SUPERUSER=1 composer update 2>&1 > $@
|
COMPOSER_ALLOW_SUPERUSER=1 composer update > $@ 2>&1
|
||||||
|
|
||||||
|
requirements.sync: requirements.txt
|
||||||
|
pip install -r requirements.txt $@
|
||||||
install:
|
install:
|
||||||
echo "Add this line to crontab -e"
|
echo "Add this line to crontab -e"
|
||||||
echo '@reboot /bin/bash /root/DbContinuousIntegration/DbContinuousIntegrationWrapper.sh 2> /dev/null > /dev/null &'
|
echo '@reboot /bin/bash /root/DbContinuousIntegration/DbContinuousIntegrationWrapper.sh 2> /dev/null > /dev/null &'
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"require": {
|
"require": {
|
||||||
"denpa\/php-bitcoinrpc": "^2.2"
|
"psr/log": "*",
|
||||||
|
"symfony/console": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
44
composer.json.php
Normal file
44
composer.json.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// Setup PDO
|
||||||
|
$dsn = "mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=SYS_PRD_BND;charset=utf8mb4";
|
||||||
|
$options = [
|
||||||
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
|
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||||
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = new PDO($dsn, "root", "", $options);
|
||||||
|
|
||||||
|
// Fetch dependencies
|
||||||
|
$stmt = $pdo->query("SELECT VendorName, PackageName, VersionOrBranch FROM Composer ORDER BY VendorName, PackageName");
|
||||||
|
$require = [];
|
||||||
|
foreach ($stmt as $row) {
|
||||||
|
$require["{$row['VendorName']}/{$row['PackageName']}"] = $row['VersionOrBranch'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch repositories
|
||||||
|
$stmt = $pdo->query("SELECT RepositoryType, RepositoryUrl FROM Composer WHERE RepositoryUrl IS NOT NULL ORDER BY VendorName, PackageName");
|
||||||
|
$repositories = [];
|
||||||
|
foreach ($stmt as $row) {
|
||||||
|
$repositories[] = [
|
||||||
|
'type' => $row['RepositoryType'],
|
||||||
|
'url' => $row['RepositoryUrl'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build composer.json content
|
||||||
|
$composerJson = [
|
||||||
|
'require' => $require,
|
||||||
|
];
|
||||||
|
if (!empty($repositories)) {
|
||||||
|
$composerJson['repositories'] = $repositories;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write to file
|
||||||
|
file_put_contents('php://stdout', json_encode($composerJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||||
|
file_put_contents("php://stderr", "✅ composer.json generated successfully.\n");
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
file_put_contents("php://stderr","❌ Database error: " . $e->getMessage() . "\n");
|
||||||
|
}
|
||||||
@ -166,7 +166,7 @@ function updateDatabaseRow($tableName, $originalRow, $newRowValue) {
|
|||||||
|
|
||||||
$setStatements = [];
|
$setStatements = [];
|
||||||
foreach ($newRowValue as $k => $v) {
|
foreach ($newRowValue as $k => $v) {
|
||||||
$value = is_numeric($v) ? $v : "'" . str_replace("'", "''", $v) . "'";
|
$value = is_numeric($v) ? $v : "'" . str_replace("'", "''", is_string($v)?$v:json_encode($v)) . "'";
|
||||||
$setStatements[] = "$k = $value";
|
$setStatements[] = "$k = $value";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
function runSandboxedPython($code, &$stdout = null, &$stderr = null) {
|
function runSandboxedPython($code, &$stdout = null, &$stderr = null) {
|
||||||
// Create a temporary file to hold the Python code
|
// Create a temporary file to hold the Python code
|
||||||
$tempFile = tempnam(sys_get_temp_dir(), 'sandboxed_') . '.py';
|
$tempFile = tempnam(sys_get_temp_dir(), 'sandboxed_') . '.py';
|
||||||
|
echo "Creating ".redText("python temp code file")." for sandboxed execution at: $tempFile \n";
|
||||||
|
|
||||||
// Write the generated Python code to the temporary file
|
// Write the generated Python code to the temporary file
|
||||||
file_put_contents($tempFile, $code);
|
file_put_contents($tempFile, $code);
|
||||||
|
|||||||
4
sys.php
4
sys.php
@ -110,9 +110,7 @@ function sql_read_and_hydrate($query) {
|
|||||||
foreach ($rows as &$row) {
|
foreach ($rows as &$row) {
|
||||||
foreach ($fks as $fk) {
|
foreach ($fks as $fk) {
|
||||||
$col = $fk['COLUMN_NAME'];
|
$col = $fk['COLUMN_NAME'];
|
||||||
if (!isset($row[$col])) {
|
if (!isset($row[$col])) continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$val = $row[$col];
|
$val = $row[$col];
|
||||||
if ($val === null) {
|
if ($val === null) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user