Preferences Code

Author Message

Rob Clews

Monday 05 January 2004 3:47:36 am

in kernel/classes/ezpreferences.php there is the following:

$existingRes = $db->arrayQuery( "SELECT * FROM ezpreferences WHERE user_id = $userID" );

if ( count( $existingRes ) > 0 )
[...]
$query = "UPDATE ezpreferences SET value='$value' WHERE id = $prefID AND name='$name'";

Unless I'm being stupid here, my understanding of the function is as follows. If there is not setting for $name in the database then insert it, if it exists update it. So surely that select is incorrect because if you have any preferences for the current user then count($existingRes) will be > 0, although the pref you are trying to save may not exist in the db.

Ultimately, this only allows one preference to ever be set?

Rob Clews

Monday 05 January 2004 3:48:41 am

Probably wasn't clear, but shouldn't the select query be:

$existingRes = $db->arrayQuery( "SELECT * FROM ezpreferences WHERE user_id = $userID AND name='$name'" );

Paul Borgermans

Monday 05 January 2004 5:01:46 am

Rob, This was fixed a while ago, on 2003-11-27 (3.2-4 and 3.3-1 should be OK)

See also this bug report:

http://ez.no/developer/ez_publish_3/bug_reports/ezpreferences_only_one_variable_can_be_stored_in_the_database_for_each_user

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 22:30:17
Script start
Timing: Jan 18 2025 22:30:17
Module start 'layout'
Timing: Jan 18 2025 22:30:17
Module start 'content'
Timing: Jan 18 2025 22:30:18
Module end 'content'
Timing: Jan 18 2025 22:30:18
Script end

Main resources:

Total runtime0.8030 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0101 588.9297152.6094
Module start 'layout' 0.01010.0107 741.539139.4141
Module start 'content' 0.02080.7808 780.9531532.9063
Module end 'content' 0.80160.0013 1,313.859412.1875
Script end 0.8029  1,326.0469 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.4521160.0002
Check MTime0.00140.1686160.0001
Mysql Total
Database connection0.00190.232910.0019
Mysqli_queries0.752193.6642570.0132
Looping result0.00060.0700550.0000
Template Total0.737791.920.3688
Template load0.00200.243620.0010
Template processing0.735791.624720.3679
Template load and register function0.00020.027110.0002
states
state_id_array0.00120.151210.0012
state_identifier_array0.00100.130420.0005
Override
Cache load0.00160.1967190.0001
Sytem overhead
Fetch class attribute can translate value0.00060.072720.0003
Fetch class attribute name0.00090.117140.0002
XML
Image XML parsing0.00070.084220.0003
class_abstraction
Instantiating content class attribute0.00000.001040.0000
General
dbfile0.00080.1019170.0000
String conversion0.00000.001540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 11
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs