From e9e774301831d504f95206d89fd8b8beb709cfb2 Mon Sep 17 00:00:00 2001 From: Vijay Sebastian Date: Thu, 5 Jan 2017 15:56:55 +0530 Subject: [PATCH] scheduling task --- app/Console/Kernel.php | 25 +++++----- .../Controllers/SettingsController.php | 47 +++++++++---------- .../Admin/helpdesk/TemplateController.php | 15 ++++-- nbproject/project.xml | 2 +- 4 files changed, 45 insertions(+), 44 deletions(-) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 72588767d..39a671319 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -30,8 +30,9 @@ class Kernel extends ConsoleKernel protected function schedule(Schedule $schedule) { if (env('DB_INSTALL') == 1) { - $queue = $this->getCurrentQueue(); - $schedule->command('queue:listen '.$queue, ['--tries' => 1])->everyMinute(); + if ($this->getCurrentQueue() != "sync") { + $schedule->command('queue:listen '.$this->getCurrentQueue().' --sleep 60')->everyMinute(); + } $this->execute($schedule, 'fetching'); $this->execute($schedule, 'notification'); $this->execute($schedule, 'work'); @@ -61,34 +62,34 @@ class Kernel extends ConsoleKernel $at = $command['at']; switch ($condition) { case 'everyMinute': - $schedule->everyMinute()->withoutOverlapping(); + $schedule->everyMinute(); break; case 'everyFiveMinutes': - $schedule->everyFiveMinutes()->withoutOverlapping(); + $schedule->everyFiveMinutes(); break; case 'everyTenMinutes': - $schedule->everyTenMinutes()->withoutOverlapping(); + $schedule->everyTenMinutes(); break; case 'everyThirtyMinutes': - $schedule->everyThirtyMinutes()->withoutOverlapping(); + $schedule->everyThirtyMinutes(); break; case 'hourly': - $schedule->hourly()->withoutOverlapping(); + $schedule->hourly(); break; case 'daily': - $schedule->daily()->withoutOverlapping(); + $schedule->daily(); break; case 'dailyAt': $this->getConditionWithOption($schedule, $condition, $at); break; case 'weekly': - $schedule->weekly()->withoutOverlapping(); + $schedule->weekly(); break; case 'monthly': - $schedule->monthly()->withoutOverlapping(); + $schedule->monthly(); break; case 'yearly': - $schedule->yearly()->withoutOverlapping(); + $schedule->yearly(); break; } } @@ -97,7 +98,7 @@ class Kernel extends ConsoleKernel { switch ($command) { case 'dailyAt': - $schedule->dailyAt($at)->withoutOverlapping(); + $schedule->dailyAt($at); break; } } diff --git a/app/FaveoStorage/Controllers/SettingsController.php b/app/FaveoStorage/Controllers/SettingsController.php index e7e8685cb..d017fe3ad 100644 --- a/app/FaveoStorage/Controllers/SettingsController.php +++ b/app/FaveoStorage/Controllers/SettingsController.php @@ -11,26 +11,24 @@ use Lang; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; -class SettingsController extends Controller -{ - public function settingsIcon() - { +class SettingsController extends Controller { + + public function settingsIcon() { return '
-

'.Lang::get('storage::lang.storage').'

+

' . Lang::get('storage::lang.storage') . '

'; } - public function settings() - { + public function settings() { try { $settings = new CommonSettings(); $directories = $this->directories(); @@ -51,8 +49,7 @@ class SettingsController extends Controller } } - public function postSettings(Request $request) - { + public function postSettings(Request $request) { try { $requests = $request->except('_token'); $this->delete(); @@ -70,8 +67,7 @@ class SettingsController extends Controller } } - public function delete() - { + public function delete() { $settings = CommonSettings::where('option_name', 'storage')->get(); if ($settings->count() > 0) { foreach ($settings as $setting) { @@ -80,17 +76,15 @@ class SettingsController extends Controller } } - public function save($key, $value) - { + public function save($key, $value) { CommonSettings::create([ - 'option_name' => 'storage', + 'option_name' => 'storage', 'optional_field' => $key, - 'option_value' => $value, + 'option_value' => $value, ]); } - public function directories($root = '') - { + public function directories($root = '') { if ($root == '') { $root = base_path(); } @@ -109,18 +103,19 @@ class SettingsController extends Controller return $paths; } - public function attachment() - { + public function attachment() { $storage = new StorageController(); $storage->upload(); } - public function activate() - { - $path = 'app'.DIRECTORY_SEPARATOR.'FaveoStorage'.DIRECTORY_SEPARATOR.'database'.DIRECTORY_SEPARATOR.'migrations'; - Artisan::call('migrate', [ - '--path' => $path, - '--force'=> true, + public function activate() { + if (!\Schema::hasColumn('ticket_attachment', 'driver')) { + $path = 'app' . DIRECTORY_SEPARATOR . 'FaveoStorage' . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'migrations'; + Artisan::call('migrate', [ + '--path' => $path, + '--force' => true, ]); + } } + } diff --git a/app/Http/Controllers/Admin/helpdesk/TemplateController.php b/app/Http/Controllers/Admin/helpdesk/TemplateController.php index 6b10c1e3f..da7a1f56a 100644 --- a/app/Http/Controllers/Admin/helpdesk/TemplateController.php +++ b/app/Http/Controllers/Admin/helpdesk/TemplateController.php @@ -326,14 +326,19 @@ class TemplateController extends Controller if (!$from_address) { throw new Exception('Sorry! We can not find your request'); } - $controller = new PhpMailController(); - $controller->setMailConfig($from_address); - $controller->laravelMail($to, '', $subject, $msg, [], null); + $to_address = [ + 'name' => "", + 'email' => $to + ]; + $message = [ + 'subject' => $subject, + 'scenario' => null, + 'body' => $msg + ]; + $this->PhpMailController->sendmail($from, $to_address, $message,[],[]); return redirect()->back()->with('success', 'Mail has send successfully'); } catch (Exception $e) { - dd($e); - return redirect()->back()->with('fails', $e->getMessage()); } } diff --git a/nbproject/project.xml b/nbproject/project.xml index 2c2a20612..dc6cbbfa9 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -3,7 +3,7 @@ org.netbeans.modules.php.project - Faveo-Helpdesk-Pro-bhanu-fork + faveo-helpdesk-community