A defined and assigned Random block will not be updated when its update interval has expired. The SQL query to determine if a Random block exists is wrong.

In the {block} table the Web Links Blocks module is stored as 'weblinks_blocks' and not 'weblinks'. So this code has stopped working for a while since the separate sections were moved out into contribs instead of being all in weblinks.module.

<?php
$block_exists = db_result(db_query("SELECT COUNT(*) FROM {block} b WHERE b.theme='%s' AND b.module='weblinks' AND b.delta='weblink-random' AND b.status=1", $theme));
?>

The code in D6 is wrong too. Patch will follow.

Comments

gstegemann’s picture

Issue summary: View changes
gstegemann’s picture

Issue summary: View changes
gstegemann’s picture

Issue summary: View changes
gstegemann’s picture

Status: Active » Needs review
StatusFileSize
new1.42 KB

Here's the patch against 7.x-1.x-dev.

Status: Needs review » Needs work

The last submitted patch, 4: 2376605_1.random_blocks_not_updated.patch, failed testing.

jonathan1055’s picture

Title: Blocks: an enabled block of type Random will not be updated at all » Blocks: Content of a Random links block will not be refreshed when required
Issue summary: View changes

Hi Gerhard,
Sorry for confusing you, the table is {blocks} in D6 but {block} in D7.

Not sure what happened with the test. The failure in the log is:

[15:51:12] Command [cd sites/default/files/checkout && drush si -y --db-url=mysql://drupaltestbot-my:Z4VAYZL5pN6I@localhost/drupaltestbotmysql --clean-url=0 --account-name=admin --account-pass=drupal --account-mail=admin@example.com 2>&1] failed
  Duration 0 seconds
  Directory [/var/lib/drupaltestbot]
  Status [255]
 Output: [You are about to create a /var/lib/drupaltestbot/sites/default/files/checkout/sites/default/settings.php file and DROP all tables in your 'drupaltestbotmysql' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a few seconds ...                  [ok]
PHP Fatal error:  Cannot redeclare system_requirements()
(previously declared in /var/lib/drupaltestbot/sites/default/files/checkout/modules/system/system.install:11) in /var/lib/drupaltestbot/sites/default/files/checkout/sites/default/modules/rebuild/tests/fixtures/drupal_sites/dev/modules/system/system.install on line 518

This does not seem to be anything to do with your patch.

gstegemann’s picture

Hi Jonathan,

no, you didn't confuse me. I already noticed the difference in the "Block" table names and corrected the issue description accordingly.

Regarding the test: yes, that looks like testbot system problem. Are you going to reschedule the test?

jonathan1055’s picture

The testbot error has been reported #2375345: Dependency on core module results in PHP Fatal error: Cannot redeclare system_requirements(). We will wait for that to clear before re-queueing the test.

jonathan1055’s picture

Requeueing as the automated testing problem seems to be resolved now.

Status: Needs work » Needs review
jonathan1055’s picture

Status: Needs review » Reviewed & tested by the community

Tested manually and this is good and RTBC.

My random links were actually being changed if I did a page refresh in between cron runs, as I had set the interval for 2 minutes but my cron was every 10 mins. I guess something else was doing a cache_clear_all() so that all block content was cleared.

gstegemann’s picture

Thanks for testing.

I will commit the patch and prepare one for the D6 version.

Yes, that may happened that way. I also tested page refreshes and the random block content was not updated every page refresh.

gstegemann’s picture

Status: Reviewed & tested by the community » Fixed

  • GStegemann committed 2c062a7 on 7.x-1.x
    Issue #2376605 by GStegemann: Blocks: Content of a Random links block...
jonathan1055’s picture

Version: 7.x-1.x-dev » 6.x-2.x-dev
Status: Fixed » Patch (to be ported)

Good work. Yes, port to D6 now.

gstegemann’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new975 bytes

D6 patch has landed.

jonathan1055’s picture

Status: Needs review » Fixed

Patch was perfect. Tested and committed.

I also fixed one php5 warning in the same file:

Undefined index: weblinks_blocks_sort in weblinks_blocks_block_save()
 (line 865 of /sites/all/modules/weblinks/contribs/weblinks_blocks/weblinks_blocks.module)

This had already been corrected in D7, so I used the identical fix for D6.

gstegemann’s picture

Thanks. Also for applying the 'weblinks_blocks_sort' fix.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Status: Closed (fixed) » Needs work

The last submitted patch, 16: 2376605_15.random_blocks_not_updated_d6.patch, failed testing.

jonathan1055’s picture

Status: Needs work » Fixed

The issue is fixed. Patch from #16 got requeued, and obviously it fails to apply because the code change is already committed in #17.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.