Download & Extend

Modify node type configuration storage to use a serialized collection stored in one variable rather than long variable names

Project:Content Injector (formerly AdSense Injector)
Version:6.x-2.6-rc2
Component:Code
Category:task
Priority:critical
Assigned:hswong3i
Status:closed (fixed)

Issue Summary

I faced an error when using adsense injector with Case Tracker module.

When I try to save the settings for adsense injector, the following error occurs:

Warning: Table 'watchdog' was not locked with LOCK TABLES query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (1, 'php', '<em>Duplicate entry &amp;#039;adsense_injector_nodetype_casetracker_basic_proj&amp;#039; for key 1\nquery: INSERT INTO variable (name, value) VALUES (&amp;#039;adsense_injector_nodetype_casetracker_basic_project&amp;#039;, &amp;#039;i:0;&amp;#039;)</em>: <em>/home/xlayer/public_html/includes/database.mysql.inc</em> の <em>172</em> line', 2, '', 'http://xlayer.jp/admin/settings/adsense_injector', 'http://xlayer.jp/admin/settings/adsense_injector', '67.174.205.243', 1189514927) in /home/xlayer/public_html/includes/database.mysql.inc on line 172

The varchar length of 'name' column in 'variable' table is 48. When we use with Case Tracker module, adsense injector makes a variable name like:

adsense_injector_nodetype_casetracker_basic_project

This variable name is too long. The database allows to save adsense_injector_nodetype_casetracker_basic_proj because of the limitation of the 'name' column length, and it causes an error.

Comments

#1

Version:5.x-2.5-1» 5.x-1.x-dev
Priority:normal» critical

Raising priority. Investigating solutions.

#2

I created a patch that ensures that the error message is stored correctly in the watchdog table:
#298768: Ensure that entries are written to watchdog table

Unfortunately this doesn't solve your real problem.

#3

Workaround: alter the variable table to allow longer variable names.

Example: See issue #133106: Value for name field in variable table is too long

<?php
function captcha_install() {
 
db_query("ALTER TABLE {variable} CHANGE name name varchar(255) NOT NULL default ''");
}
?>

#4

Priority:critical» normal

#5

Title:The long name of content type will cause an error» Modify node type configuration storage to use a serialized collection stored in one variable rather than long variable names
Category:bug report» task
Priority:normal» critical
Assigned to:Anonymous» mcurry

I need to fix this in 5.x and 6.x

#6

Version:5.x-1.x-dev» 6.x-2.x-dev
Assigned to:mcurry» hswong3i
Status:active» needs review

Simply fork taxonomy_form_vocabulary() handling can totally solve this problem. According to this patch handling, all node type setup will save into single variable in array format, e.g. with only blog activated:

<?php
Array
(
    [
blog] => blog
   
[book] => 0
   
[image] => 0
   
[page] => 0
   
[story] => 0
)
?>

This patch also remove the fancy notice if no node type selected: user should understand this style as they understand what taxonomy_form_vocabulary() did. This shouldn't become usability problem :D

AttachmentSize
adsense_injector-simplify_node_type_setting-1229493742.patch 4.06 KB

#7

@hswong3i :

Looks good, go for it.

Users will have to re-establish settings, though.

#8

@inactivist: Yes, you are right. This is the only trade-off i guess :S

So I will commit it to D6 CVS and also backport for D5. After this we should have another RC release :D

#9

Version:6.x-2.x-dev» 6.x-2.6-rc2
Status:needs review» fixed

As there is no negative feedback for this issue, I will mark it as fixed :D

#10

Status:fixed» closed (fixed)

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

nobody click here