Browse Source

Merge pull request #3 from Islandora/7.x

update 7.x
pull/490/head
qadan 11 years ago
parent
commit
948fa34ca7
  1. 7
      includes/authtokens.inc
  2. 18
      includes/solution_packs.inc
  3. 4
      islandora.module
  4. 16
      tests/scripts/travis_setup.sh

7
includes/authtokens.inc

@ -36,12 +36,7 @@ define('ISLANDORA_AUTHTOKEN_TOKEN_TIMEOUT', 300);
function islandora_get_object_token($pid, $dsid, $uses = 1) { function islandora_get_object_token($pid, $dsid, $uses = 1) {
global $user; global $user;
$time = time(); $time = time();
// The function mt_rand is not considered cryptographically secure $token = bin2hex(drupal_random_bytes(32));
// and openssl_rando_pseudo_bytes() is only available in PHP > 5.3.
// We might be safe in this case because mt_rand should never be using
// the same seed, but this is still more secure.
$token = hash("sha256", mt_rand() . $time);
$id = db_insert("islandora_authtokens")->fields( $id = db_insert("islandora_authtokens")->fields(
array( array(
'token' => $token, 'token' => $token,

18
includes/solution_packs.inc

@ -256,7 +256,7 @@ function islandora_solution_pack_form_submit(array $form, array &$form_state) {
* the batch. * the batch.
* @param array $not_checked * @param array $not_checked
* The object that will bot be install. * The object that will bot be install.
* *
* @return array * @return array
* An array defining a batch which can be passed on to batch_set(). * An array defining a batch which can be passed on to batch_set().
*/ */
@ -367,7 +367,7 @@ function islandora_install_solution_pack($module, $op = 'install', $force = FALS
$t = get_t(); $t = get_t();
// Some general replacements. // Some general replacements.
$admin_link = l($t('Solution Pack admin'), 'admin/islandora/solution_packs'); $admin_link = l($t('Solution Pack admin'), 'admin/islandora/solution_pack_config');
$config_link = l($t('Islandora configuration'), 'admin/islandora/configure'); $config_link = l($t('Islandora configuration'), 'admin/islandora/configure');
$t_params = array( $t_params = array(
'@module' => $module, '@module' => $module,
@ -712,9 +712,8 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL, $model =
* given, than any viewer that supports either the give $mimetype or $model will * given, than any viewer that supports either the give $mimetype or $model will
* be listed. * be listed.
* *
* @param string $mimetype * @param array $mimetype
* Specify a mimetype to return only viewers that support this certain * List of mimetypes that the viewer supports.
* mimetype.
* @param string $content_model * @param string $content_model
* Specify a content model to return only viewers that support the content * Specify a content model to return only viewers that support the content
* model. * model.
@ -722,14 +721,19 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL, $model =
* @return array * @return array
* Viewer definitions, or FALSE if none are found. * Viewer definitions, or FALSE if none are found.
*/ */
function islandora_get_viewers($mimetype = NULL, $content_model = NULL) { function islandora_get_viewers($mimetype = array(), $content_model = NULL) {
$viewers = array(); $viewers = array();
$defined_viewers = module_invoke_all('islandora_viewer_info'); $defined_viewers = module_invoke_all('islandora_viewer_info');
if (!is_array($mimetype)) {
$mimetype = array($mimetype);
}
// Filter viewers by MIME type. // Filter viewers by MIME type.
foreach ($defined_viewers as $key => $value) { foreach ($defined_viewers as $key => $value) {
$value['mimetype'] = isset($value['mimetype']) ? $value['mimetype'] : array(); $value['mimetype'] = isset($value['mimetype']) ? $value['mimetype'] : array();
$value['model'] = isset($value['model']) ? $value['model'] : array(); $value['model'] = isset($value['model']) ? $value['model'] : array();
if (in_array($mimetype, $value['mimetype']) OR in_array($content_model, $value['model'])) { if (array_intersect($mimetype, $value['mimetype']) OR in_array($content_model, $value['model'])) {
$viewers[$key] = $value; $viewers[$key] = $value;
} }
} }

4
islandora.module

@ -123,11 +123,11 @@ function islandora_menu() {
'access arguments' => array('Islandora Viewers'), 'access arguments' => array('Islandora Viewers'),
'type' => MENU_NORMAL_ITEM, 'type' => MENU_NORMAL_ITEM,
); );
$items['admin/islandora/islandora_utilities'] = array( $items['admin/islandora/tools'] = array(
'title' => 'Islandora Utility Modules', 'title' => 'Islandora Utility Modules',
'description' => 'Configure Islandora utility modules.', 'description' => 'Configure Islandora utility modules.',
'access callback' => 'islandora_find_package', 'access callback' => 'islandora_find_package',
'access arguments' => array('Islandora Utilities'), 'access arguments' => array('Islandora Tools'),
'type' => MENU_NORMAL_ITEM, 'type' => MENU_NORMAL_ITEM,
); );
$items['admin/islandora/solution_pack_config/solution_packs'] = array( $items['admin/islandora/solution_pack_config/solution_packs'] = array(

16
tests/scripts/travis_setup.sh

@ -12,14 +12,16 @@ export CATALINA_HOME='.'
export JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -Djavax.net.ssl.trustStore=$CATALINA_HOME/fedora/server/truststore -Djavax.net.ssl.trustStorePassword=tomcat" export JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -Djavax.net.ssl.trustStore=$CATALINA_HOME/fedora/server/truststore -Djavax.net.ssl.trustStorePassword=tomcat"
./bin/startup.sh ./bin/startup.sh
cd $HOME cd $HOME
pear channel-discover pear.drush.org
pear upgrade --force Console_Getopt pear upgrade --force Console_Getopt
pear upgrade --force pear pear upgrade --force pear
pear channel-discover pear.drush.org pear channel-discover pear.drush.org
pear channel-discover pear.drush.org
pear channel-discover pear.phpqatools.org # "prefer-source" required due to SSL shenanigans on the Travis boxes...
pear channel-discover pear.netpirates.net composer global require --prefer-source 'squizlabs/php_codesniffer=*' 'sebastian/phpcpd=*'
pear install pear/PHP_CodeSniffer # Because we can't add to the PATH here and this file is used in many repos,
pear install pear.phpunit.de/phpcpd # let's just throw symlinks in.
find $HOME/.composer/vendor/bin -executable \! -type d -exec sudo ln -s {} /usr/local/sbin/ \;
# Install Drush # Install Drush
git clone https://github.com/drush-ops/drush.git git clone https://github.com/drush-ops/drush.git
@ -33,6 +35,10 @@ phpenv rehash
drush dl --yes drupal drush dl --yes drupal
cd drupal-* cd drupal-*
drush si minimal --db-url=mysql://drupal:drupal@localhost/drupal --yes drush si minimal --db-url=mysql://drupal:drupal@localhost/drupal --yes
# Needs to make things from Composer be available (PHP CS, primarily)
sudo chmod a+w sites/default/settings.php
echo "include_once '$HOME/.composer/vendor/autoload.php';" >> sites/default/settings.php
sudo chmod a-w sites/default/settings.php
drush runserver --php-cgi=$HOME/.phpenv/shims/php-cgi localhost:8081 &>/dev/null & drush runserver --php-cgi=$HOME/.phpenv/shims/php-cgi localhost:8081 &>/dev/null &
ln -s $ISLANDORA_DIR sites/all/modules/islandora ln -s $ISLANDORA_DIR sites/all/modules/islandora
mv sites/all/modules/islandora/tests/travis.test_config.ini sites/all/modules/islandora/tests/test_config.ini mv sites/all/modules/islandora/tests/travis.test_config.ini sites/all/modules/islandora/tests/test_config.ini

Loading…
Cancel
Save