Skip to content

Commit

Permalink
Update Media to 7.x-4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Hunt committed Feb 11, 2023
1 parent 11b2b62 commit bc09ed9
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 34 deletions.
6 changes: 3 additions & 3 deletions docroot/sites/all/modules/contrib/media/media.info
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ configure = admin/config/media/browser
; We have to add a fake version so Git checkouts do not fail Media dependencies
version = 7.x-2.x-dev

; Information added by Drupal.org packaging script on 2022-04-07
version = "7.x-4.3"
; Information added by Drupal.org packaging script on 2023-01-17
version = "7.x-4.5"
core = "7.x"
project = "media"
datestamp = "1649338980"
datestamp = "1673934048"
18 changes: 14 additions & 4 deletions docroot/sites/all/modules/contrib/media/media.module
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ function media_form_field_ui_field_edit_form_alter(&$form, &$form_state) {
// Add a validation function to any field instance which uses the media widget
// to ensure that the upload destination scheme is one of the allowed schemes
// if any defined by settings.
if (isset($form['instance']['widget']) && $form['instance']['widget']['type']['#value'] == 'media_generic' && isset($form['#field']['settings']['uri_scheme'])) {
if (isset($form['instance']['widget']) && isset($form['instance']['widget']['type']) && $form['instance']['widget']['type']['#value'] == 'media_generic' && isset($form['#field']['settings']['uri_scheme'])) {
$form['#validate'][] = 'media_field_instance_validate';
}
}
Expand All @@ -381,11 +381,21 @@ function media_form_field_ui_field_edit_form_alter(&$form, &$form_state) {
* allowed schemes.
*/
function media_field_instance_validate($form, &$form_state) {
$allowed_schemes = array_filter($form_state['values']['instance']['widget']['settings']['allowed_schemes']);
$widget_settings = $form_state['values']['instance']['widget']['settings'];
$browser_plugins = array();
if (isset($widget_settings['browser_plugins'])) {
$browser_plugins = array_filter($widget_settings['browser_plugins']);
}
$allowed_schemes = array();
if (isset($widget_settings['allowed_schemes'])) {
$allowed_schemes = array_filter($widget_settings['allowed_schemes']);
}
$upload_destination = $form_state['values']['field']['settings']['uri_scheme'];

if (!empty($allowed_schemes) && !in_array($upload_destination, $allowed_schemes)) {
form_set_error('allowed_schemes', t('The upload destination must be one of the allowed schemes.'));
$is_upload_enabled = (empty($browser_plugins) || in_array('upload', $browser_plugins));

if ($is_upload_enabled && !empty($allowed_schemes) && !in_array($upload_destination, $allowed_schemes)) {
form_set_error('allowed_schemes', t('When upload is enabled, the upload destination must be one of the allowed schemes.'));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ test_dependencies[] = plupload
files[] = includes/MediaBrowserBulkUpload.inc
files[] = tests/media_bulk_upload.test

; Information added by Drupal.org packaging script on 2022-04-07
version = "7.x-4.3"
; Information added by Drupal.org packaging script on 2023-01-17
version = "7.x-4.5"
core = "7.x"
project = "media"
datestamp = "1649338980"
datestamp = "1673934048"
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/
abstract class MediaInternetBaseHandler {

protected $embedCode = '';

/**
* The constructor for the MediaInternetBaseHandler class. This method is also called
* from the classes that extend this class and override this method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ files[] = includes/MediaInternetNoHandlerException.inc
files[] = includes/MediaInternetValidationException.inc
files[] = tests/media_internet.test

; Information added by Drupal.org packaging script on 2022-04-07
version = "7.x-4.3"
; Information added by Drupal.org packaging script on 2023-01-17
version = "7.x-4.5"
core = "7.x"
project = "media"
datestamp = "1649338980"
datestamp = "1673934048"
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ hidden = TRUE
files[] = includes/MediaInternetTestStreamWrapper.inc
files[] = includes/MediaInternetTestHandler.inc

; Information added by Drupal.org packaging script on 2022-04-07
version = "7.x-4.3"
; Information added by Drupal.org packaging script on 2023-01-17
version = "7.x-4.5"
core = "7.x"
project = "media"
datestamp = "1649338980"
datestamp = "1673934048"
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ dependencies[] = media

configure = admin/structure/file-types/upgrade

; Information added by Drupal.org packaging script on 2022-04-07
version = "7.x-4.3"
; Information added by Drupal.org packaging script on 2023-01-17
version = "7.x-4.5"
core = "7.x"
project = "media"
datestamp = "1649338980"
datestamp = "1673934048"
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ files[] = tests/media_wysiwyg.paragraph_fix_filter.test

configure = admin/config/media/browser

; Information added by Drupal.org packaging script on 2022-04-07
version = "7.x-4.3"
; Information added by Drupal.org packaging script on 2023-01-17
version = "7.x-4.5"
core = "7.x"
project = "media"
datestamp = "1649338980"
datestamp = "1673934048"
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*/
abstract class MediaWYSIWYGMacroTestHelper extends MediaWYSIWYGTestHelper {

protected $admin_user = NULL;

/**
* Common setup routines for rendered media macros.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ features[filter][] = full_html
features[wysiwyg][] = filtered_html
features[wysiwyg][] = full_html

; Information added by Drupal.org packaging script on 2022-04-07
version = "7.x-4.3"
; Information added by Drupal.org packaging script on 2023-01-17
version = "7.x-4.5"
core = "7.x"
project = "media"
datestamp = "1649338980"
datestamp = "1673934048"
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ description = DEPRECATED, this folder is only here so that the module can be uni
package = Media
core = 7.x

; Information added by Drupal.org packaging script on 2022-04-07
version = "7.x-4.3"
; Information added by Drupal.org packaging script on 2023-01-17
version = "7.x-4.5"
core = "7.x"
project = "media"
datestamp = "1649338980"
datestamp = "1673934048"
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package = Media
core = 7.x
dependencies[] = media

; Information added by Drupal.org packaging script on 2022-04-07
version = "7.x-4.3"
; Information added by Drupal.org packaging script on 2023-01-17
version = "7.x-4.5"
core = "7.x"
project = "media"
datestamp = "1649338980"
datestamp = "1673934048"
13 changes: 13 additions & 0 deletions docroot/sites/all/modules/contrib/media/tests/media.test
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ class MediaElementTestCase extends MediaFileFieldTestCase {
* Test media file administration page functionality.
*/
class MediaAdminTestCase extends MediaFileFieldTestCase {
protected $base_user_1 = NULL;
protected $base_user_2 = NULL;
protected $base_user_3 = NULL;
protected $base_user_4 = NULL;

public static function getInfo() {
return array(
'name' => 'Media file administration',
Expand Down Expand Up @@ -515,6 +520,10 @@ class MediaHooksTestCase extends MediaFileFieldTestCase {
* Tests the media browser 'Library' tab.
*/
class MediaBrowserLibraryTestCase extends MediaFileFieldTestCase {
protected $base_user_1 = NULL;
protected $base_user_2 = NULL;
protected $base_user_3 = NULL;

public static function getInfo() {
return array(
'name' => 'Media browser library test',
Expand Down Expand Up @@ -782,6 +791,10 @@ class MediaBrowserSettingsTestCase extends MediaFileFieldTestCase {
* Tests the media browser 'My files' tab.
*/
class MediaBrowserMyFilesTestCase extends MediaFileFieldTestCase {
protected $base_user_1 = NULL;
protected $base_user_2 = NULL;
protected $base_user_3 = NULL;

public static function getInfo() {
return array(
'name' => 'Media browser my files test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ hidden = TRUE

files[] = includes/MediaModuleTest.inc

; Information added by Drupal.org packaging script on 2022-04-07
version = "7.x-4.3"
; Information added by Drupal.org packaging script on 2023-01-17
version = "7.x-4.5"
core = "7.x"
project = "media"
datestamp = "1649338980"
datestamp = "1673934048"

0 comments on commit bc09ed9

Please sign in to comment.