-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Try out Drupal 9 support * Translate from "9.x" to "all" to keep pace with drupalorg infrastructure changes to update xml service. * Use our own private copy of the symfony/yaml parser to avoid variability with Drupal versions. * Fix a few more tests * Make modules enablable * Make a role class for Drupal 9 (works like Drupal 8). * Queue class for Drupal 9 * Skip tests that use devel, add test fixtures for some other tests. * Add Drupal 9 cache include file * Skip testing of --sanitize option on Drupal 9; it is broken for some reason. Fix the cache test (spurrious failure, did not account for Drupal 9).
- Loading branch information
1 parent
49cee4d
commit 2617d56
Showing
42 changed files
with
2,438 additions
and
19 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
/** | ||
* @file | ||
* Engine for the cache commands. | ||
*/ | ||
|
||
use Drupal\Core\Cache\Cache; | ||
|
||
function _drush_cache_command_get($cid, $bin) { | ||
if (is_null($bin)) { | ||
$bin = _drush_cache_bin_default(); | ||
} | ||
return \Drupal::cache($bin)->get($cid); | ||
} | ||
|
||
/** | ||
* The default bin. | ||
* | ||
* @return string | ||
*/ | ||
function _drush_cache_bin_default() { | ||
return 'default'; | ||
} | ||
|
||
function _drush_cache_command_set($cid, $data, $bin, $expire, $tags) { | ||
if (is_null($bin)) { | ||
$bin = _drush_cache_bin_default(); | ||
} | ||
|
||
// Convert the "expire" argument to a valid value for Drupal's cache_set(). | ||
if ($expire == 'CACHE_TEMPORARY') { | ||
$expire = Cache::TEMPORARY; | ||
} | ||
if (!isset($expire) || $expire == 'CACHE_PERMANENT') { | ||
$expire = Cache::PERMANENT; | ||
} | ||
|
||
return \Drupal::cache($bin)->set($cid, $data, $expire, $tags); | ||
} | ||
|
||
function _drush_cache_clear_types($include_bootstrapped_types) { | ||
$types = array( | ||
'drush' => 'drush_cache_clear_drush', | ||
); | ||
if ($include_bootstrapped_types) { | ||
$types += array( | ||
'theme-registry' => 'drush_cache_clear_theme_registry', | ||
'router' => 'drush_cache_clear_router', | ||
'css-js' => 'drush_cache_clear_css_js', | ||
'module-list' => 'drush_get_modules', | ||
'theme-list' => 'drush_get_themes', | ||
'render' => 'drush_cache_clear_render', | ||
); | ||
} | ||
return $types; | ||
} | ||
|
||
function drush_cache_clear_theme_registry() { | ||
\Drupal::service('theme.registry')->reset(); | ||
} | ||
|
||
function drush_cache_clear_router() { | ||
/** @var \Drupal\Core\Routing\RouteBuilderInterface $router_builder */ | ||
$router_builder = \Drupal::service('router.builder'); | ||
$router_builder->rebuild(); | ||
} | ||
|
||
function drush_cache_clear_css_js() { | ||
_drupal_flush_css_js(); | ||
drupal_clear_css_cache(); | ||
drupal_clear_js_cache(); | ||
} | ||
|
||
/** | ||
* Clear the cache of the block output. | ||
*/ | ||
function drush_cache_clear_block() { | ||
// There is no distinct block cache in D8. See https://github.com/drush-ops/drush/issues/1531. | ||
// \Drupal::cache('block')->deleteAll(); | ||
} | ||
|
||
/** | ||
* Clears the render cache entries. | ||
*/ | ||
function drush_cache_clear_render() { | ||
Cache::invalidateTags(['rendered']); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
|
||
use Symfony\Component\Yaml\Dumper; | ||
use Drush\Internal\Symfony\Yaml\Dumper; | ||
|
||
/** | ||
* Output formatter 'yaml' | ||
|
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Drush\Queue; | ||
|
||
use Drush\Log\LogLevel; | ||
use Drupal\Core\Queue\QueueWorkerManager; | ||
use Drupal\Core\Queue\RequeueException; | ||
use Drupal\Core\Queue\SuspendQueueException; | ||
|
||
class Queue9 extends Queue8 { | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Drush\Role; | ||
|
||
use Drupal\user\Entity\Role; | ||
|
||
class Role9 extends Role8 { | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
namespace Drush\Sql; | ||
|
||
use Drupal\Core\Database\Database; | ||
|
||
class Sql9 extends Sql8 { | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
|
||
namespace Drush\User; | ||
|
||
use Drupal\user\Entity\User; | ||
|
||
class User9 extends User8 { | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Drush\User; | ||
|
||
class UserSingle9 extends UserSingle8 { | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
CHANGELOG | ||
========= | ||
|
||
2.8.0 | ||
----- | ||
|
||
* Deprecated usage of a colon in an unquoted mapping value | ||
* Deprecated usage of @, \`, | and > at the beginning of an unquoted string | ||
* When surrounding strings with double-quotes, you must now escape `\` characters. Not | ||
escaping those characters (when surrounded by double-quotes) is deprecated. | ||
|
||
Before: | ||
|
||
```yml | ||
class: "Foo\Var" | ||
``` | ||
|
||
After: | ||
|
||
```yml | ||
class: "Foo\\Var" | ||
``` | ||
|
||
2.1.0 | ||
----- | ||
|
||
* Yaml::parse() does not evaluate loaded files as PHP files by default | ||
anymore (call Yaml::enablePhpParsing() to get back the old behavior) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Drush\Internal\Symfony\Yaml; | ||
|
||
/** | ||
* Dumper dumps PHP variables to YAML strings. | ||
* | ||
* @author Fabien Potencier <fabien@symfony.com> | ||
*/ | ||
class Dumper | ||
{ | ||
/** | ||
* The amount of spaces to use for indentation of nested nodes. | ||
* | ||
* @var int | ||
*/ | ||
protected $indentation = 4; | ||
|
||
/** | ||
* Sets the indentation. | ||
* | ||
* @param int $num The amount of spaces to use for indentation of nested nodes | ||
*/ | ||
public function setIndentation($num) | ||
{ | ||
if ($num < 1) { | ||
throw new \InvalidArgumentException('The indentation must be greater than zero.'); | ||
} | ||
|
||
$this->indentation = (int) $num; | ||
} | ||
|
||
/** | ||
* Dumps a PHP value to YAML. | ||
* | ||
* @param mixed $input The PHP value | ||
* @param int $inline The level where you switch to inline YAML | ||
* @param int $indent The level of indentation (used internally) | ||
* @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types (a PHP resource or object), false otherwise | ||
* @param bool $objectSupport True if object support is enabled, false otherwise | ||
* | ||
* @return string The YAML representation of the PHP value | ||
*/ | ||
public function dump($input, $inline = 0, $indent = 0, $exceptionOnInvalidType = false, $objectSupport = false) | ||
{ | ||
$output = ''; | ||
$prefix = $indent ? str_repeat(' ', $indent) : ''; | ||
|
||
if ($inline <= 0 || !\is_array($input) || empty($input)) { | ||
$output .= $prefix.Inline::dump($input, $exceptionOnInvalidType, $objectSupport); | ||
} else { | ||
$isAHash = Inline::isHash($input); | ||
|
||
foreach ($input as $key => $value) { | ||
$willBeInlined = $inline - 1 <= 0 || !\is_array($value) || empty($value); | ||
|
||
$output .= sprintf('%s%s%s%s', | ||
$prefix, | ||
$isAHash ? Inline::dump($key, $exceptionOnInvalidType, $objectSupport).':' : '-', | ||
$willBeInlined ? ' ' : "\n", | ||
$this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $exceptionOnInvalidType, $objectSupport) | ||
).($willBeInlined ? "\n" : ''); | ||
} | ||
} | ||
|
||
return $output; | ||
} | ||
} |
Oops, something went wrong.