Almost every day, around the time of a cron run, I see this error message appear in the Drupal logs:

The file public://mobile_codes was not deleted, because it does not exist

Initially I thought this was a "cosmetic" issue, but looking into the filesystem (sites/all/files), the "mobile_codes" directory is actually deleted, including all the PNG mobile code images. Clearly this leads to a bunch of errors in the Drupal logs when you view pages with mobile codes on them. For example:

TYPE: page not found
MESSAGE: sites/all/files/mobile_codes/some_long_alphanumeric_sequence.png
SEVERITY: warning

Of course, the QR code no longer appears on the webpage. Same applies to any blocks which have QR code in them.

Some digging around has shown similar issues:

FYI, I am running the latest recommended version of ctools (7.x-1.0) and Mobile Codes (7.x-2.0).

It would be much appreciated if anyone can shed light on this issue and resolve this problem.

Comments

RandyK’s picture

I can verify the symptom:

==> /var/log/drupal.log <==
Jun 21 07:20:28 drupaltest DRUPAL: https://test.loc|1340288421|file|127.0.0.1|https://test.loc/index.php||0||The file public://mobile_codes was not deleted, because it does not exist.

on Drual 7.14 with

drush @test pm-list | egrep "\(ctools\)|mobile_codes"
Chaos tool suite Chaos tools (ctools) Module Enabled 7.x-1.0
Other Mobile Codes (mobile_codes) Module Enabled 7.x-2.x-dev

Deciphered’s picture

Flushing the site cache will trigger your Mobile Codes to be deleted, this is intentional. They will be regenerated when they are supposed to be.

The issue here is just that the directory is not checked before it's attempted to be deleted. So I could simply wrap it with a condition.

However, I would like to get some feedback, would you want the behaviour of deleting the Mobile Codes while flushing the cache to be optional?

ryoken’s picture

Thanks for getting back to us on this issue Deciphered!

I suppose that as long as the directory is checked first, I don't mind *inactive* Mobile Codes being deleted while flushing the cache. Would it be possible to check for Mobile Codes that are currently in use on the site before they are deleted? I'm not a programmer (and can't decipher the module code - no pun intended ;), but is it possible to selectively delete the inactive Mobile Codes or does the entire directory need to be deleted?

Deciphered’s picture

There would have to be a registry of all the mobile codes, which is definitely possible, but not something I have time to implement at the moment. It would certainly be better to delete only inactive codes, but we'll have to call that a task for another day.

As for fixing the error itself, absolutely that's a must, and will do shortly. I think I'll go ahead and make the whole delete an option though, because I could see myself not wanting to have 100s of codes deleted and recreated constantly when cache is being cleared.

ryoken’s picture

A registry of mobile codes sounds like something to look forward to in a future version :) But I would be happy just to have the errors fixed. Thanks for all the great work you've done on this module - it has come in very handy.

Deciphered’s picture

Status: Active » Fixed

Fixed and committed.

Any time :)
Also, if you can, can you create a new issue for the Registry request, so that next time I have time to splurge I can take a look at it?

ryoken’s picture

Also, if you can, can you create a new issue for the Registry request, so that next time I have time to splurge I can take a look at it?

Done :)
http://drupal.org/node/1734580

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

Updated filename in log