-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use the d8-rs-router.php for drupal 7 #1658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
MartijnBraam
wants to merge
3
commits into
drush-ops:master
from
MartijnBraam:feature/1641-runserver-with-dot-in-url
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
This file contains hidden or 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 hidden or 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,44 @@ | ||
| <?php | ||
|
|
||
| // We hijack filter_init (which core filter module does not implement) as | ||
| // a convenient place to affect early changes. | ||
| if (!function_exists('filter_init')) { | ||
| // Check function_exists as a safety net in case it is added in future. | ||
| function filter_init() { | ||
| global $conf, $user; | ||
| // Inject values into the $conf array - will apply to all sites. | ||
| // This can be a useful place to apply generic development settings. | ||
| $conf_inject = unserialize(urldecode(runserver_env('RUNSERVER_CONF'))); | ||
| // Merge in the injected conf, overriding existing items. | ||
| $conf = array_merge($conf, $conf_inject); | ||
| } | ||
| } | ||
|
|
||
| // We hijack system_watchdog (which core system module does not implement) as | ||
| // a convenient place to capture logs. | ||
| if (!function_exists('system_watchdog')) { | ||
| // Check function_exists as a safety net in case it is added in future. | ||
| function system_watchdog($log_entry = array()) { | ||
| // Drupal <= 7.x defines VERSION. Drupal 8 defines Drupal::VERSION instead. | ||
| if (defined('VERSION')) { | ||
| $uid = $log_entry['user']->uid; | ||
| } | ||
| else { | ||
| $uid = $log_entry['user']->id(); | ||
| } | ||
| $message = strtr('Watchdog: !message | severity: !severity | type: !type | uid: !uid | !ip | !request_uri | !referer | !link', array( | ||
| '!message' => strip_tags(!isset($log_entry['variables']) ? $log_entry['message'] : strtr($log_entry['message'], $log_entry['variables'])), | ||
| '!severity' => $log_entry['severity'], | ||
| '!type' => $log_entry['type'], | ||
| '!ip' => $log_entry['ip'], | ||
| '!request_uri' => $log_entry['request_uri'], | ||
| '!referer' => $log_entry['referer'], | ||
| '!uid' => $uid, | ||
| '!link' => strip_tags($log_entry['link']), | ||
| )); | ||
| error_log($message); | ||
| } | ||
| } | ||
|
|
||
| // Pass through to the default runserver router. | ||
| include __DIR__ . '/rs-router.php'; | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -131,11 +131,15 @@ function drush_core_runserver($uri = NULL) { | |
| drush_start_browser($browse, 2); | ||
| } | ||
| // Start the server using 'php -S'. | ||
| if (drush_drupal_major_version() >=8) { | ||
| $extra = ' "' . __DIR__ . '/d8-rs-router.php"'; | ||
| if (drush_drupal_major_version() >= 8) { | ||
| $extra = ' "' . __DIR__ . '/rs-router.php"'; | ||
| } | ||
| elseif (drush_drupal_major_version() == 7) { | ||
| $extra = ' "' . __DIR__ . '/rs-router_7.php"'; | ||
| } | ||
| else { | ||
| $extra = ' --define auto_prepend_file="' . __DIR__ . '/runserver-prepend.php"'; | ||
| // For Drupal 6 we prepend an include to what PHP was going invoke. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The master branch of Drush no longer supports Drupal 6. I dont mind removing this bit at merge time if that makes things simple. |
||
| $extra = ' --define auto_prepend_file="' . __DIR__ . '/rs-router_6.php"'; | ||
| } | ||
| $root = \Drush::bootstrapManager()->getRoot(); | ||
| drush_shell_exec_interactive('cd %s && %s -S ' . $addr . ':' . $uri['port']. $extra, $root, drush_get_option('php', 'php')); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like D8 code in a D7 file.