function cronkeychange_generate_submit in Cron key change 2.x
Same name and namespace in other branches
- 8 cronkeychange.module \cronkeychange_generate_submit()
- 7 cronkeychange.module \cronkeychange_generate_submit()
Generate new cron key.
1 call to cronkeychange_generate_submit()
- CronKeyChangeCommands::cronkeychange in src/
Commands/ CronKeyChangeCommands.php - Generate new cron key.
1 string reference to 'cronkeychange_generate_submit'
File
- ./
cronkeychange.module, line 39 - Cron Key Change.
Code
function cronkeychange_generate_submit(&$form = [], &$form_state = []) {
$cron_key = Crypt::randomBytesBase64(55);
\Drupal::state()
->set('system.cron_key', $cron_key);
if (PHP_SAPI !== 'cli') {
\Drupal::messenger()
->addMessage(t('New cron key generated.'));
}
\Drupal::logger('cronkeychange')
->notice('New cron key generated.');
}