Loading bin/oscar-worker.php +28 −28 Original line number Diff line number Diff line Loading @@ -45,14 +45,18 @@ echo "# OSCAR WORKER STARTED ".\Oscar\OscarVersion::getBuild()." SPARTAN\n"; echo "# working directory : '" . __DIR__ . "'\n"; echo "###################################################################\n"; while($worker->work()); while ($worker->work()) { ; } function getServiceManager(){ function getServiceManager() { global $app; return $app->getServiceManager(); } function oscarJob_updateIndexActivity(GearmanJob $job){ function oscarJob_updateIndexActivity(GearmanJob $job) { global $oscarCmd; $params = json_decode($job->workload()); try { Loading @@ -63,13 +67,13 @@ function oscarJob_updateIndexActivity(GearmanJob $job){ $cmd = $oscarCmd . ' indexactivity \'{"activityid":' . $params->activityid . '}\''; echo "[worker] exec $cmd\n"; exec($cmd); } catch (Exception $e) { echo "[ERR] " . $e->getMessage() . "\n"; } } function oscarJob_updateIndexPerson(GearmanJob $job){ function oscarJob_updateIndexPerson(GearmanJob $job) { global $oscarCmd; $params = json_decode($job->workload()); try { Loading @@ -80,14 +84,13 @@ function oscarJob_updateIndexPerson(GearmanJob $job){ $cmd = $oscarCmd . ' indexperson \'{"personid":' . $personid . '}\''; echo "[worker] exec $cmd\n"; exec($cmd); } catch (Exception $e) { echo "[ERR] " . $e->getMessage() . "\n"; } } function oscarJob_updateIndexOrganization(GearmanJob $job){ function oscarJob_updateIndexOrganization(GearmanJob $job) { global $oscarCmd; $params = json_decode($job->workload()); try { Loading @@ -98,13 +101,13 @@ function oscarJob_updateIndexOrganization(GearmanJob $job){ $cmd = $oscarCmd . ' indexorganization \'{"organizationid":' . $organizationid . '}\''; echo "[worker] exec $cmd\n"; exec($cmd); } catch (Exception $e) { echo "[ERR] " . $e->getMessage() . "\n"; } } function oscarJob_updateNotificationsActivity(GearmanJob $job){ function oscarJob_updateNotificationsActivity(GearmanJob $job) { global $oscarCmd; $params = json_decode($job->workload()); Loading @@ -117,18 +120,16 @@ function oscarJob_updateNotificationsActivity(GearmanJob $job){ $cmd = $oscarCmd . ' notificationsactivity \'{"activityid":' . $params->activityid . '}\''; echo "[worker] exec $cmd\n"; exec($cmd); } catch (Exception $e) { echo "[ERR] " . $e->getMessage() . "\n"; } } function oscarJob_hello(GearmanJob $job){ function oscarJob_hello(GearmanJob $job) { $params = json_decode($job->workload()); try { /** @var \Oscar\Service\ProjectGrantService $projectGrantService */ $projectGrantService = getServiceManager()->get(\Oscar\Service\ProjectGrantService::class); Loading @@ -147,7 +148,6 @@ function oscarJob_hello(GearmanJob $job){ getServiceManager()->get('Logger')->info(" > [gearman:call] TEST OK]"); $job->sendComplete("TRAITEMENT RÉUSSI"); } catch (Exception $e) { $job->sendException("[ERR] HELLO FAIL : " . $e->getMessage()); } Loading module/Oscar/src/Oscar/Command/OscarActivityNotificationUpdateCommand.php +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ class OscarActivityNotificationUpdateCommand extends OscarAdvancedCommandAbstrac } $this->getProjectGrantService()->getNotificationService()->updateNotificationsActivity($activity); return $this->finalSuccess("Notifications pour '$activity' mises à jour"); return $this->finalSuccess("Notifications mises à jour '$activity'"); } catch (Exception $e) { return $this->finalFatalError($e); } Loading module/Oscar/src/Oscar/Command/OscarAdvancedCommandAbstract.php +2 −2 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ abstract class OscarAdvancedCommandAbstract extends OscarCommandAbstract */ protected function finalFatalError(\Exception $e): int { $this->getLoggerService()->error($e->getMessage()); $this->getLoggerService()->error("CMD error : " . $e->getMessage()); if( !$this->getIO()->isQuiet() ) { $this->getIO()->error($e->getMessage()); } Loading @@ -151,7 +151,7 @@ abstract class OscarAdvancedCommandAbstract extends OscarCommandAbstract */ protected function finalSuccess( string $message ):int { $this->getLoggerService()->notice($message); $this->getLoggerService()->notice("CMD success : " . $message); if( !$this->io->isQuiet() ){ $this->getIO()->success($message); } Loading module/Oscar/src/Oscar/Command/OscarConsoleCommand.php +0 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ class OscarConsoleCommand extends OscarCommandAbstract $this->getServicemanager()->get('Logger')->debug("command : $action " . $input->getArgument('params')); switch ($action) { case "notificationsactivity": $command = $this->getApplication()->find(OscarCommandAbstract::COMMAND_ACTIVITY_NOTIFICATION_UPDATE); Loading module/Oscar/src/Oscar/Controller/ProjectGrantController.php +9 −3 Original line number Diff line number Diff line Loading @@ -79,7 +79,9 @@ use Zend\View\Renderer\PhpRenderer; * * @package Oscar\Controller */ class ProjectGrantController extends AbstractOscarController implements UseNotificationService, UsePersonService, UseServiceContainer, UseProjectService, UseSpentService, UsePCRUService class ProjectGrantController extends AbstractOscarController implements UseNotificationService, UsePersonService, UseServiceContainer, UseProjectService, UseSpentService, UsePCRUService { use UseNotificationServiceTrait, UsePersonServiceTrait, UseServiceContainerTrait, UseProjectServiceTrait, UseSpentServiceTrait, UsePCRUServiceTrait; Loading Loading @@ -778,8 +780,12 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $form->setData($request->getPost()); if ($form->isValid()) { $this->getEntityManager()->flush($projectGrant); $this->getActivityService()->getGearmanJobLauncherService()->triggerUpdateNotificationActivity($projectGrant); $this->getActivityService()->getGearmanJobLauncherService()->triggerUpdateSearchIndexActivity($projectGrant); $this->getActivityService()->getGearmanJobLauncherService()->triggerUpdateNotificationActivity( $projectGrant ); $this->getActivityService()->getGearmanJobLauncherService()->triggerUpdateSearchIndexActivity( $projectGrant ); $this->redirect()->toRoute( 'contract/show', ['id' => $projectGrant->getId()] Loading Loading
bin/oscar-worker.php +28 −28 Original line number Diff line number Diff line Loading @@ -45,14 +45,18 @@ echo "# OSCAR WORKER STARTED ".\Oscar\OscarVersion::getBuild()." SPARTAN\n"; echo "# working directory : '" . __DIR__ . "'\n"; echo "###################################################################\n"; while($worker->work()); while ($worker->work()) { ; } function getServiceManager(){ function getServiceManager() { global $app; return $app->getServiceManager(); } function oscarJob_updateIndexActivity(GearmanJob $job){ function oscarJob_updateIndexActivity(GearmanJob $job) { global $oscarCmd; $params = json_decode($job->workload()); try { Loading @@ -63,13 +67,13 @@ function oscarJob_updateIndexActivity(GearmanJob $job){ $cmd = $oscarCmd . ' indexactivity \'{"activityid":' . $params->activityid . '}\''; echo "[worker] exec $cmd\n"; exec($cmd); } catch (Exception $e) { echo "[ERR] " . $e->getMessage() . "\n"; } } function oscarJob_updateIndexPerson(GearmanJob $job){ function oscarJob_updateIndexPerson(GearmanJob $job) { global $oscarCmd; $params = json_decode($job->workload()); try { Loading @@ -80,14 +84,13 @@ function oscarJob_updateIndexPerson(GearmanJob $job){ $cmd = $oscarCmd . ' indexperson \'{"personid":' . $personid . '}\''; echo "[worker] exec $cmd\n"; exec($cmd); } catch (Exception $e) { echo "[ERR] " . $e->getMessage() . "\n"; } } function oscarJob_updateIndexOrganization(GearmanJob $job){ function oscarJob_updateIndexOrganization(GearmanJob $job) { global $oscarCmd; $params = json_decode($job->workload()); try { Loading @@ -98,13 +101,13 @@ function oscarJob_updateIndexOrganization(GearmanJob $job){ $cmd = $oscarCmd . ' indexorganization \'{"organizationid":' . $organizationid . '}\''; echo "[worker] exec $cmd\n"; exec($cmd); } catch (Exception $e) { echo "[ERR] " . $e->getMessage() . "\n"; } } function oscarJob_updateNotificationsActivity(GearmanJob $job){ function oscarJob_updateNotificationsActivity(GearmanJob $job) { global $oscarCmd; $params = json_decode($job->workload()); Loading @@ -117,18 +120,16 @@ function oscarJob_updateNotificationsActivity(GearmanJob $job){ $cmd = $oscarCmd . ' notificationsactivity \'{"activityid":' . $params->activityid . '}\''; echo "[worker] exec $cmd\n"; exec($cmd); } catch (Exception $e) { echo "[ERR] " . $e->getMessage() . "\n"; } } function oscarJob_hello(GearmanJob $job){ function oscarJob_hello(GearmanJob $job) { $params = json_decode($job->workload()); try { /** @var \Oscar\Service\ProjectGrantService $projectGrantService */ $projectGrantService = getServiceManager()->get(\Oscar\Service\ProjectGrantService::class); Loading @@ -147,7 +148,6 @@ function oscarJob_hello(GearmanJob $job){ getServiceManager()->get('Logger')->info(" > [gearman:call] TEST OK]"); $job->sendComplete("TRAITEMENT RÉUSSI"); } catch (Exception $e) { $job->sendException("[ERR] HELLO FAIL : " . $e->getMessage()); } Loading
module/Oscar/src/Oscar/Command/OscarActivityNotificationUpdateCommand.php +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ class OscarActivityNotificationUpdateCommand extends OscarAdvancedCommandAbstrac } $this->getProjectGrantService()->getNotificationService()->updateNotificationsActivity($activity); return $this->finalSuccess("Notifications pour '$activity' mises à jour"); return $this->finalSuccess("Notifications mises à jour '$activity'"); } catch (Exception $e) { return $this->finalFatalError($e); } Loading
module/Oscar/src/Oscar/Command/OscarAdvancedCommandAbstract.php +2 −2 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ abstract class OscarAdvancedCommandAbstract extends OscarCommandAbstract */ protected function finalFatalError(\Exception $e): int { $this->getLoggerService()->error($e->getMessage()); $this->getLoggerService()->error("CMD error : " . $e->getMessage()); if( !$this->getIO()->isQuiet() ) { $this->getIO()->error($e->getMessage()); } Loading @@ -151,7 +151,7 @@ abstract class OscarAdvancedCommandAbstract extends OscarCommandAbstract */ protected function finalSuccess( string $message ):int { $this->getLoggerService()->notice($message); $this->getLoggerService()->notice("CMD success : " . $message); if( !$this->io->isQuiet() ){ $this->getIO()->success($message); } Loading
module/Oscar/src/Oscar/Command/OscarConsoleCommand.php +0 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ class OscarConsoleCommand extends OscarCommandAbstract $this->getServicemanager()->get('Logger')->debug("command : $action " . $input->getArgument('params')); switch ($action) { case "notificationsactivity": $command = $this->getApplication()->find(OscarCommandAbstract::COMMAND_ACTIVITY_NOTIFICATION_UPDATE); Loading
module/Oscar/src/Oscar/Controller/ProjectGrantController.php +9 −3 Original line number Diff line number Diff line Loading @@ -79,7 +79,9 @@ use Zend\View\Renderer\PhpRenderer; * * @package Oscar\Controller */ class ProjectGrantController extends AbstractOscarController implements UseNotificationService, UsePersonService, UseServiceContainer, UseProjectService, UseSpentService, UsePCRUService class ProjectGrantController extends AbstractOscarController implements UseNotificationService, UsePersonService, UseServiceContainer, UseProjectService, UseSpentService, UsePCRUService { use UseNotificationServiceTrait, UsePersonServiceTrait, UseServiceContainerTrait, UseProjectServiceTrait, UseSpentServiceTrait, UsePCRUServiceTrait; Loading Loading @@ -778,8 +780,12 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $form->setData($request->getPost()); if ($form->isValid()) { $this->getEntityManager()->flush($projectGrant); $this->getActivityService()->getGearmanJobLauncherService()->triggerUpdateNotificationActivity($projectGrant); $this->getActivityService()->getGearmanJobLauncherService()->triggerUpdateSearchIndexActivity($projectGrant); $this->getActivityService()->getGearmanJobLauncherService()->triggerUpdateNotificationActivity( $projectGrant ); $this->getActivityService()->getGearmanJobLauncherService()->triggerUpdateSearchIndexActivity( $projectGrant ); $this->redirect()->toRoute( 'contract/show', ['id' => $projectGrant->getId()] Loading