Created
January 8, 2017 19:20
-
-
Save acrosman/fc5c8f6abed2d2efafdaed7fc8134a5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\sitemanager\Plugin\TaskPlugin; | |
use Drupal\sitemanager\Plugin\TaskPluginBase; | |
/** | |
* Class RunCron. | |
* | |
* @package Drupal\sitemanager\Plugin\TaskPlugin | |
* | |
* @SMTaskPlugin( | |
* id = "run_cron", | |
* taskName = @Translation("Run Cron"), | |
* status = "Waiting", | |
* ) | |
*/ | |
class RunCron extends TaskPluginBase { | |
public function run($site) { | |
$path = $site->getFullSystemPath(); | |
$response = $this->processService->run('drush cron', $path); | |
if ($response['status'] == 'Error') { | |
$this->output = [ | |
'#type' => 'markup', | |
'#markup' => $this->t('Error running cron'), | |
]; | |
$this->pluginDefinition['status'] = 'Error'; | |
} | |
else { | |
$this->output = [ | |
'#type' => 'markup', | |
'#markup' => $this->t('Cron run complete'), | |
]; | |
$this->pluginDefinition['status'] = 'Success'; | |
} | |
return $this->getTaskStatus(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment