Posts tagged ‘Error’

June 3, 2011

Correcting Errors on Google Maps – Update

A few months back, I posted a blog post describing a number of errors I had found in Google Maps, Bing Maps, and Open Street Maps, and the steps I had taken to report them to the respective providers. I said that I’d post again if/when I had any news to report.

Well, today I got an email from TeleAtlas (the provider of Google Maps’ data), as follows:

Thank you for contacting Tele Atlas. Based on a review of your report, we can now confirm that the change you suggested has been made. It will go out in the next release of our map database. This report is now closed.

 

And, checking the report on the TeleAtlas website:

image

Of course, this only confirms that TeleAtlas has corrected the error. I’m not going to mark this error as “resolved” myself until the correction actually appears on Google Maps, but at least it shows that something has been done…

January 6, 2011

The file used in the {Drupal7} field may not be referenced.

After having upgraded my Drupal 7-alpha6 installation to Drupal 7.0, I started getting this error every time I tried to save any node or other entity (e.g. taxonomy term) that had an image field attached to it.

Some head-scratching and code-diving later, and I noticed that the way in which managed files were stored in the database had changed from my alpha6 code, and a new {file_usage} table had been introduced. Seeing as upgrades from alpha versions are not officially supported, I shouldn’t have been particularly surprised that my database didn’t contain this table – the appropriate system_update() had obviously not fired, but the error message could have been more helpful….

Fortunately, having identified the problem, the solution was thankfully simple.

1.) First, create the missing {file_usage} table using the following schema:

CREATE TABLE IF NOT EXISTS `file_usage` (

  `fid` int(10) unsigned NOT NULL COMMENT 'File ID.',

  `module` varchar(255) NOT NULL default '' COMMENT 'The name of the module that is using the file.',

  `type` varchar(64) NOT NULL default '' COMMENT 'The name of the object type in which the file is used.',

  `id` int(10) unsigned NOT NULL default '0' COMMENT 'The primary key of the object using the file.',

  `count` int(10) unsigned NOT NULL default '0' COMMENT 'The number of times this file is used by this object.',

  PRIMARY KEY  (`fid`,`type`,`id`,`module`),

  KEY `type_id` (`type`,`id`),

  KEY `fid_count` (`fid`,`count`),

  KEY `fid_module` (`fid`,`module`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Track where a file is used.';

2.) Then, populate the table with details of all the files that are being used anywhere in the site. For example, I had an image field defined by the field module that I used to attach images to nodes. So the data for this field was stored in the field_data_field_image table. To populate the {file_usage} table with details of the file sources of each of these images, I ran the following script:

INSERT INTO file_usage

SELECT

  field_image_fid AS fid,

  'file' AS module,

  'node' AS type,

  entity_id AS id,

  1 AS count

FROM

  field_data_field_image

I then repeated this for any other file reference or image fields throughout the site (replacing the ‘node’ type with ‘taxonomy_term’ for those images attached to taxonomy terms), and voila – the error went away and I could edit my entities with attached files again.

Tags: , ,
Follow

Get every new post delivered to your Inbox.

Join 53 other followers