Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_cfg_common
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WCMS
uw_cfg_common
Commits
f3703bcd
Commit
f3703bcd
authored
3 years ago
by
Igor Biki
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-5409: Adding drush command to get lightweight cron key and url.
parent
3336eb4a
No related branches found
No related tags found
1 merge request
!229
ISTWCMS-5409: Removing host from drush command, and using path instead that...
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
drush.services.yml
+1
-1
1 addition, 1 deletion
drush.services.yml
src/Commands/UwDrushCommands.php
+57
-1
57 additions, 1 deletion
src/Commands/UwDrushCommands.php
with
58 additions
and
2 deletions
drush.services.yml
+
1
−
1
View file @
f3703bcd
services
:
uw_cfg_common.commands
:
class
:
Drupal\uw_cfg_common\Commands\UwDrushCommands
arguments
:
[
'
@entity_type.manager'
,
'
@uw_cfg_common.missing_blocks'
]
arguments
:
[
'
@entity_type.manager'
,
'
@uw_cfg_common.missing_blocks'
,
'
@config.factory'
,
'
@request_stack'
]
tags
:
-
{
name
:
drush.command
}
This diff is collapsed.
Click to expand it.
src/Commands/UwDrushCommands.php
+
57
−
1
View file @
f3703bcd
...
...
@@ -2,11 +2,13 @@
namespace
Drupal\uw_cfg_common\Commands
;
use
Drupal\Core\Config\ConfigFactoryInterface
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Drupal\uw_cfg_common
\Service\UWMissingBlocks
;
use
Drupal\uw_cfg_common
\UwRoles\UwRoles
;
use
Drush\Commands\DrushCommands
;
use
Drush\Utils\StringUtils
;
use
Symfony\Component\HttpFoundation\RequestStack
;
/**
* Drush commands for uw_cfg_common module.
...
...
@@ -29,12 +31,28 @@ class UwDrushCommands extends DrushCommands {
*/
protected
$missingBlocks
;
/**
* Config factory from core.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected
$configFactory
;
/**
* Request from core.
*
* @var \Symfony\Component\HttpFoundation\Request
*/
protected
$request
;
/**
* {@inheritDoc}
*/
public
function
__construct
(
EntityTypeManagerInterface
$entityTypeManager
,
UWMissingBlocks
$missingBlocks
)
{
public
function
__construct
(
EntityTypeManagerInterface
$entityTypeManager
,
UWMissingBlocks
$missingBlocks
,
ConfigFactoryInterface
$configFactory
,
RequestStack
$requestStack
)
{
$this
->
entityTypeManager
=
$entityTypeManager
;
$this
->
missingBlocks
=
$missingBlocks
;
$this
->
configFactory
=
$configFactory
;
$this
->
request
=
$requestStack
->
getCurrentRequest
();
}
/**
...
...
@@ -167,4 +185,42 @@ class UwDrushCommands extends DrushCommands {
$this
->
logger
()
->
success
(
'Missing blocks removed from saved and unsaved layouts.'
);
}
/**
* Command to retrieve scheduler's lightweight cron key.
*
* @return string
* Lightweight cron key.
*
* @command uw:lightweight-cron-key
* @aliases uw-lwc-key
* @usage drush uw-lwc-key
* - Return light weight cron key.
*/
public
function
getLightWeightCronKey
():
string
{
$key
=
''
;
$config
=
$this
->
configFactory
->
get
(
'scheduler.settings'
);
if
(
!
empty
(
$config
))
{
$key
=
$config
->
get
(
'lightweight_cron_access_key'
);
}
return
$key
;
}
/**
* Command to retrieve scheduler's lightweight cron url.
*
* @return string
* Lightweight cron url.
*
* @command uw:lightweight-cron-url
* @aliases uw-lwc-url
* @usage drush uw-lwc-url
* - Return light weight cron url with key.
*/
public
function
getLightWeightCronUrl
():
string
{
$host
=
$this
->
request
->
getSchemeAndHttpHost
();
return
$host
.
'/scheduler/cron/'
.
$this
->
getLightWeightCronKey
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment