summaryrefslogtreecommitdiff
path: root/modules/aggregator
diff options
context:
space:
mode:
Diffstat (limited to 'modules/aggregator')
-rw-r--r--modules/aggregator/aggregator.install7
-rw-r--r--modules/aggregator/aggregator.module8
-rw-r--r--modules/aggregator/tests/aggregator_test.module2
3 files changed, 9 insertions, 8 deletions
diff --git a/modules/aggregator/aggregator.install b/modules/aggregator/aggregator.install
index bad9bac5a..43fcf8119 100644
--- a/modules/aggregator/aggregator.install
+++ b/modules/aggregator/aggregator.install
@@ -170,10 +170,10 @@ function aggregator_schema() {
),
'hash' => array(
'type' => 'varchar',
- 'length' => 32,
+ 'length' => 64,
'not null' => TRUE,
'default' => '',
- 'description' => 'Calculated md5 hash of the feed data, used for validating cache.',
+ 'description' => 'Calculated hash of the feed data, used for validating cache.',
),
'etag' => array(
'type' => 'varchar',
@@ -275,7 +275,7 @@ function aggregator_schema() {
* Add hash column to aggregator_feed table.
*/
function aggregator_update_7000() {
- db_add_field('aggregator_feed', 'hash', array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''));
+ db_add_field('aggregator_feed', 'hash', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''));
}
/**
@@ -297,3 +297,4 @@ function aggregator_update_7002() {
));
db_add_index('aggregator_feed', 'queued', array('queued'));
}
+
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index b6cf40c3b..172361a2b 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -614,12 +614,12 @@ function aggregator_refresh($feed) {
list($fetcher, $parser, $processors) = _aggregator_get_variables();
$success = module_invoke($fetcher, 'aggregator_fetch', $feed);
- // We store the md5 hash of feed data in the database. When refreshing a
+ // We store the hash of feed data in the database. When refreshing a
// feed we compare stored hash and new hash calculated from downloaded
// data. If both are equal we say that feed is not updated.
- $md5 = md5($feed->source_string);
+ $hash = hash('sha256', $feed->source_string);
- if ($success && ($feed->hash != $md5)) {
+ if ($success && ($feed->hash != $hash)) {
// Parse the feed.
if (module_invoke($parser, 'aggregator_parse', $feed)) {
// Update feed with parsed data.
@@ -630,7 +630,7 @@ function aggregator_refresh($feed) {
'link' => empty($feed->link) ? $feed->url : $feed->link,
'description' => empty($feed->description) ? '' : $feed->description,
'image' => empty($feed->image) ? '' : $feed->image,
- 'hash' => $md5,
+ 'hash' => $hash,
'etag' => empty($feed->etag) ? '' : $feed->etag,
'modified' => empty($feed->modified) ? 0 : $feed->modified,
))
diff --git a/modules/aggregator/tests/aggregator_test.module b/modules/aggregator/tests/aggregator_test.module
index 46521995f..0e67bbf59 100644
--- a/modules/aggregator/tests/aggregator_test.module
+++ b/modules/aggregator/tests/aggregator_test.module
@@ -25,7 +25,7 @@ function aggregator_test_menu() {
*/
function aggregator_test_feed($use_last_modified = FALSE, $use_etag = FALSE) {
$last_modified = strtotime('Sun, 19 Nov 1978 05:00:00 GMT');
- $etag = md5($last_modified);
+ $etag = drupal_hash_base64($last_modified);
$if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : FALSE;
$if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : FALSE;