Removed ownership for ftpdata folder
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 19s
Laravel Pint / pint (pull_request) Successful in 3m45s
Laravel Larastan / larastan (pull_request) Failing after 5m28s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 19s
Laravel Pint / pint (pull_request) Successful in 3m45s
Laravel Larastan / larastan (pull_request) Failing after 5m28s
This commit is contained in:
@@ -263,7 +263,6 @@ class ProcessSftpFiles extends Command
|
|||||||
$allFiles = [];
|
$allFiles = [];
|
||||||
$logMessages = [];
|
$logMessages = [];
|
||||||
|
|
||||||
// Check whether data2 exists
|
|
||||||
if (!File::isDirectory($basePath)) {
|
if (!File::isDirectory($basePath)) {
|
||||||
$this->error("Directory not found: {$basePath}");
|
$this->error("Directory not found: {$basePath}");
|
||||||
return;
|
return;
|
||||||
@@ -279,14 +278,12 @@ class ProcessSftpFiles extends Command
|
|||||||
|
|
||||||
File::makeDirectory($folderPath, 0755, true);
|
File::makeDirectory($folderPath, 0755, true);
|
||||||
|
|
||||||
// Set ownership
|
// exec("chown www-data:www-data " . escapeshellarg($folderPath));
|
||||||
exec("chown www-data:www-data " . escapeshellarg($folderPath));
|
|
||||||
|
|
||||||
$this->info("Created missing folder: {$folderName}");
|
$this->info("Created missing folder: {$folderName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get plant folders: 1000, 1010, etc.
|
|
||||||
$folders = File::directories($basePath);
|
$folders = File::directories($basePath);
|
||||||
|
|
||||||
if (empty($folders)) {
|
if (empty($folders)) {
|
||||||
@@ -294,14 +291,12 @@ class ProcessSftpFiles extends Command
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect TXT files from each plant folder
|
|
||||||
foreach ($folders as $folderPath) {
|
foreach ($folders as $folderPath) {
|
||||||
|
|
||||||
$folderName = basename($folderPath);
|
$folderName = basename($folderPath);
|
||||||
|
|
||||||
Log::info("Checking plant folder: {$folderName}");
|
Log::info("Checking plant folder: {$folderName}");
|
||||||
|
|
||||||
// Get files inside the plant folder
|
|
||||||
$files = File::files($folderPath);
|
$files = File::files($folderPath);
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
@@ -324,7 +319,6 @@ class ProcessSftpFiles extends Command
|
|||||||
|
|
||||||
$dbColumns = Schema::getColumnListing('production_temps');
|
$dbColumns = Schema::getColumnListing('production_temps');
|
||||||
|
|
||||||
// Process each TXT file
|
|
||||||
foreach ($allFiles as $fileDetails) {
|
foreach ($allFiles as $fileDetails) {
|
||||||
|
|
||||||
$file = $fileDetails['path'];
|
$file = $fileDetails['path'];
|
||||||
@@ -332,7 +326,6 @@ class ProcessSftpFiles extends Command
|
|||||||
|
|
||||||
$this->info("Processing file: {$file}");
|
$this->info("Processing file: {$file}");
|
||||||
|
|
||||||
// Find plant using folder name
|
|
||||||
$plant = Plant::where('code', $folderName)->first();
|
$plant = Plant::where('code', $folderName)->first();
|
||||||
|
|
||||||
if (!$plant) {
|
if (!$plant) {
|
||||||
|
|||||||
Reference in New Issue
Block a user