- Created separate MoneyFlix project directory - Copied Node.js redirector from production server - Added CRM PHP code (Redirects module, Core classes, Config, Routes, Views) - Created comprehensive documentation (README_MONEYFLIX.md) - Added sync script to keep CRM code updated (sync-from-crm.sh) - Configured .gitignore for Node.js and PHP - Set up proper project structure for multi-client isolation This separates MoneyFlix from the main CRM to avoid confusion between different client systems and provides a dedicated environment for MoneyFlix-specific development and maintenance.
38 lines
861 B
PHP
38 lines
861 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Core;
|
|
|
|
class CrontabReader
|
|
{
|
|
/**
|
|
* Lê o crontab do sistema e devolve um array de CrontabTask.
|
|
*/
|
|
public static function read(): array
|
|
{
|
|
$output = [];
|
|
exec('crontab -l 2>/dev/null', $output);
|
|
|
|
$tasks = [];
|
|
$pendingComments = [];
|
|
|
|
foreach ($output as $line) {
|
|
$trim = trim($line);
|
|
if ($trim === '') continue;
|
|
|
|
if (strpos($trim, '#') === 0) {
|
|
$pendingComments[] = ltrim($trim, '# ');
|
|
continue;
|
|
}
|
|
|
|
// Ignora env vars (ex: MAILTO=)
|
|
if (preg_match('/^[A-Z0-9_]+=/', $trim)) continue;
|
|
|
|
$task = new CrontabTask($trim, $pendingComments);
|
|
$tasks[] = $task;
|
|
$pendingComments = [];
|
|
}
|
|
return $tasks;
|
|
}
|
|
}
|