Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
default_content
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
default_content
Merge requests
!45
Resolve
#3282547
"Drush delete content reimport"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Resolve
#3282547
"Drush delete content reimport"
issue/default_content-3282547:3282547-drush-delete-content-reimport
into
2.0.x
Overview
3
Commits
8
Pipelines
0
Changes
5
1 unresolved thread
Show all comments
Open
eduardo morales alberti
requested to merge
issue/default_content-3282547:3282547-drush-delete-content-reimport
into
2.0.x
1 year ago
Overview
3
Commits
8
Pipelines
0
Changes
5
1 unresolved thread
Show all comments
Expand
Closes
#3282547
0
0
Merge request reports
Compare
2.0.x
version 5
4a9fb8d3
4 weeks ago
version 4
cb76431e
4 weeks ago
version 3
e1b19575
1 year ago
version 2
e02cf371
1 year ago
version 1
4f0a3fd7
1 year ago
2.0.x (HEAD)
and
latest version
latest version
342b06eb
8 commits,
4 weeks ago
version 5
4a9fb8d3
7 commits,
4 weeks ago
version 4
cb76431e
6 commits,
4 weeks ago
version 3
e1b19575
5 commits,
1 year ago
version 2
e02cf371
4 commits,
1 year ago
version 1
4f0a3fd7
3 commits,
1 year ago
5 files
+
242
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
src/Commands/DefaultContentDeleteCommands.php
0 → 100644
+
73
−
0
Options
<?php
namespace
Drupal\default_content\Commands
;
use
Drupal\default_content
\DeleterInterface
;
use
Drupal\default_content
\ImporterInterface
;
use
Drush\Commands\DrushCommands
;
/**
* Deletes and/or import module content.
*
* @package Drupal\default_content
*/
class
DefaultContentDeleteCommands
extends
DrushCommands
{
/**
* The default content deleter.
*
* @var \Drupal\default_content\DeleterInterface
*/
protected
DeleterInterface
$defaultContentDeleter
;
/**
* The default content importer.
*
* @var \Drupal\default_content\ImporterInterface
*/
protected
ImporterInterface
$defaultContentImporter
;
/**
* DefaultContentDeleteCommands constructor.
*
* @param \Drupal\default_content\DeleterInterface $default_content_deleter
* The default content deleter.
* @param \Drupal\default_content\ImporterInterface $default_content_importer
* The default content importer.
*/
public
function
__construct
(
DeleterInterface
$default_content_deleter
,
ImporterInterface
$default_content_importer
)
{
parent
::
__construct
();
$this
->
defaultContentDeleter
=
$default_content_deleter
;
$this
->
defaultContentImporter
=
$default_content_importer
;
}
/**
* Deletes all the content defined in a module's content folder.
*
* @param string $module
* The name of the module.
*
* @command default-content:delete-module
* @aliases dcdm
*/
public
function
contentDeleteModule
(
$module
)
{
$this
->
defaultContentDeleter
->
deleteModuleContent
(
$module
);
}
/**
* Deletes the content defined in a module's content and imports it again.
*
* @param string $module
* The name of the module.
*
* @command default-content:reimport-module
* @aliases dcrm
*/
public
function
contentReimportModule
(
$module
)
{
$this
->
logger
()
->
notice
(
'Deleting default content from module '
.
$module
);
$this
->
defaultContentDeleter
->
deleteModuleContent
(
$module
);
$this
->
logger
()
->
notice
(
'Reimporting default content.'
);
$this
->
defaultContentImporter
->
importContent
(
$module
);
}
}
Loading