fusionregistry-commitlog Mailing List for Fusion Registry GPL
Brought to you by:
copland007
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(18) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
|
Feb
(27) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: SVN c. <fus...@li...> - 2008-02-17 21:17:25
|
Revision: 51 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=51&view=rev Author: copland007 Date: 2008-02-17 13:17:25 -0800 (Sun, 17 Feb 2008) Log Message: ----------- Remove some todo comments. Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/ratings.php Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/ratings.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/ratings.php 2008-02-17 21:12:11 UTC (rev 50) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/ratings.php 2008-02-17 21:17:25 UTC (rev 51) @@ -75,7 +75,6 @@ * This function's job is only to retrieve the data from the cache, * it should not process the returned data. * - * @todo Cache just like get_field_defs, create new get_field_defs_live for ACP * @param array $opts Optional custom SQL cmd/value pair attributes * @return array An array of an array, outer key is field_id */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-17 21:12:20
|
Revision: 50 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=50&view=rev Author: copland007 Date: 2008-02-17 13:12:11 -0800 (Sun, 17 Feb 2008) Log Message: ----------- Implemented client side rating_def cache. ACP custom fields page, change get_cf_groups to get_cf_groups_live call to ensure database data not cache. Fix item modification not saving custom field data correctly. Added ksort to both rating_def and field_def cache retrieval routines for ASC sort type. Results were not being properly sorted from cache. Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/ratings.php Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php 2008-02-17 09:56:12 UTC (rev 49) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php 2008-02-17 21:12:11 UTC (rev 50) @@ -643,7 +643,7 @@ { // Grab all the custom field definitions and groups first as they will be used by a few things below $cf_defs = $this->lib['custom_fields']->get_cf_defs_live( array( 'ORDER BY' => 'field_order ASC, field_name ASC' ) ); - $cf_groups = $this->lib['custom_fields']->get_cf_groups(); + $cf_groups = $this->lib['custom_fields']->get_cf_groups_live(); $this->ipsclass->html .= $this->ipsclass->skin_acp_global->information_box( "Fusion Registry Custom Fields Overview", "You can manage your garage custom fields from here.<br /><br /><span style='color:red'><b>PLEASE NOTE:</b> You must not configure the same order number for more than 1 custom field. Doing so will result in some of your custom fields not showing up!</span>".'<br /> ' ) . "<br >"; Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php 2008-02-17 09:56:12 UTC (rev 49) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php 2008-02-17 21:12:11 UTC (rev 50) @@ -206,9 +206,9 @@ } // Go get our Custom Field definition - $rating_data = $this->lib['rating_fields']->get_rating_defs( array( 'WHERE' => 'rating_id='.$this->ipsclass->input['r'] ) ); + $rating_data = $this->lib['rating_fields']->get_rating_defs_live( array( 'WHERE' => 'rating_id='.$this->ipsclass->input['r'] ) ); - // Since get_rating_defs() returns an array of arrays, we are removing a layer here. + // Since get_rating_defs_live() returns an array of arrays, we are removing a layer here. // The key is the rating_id which was passed in from the beginning ;) $rating = $rating_data[$this->ipsclass->input['r']]; @@ -365,7 +365,7 @@ $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Fusion Registry Rating Fields" ); // Grab all the rating definitions - $rating_defs = $this->lib['rating_fields']->get_rating_defs( array( 'ORDER BY' => 'rating_order ASC, rating_name ASC' ) ); + $rating_defs = $this->lib['rating_fields']->get_rating_defs_live( array( 'ORDER BY' => 'rating_order ASC, rating_name ASC' ) ); // Loop through our custom field definitions we got from up above foreach ( $rating_defs as $rating_id => $rating_row ) Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php 2008-02-17 09:56:12 UTC (rev 49) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php 2008-02-17 21:12:11 UTC (rev 50) @@ -394,17 +394,17 @@ unset($db_string); // Now save their custom field data - foreach ( $cf_input as $cf_num => $cf_value ) + foreach ( $cf_input as $cf_id => $cf_value ) { // Determine if we need to update or insert row - $rs = $this->ipsclass->DB->query("SELECT entry_id FROM ibf_registry_field_entries WHERE item_id = '". $this->ipsclass->input['CID'] ."' AND field_id = '". $cf_row['field_id'] ."'"); + $rs = $this->ipsclass->DB->query("SELECT entry_id FROM ibf_registry_field_entries WHERE item_id = '". $this->ipsclass->input['CID'] ."' AND field_id = '". $cf_id ."'"); $existing = $this->ipsclass->DB->fetch_row($rs); if ( isset($existing['entry_id']) and !empty($existing['entry_id']) ) { // Update existing entry - $db_string = $this->ipsclass->DB->compile_db_update_string( array( 'field_id' => $cf_row['field_id'], + $db_string = $this->ipsclass->DB->compile_db_update_string( array( 'field_id' => $cf_id, 'item_id' => $this->ipsclass->input['CID'], 'field_value' => $cf_value, ) ); @@ -414,7 +414,7 @@ else { // Insert new entry - $db_string = $this->ipsclass->DB->compile_db_insert_string( array( 'field_id' => $cf_row['field_id'], + $db_string = $this->ipsclass->DB->compile_db_insert_string( array( 'field_id' => $cf_id, 'item_id' => $this->ipsclass->input['CID'], 'field_value' => $cf_value, ) ); @@ -639,11 +639,11 @@ $ratings_def = $this->lib['ratings']->get_rating_defs(); - foreach ( $ratings_def as $rating_id => $rating_row ) + foreach ( $ratings_def as $rating_num => $rating_row ) { - if ( !empty( $this->ipsclass->input[$rating_id] ) ) + if ( !empty( $this->ipsclass->input[ $rating_row['rating_id'] ] ) ) { - $user_ratings[$rating_id] = intval( $this->ipsclass->input[$rating_id] ); + $user_ratings[ $rating_row['rating_id'] ] = intval( $this->ipsclass->input[ $rating_row['rating_id'] ] ); } } @@ -1056,7 +1056,7 @@ } // Load the ratings defs - $rating_defs = $this->lib['ratings']->get_rating_defs( array( 'ORDER BY' => 'rating_order ASC' ) ); + $rating_defs = $this->lib['ratings']->get_rating_defs( array( 'ORDER BY' => array( 'rating_order' => 'ASC' ) ) ); // They shouldn't even get to this function if there aren't rating defs if ( empty($rating_defs) ) @@ -1067,7 +1067,7 @@ // Loop through and produce our inner html $inner_html = ''; - foreach ( $rating_defs as $rating_id => $rating_row ) + foreach ( $rating_defs as $rating_num => $rating_row ) { // Create our html select field $select_html = $this->lib['ratings']->build_rating_select( array( 'rating_row' => $rating_row ) ); @@ -1656,7 +1656,7 @@ { $ratings_html = ''; - foreach ( $rating_report as $rating_id => $rating_row ) + foreach ( $rating_report as $rating_num => $rating_row ) { $ratings_html .= $this->ipsclass->compiled_templates['skin_registry_item']->view_rating_row( array( 'rating_name' => $rating_row['rating_name'], 'rating_image' => $rating_row['rating_image'], Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php 2008-02-17 09:56:12 UTC (rev 49) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php 2008-02-17 21:12:11 UTC (rev 50) @@ -179,10 +179,14 @@ $sorted[ intval($field_row[ $order_field ]) ] = $field_row; } - if ( $order_value == 'DESC' ) + if ( $order_value == 'ASC' ) { - $sorted = array_reverse($results); + ksort($sorted); } + elseif ( $order_value == 'DESC' ) + { + $sorted = array_reverse($sorted); + } } $results = $sorted; @@ -271,7 +275,7 @@ /** - * Get all the Custom Field Groups, cached if possible + * Get all the Custom Field Groups from the cache * * This function's job is only to retrieve the data from the database, * it should not process the returned data. If this data has already @@ -313,6 +317,40 @@ /** + * Get all the Custom Field Groups from the database + * + * This function's job is only to retrieve the data from the database, + * it should not process the returned data. If this data has already + * been retrieved and stored into cache it will not query the database. + * + * @return array|NULL Success returns an array of an array, outer key is field_group_id; Failure returns NULL. + */ + function get_cf_groups_live() + { + $query = 'SELECT field_id, field_name, field_type, field_options, '. + 'field_default, field_required, field_size, field_rows, '. + 'field_cols, field_order, field_browse, field_highlight, '. + 'field_group_id, field_search '. + 'FROM ibf_registry_field_defs '. + 'WHERE field_group_id IS NOT NULL '. + 'ORDER BY field_group_id ASC, field_order ASC, field_name ASC'; + + $rs = $this->ipsclass->DB->query($query); + + // Build our Custom Field Group data structure, we will be returning + // a complex structure of arrays of arrays + $this->_cf_groups = array(); + + while ( $row = $this->ipsclass->DB->fetch_row($rs) ) + { + $this->_cf_groups[$row['field_group_id']][] = $row; + } + + return $this->_cf_groups; + } + + + /** * Get the Custom Field or Group that has been chosen as the highlight item * * This function's job is only to retrieve the highlight group or item from Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/ratings.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/ratings.php 2008-02-17 09:56:12 UTC (rev 49) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/ratings.php 2008-02-17 21:12:11 UTC (rev 50) @@ -70,9 +70,9 @@ /** - * Get Rating definitions + * Get Rating definitions from cache * - * This function's job is only to retrieve the data from the database, + * This function's job is only to retrieve the data from the cache, * it should not process the returned data. * * @todo Cache just like get_field_defs, create new get_field_defs_live for ACP @@ -81,6 +81,67 @@ */ function get_rating_defs($opts=array()) { + $results = $this->ipsclass->cache['registry_rating_defs']; + + // Did we get any restrictions passed? + if ( count($opts) > 0 && is_array($this->ipsclass->cache['registry_rating_defs']) ) + { + // First handle the WHERE clause + if ( isset($opts['WHERE']) && is_array($opts['WHERE']) ) + { + foreach ( $opts['WHERE'] as $where_field => $where_value ) + { + foreach ( $results as $field_id => $field_row ) + { + if ( $field_row[ $where_field ] != $where_value ) + { + // WHERE did not match, remove from results + unset( $results[ $field_id ] ); + } + } + } + } + + // Now handle the ORDER BY clause + if ( isset($opts['ORDER BY']) && is_array($opts['ORDER BY']) ) + { + $sorted = array(); + foreach ( $opts['ORDER BY'] as $order_field => $order_value ) + { + foreach ( $results as $field_num => $field_row ) + { + $sorted[ intval($field_row[ $order_field ]) ] = $field_row; + } + + if ( $order_value == 'ASC' ) + { + ksort($sorted); + } + elseif ( $order_value == 'DESC' ) + { + $sorted = array_reverse($sorted); + } + } + + $results = $sorted; + } + } + + return $results; + } + + + /** + * Get Rating definitions live from database + * + * This function's job is only to retrieve the data from the database, + * it should not process the returned data. + * + * @param array $opts Optional custom SQL cmd/value pair attributes + * @return array An array of an array, outer key is field_id + */ + function get_rating_defs_live($opts=array()) + { $query = "SELECT rating_id,rating_name,rating_order FROM ibf_registry_rating_defs"; // Did we get any restrictions passed? @@ -207,40 +268,41 @@ $report = array(); // First get the current list of rating defs - $ratings_defs = $this->get_rating_defs( array( 'ORDER BY' => 'rating_order ASC' ) ); + $ratings_defs = $this->get_rating_defs( array( 'ORDER BY' => array( 'rating_order' => 'ASC' ) ) ); // Then get report for each of the rating defs for this item - foreach ( $ratings_defs as $rating_id => $rating_row ) + foreach ( $ratings_defs as $rating_num => $rating_row ) { // Initialize the report for this rating - $report[$rating_id] = array(); + $report[ $rating_num ] = array(); $query = "SELECT rating_count, rating_sum FROM ibf_registry_rating_reports ". - "WHERE item_id = '$item_id' AND rating_id = '$rating_id'"; + "WHERE item_id = '$item_id' AND rating_id = '".$rating_row['rating_id']."'"; $rs = $this->ipsclass->DB->query($query); // Add to report to be returned if ( $this->ipsclass->DB->get_num_rows() ) { - $report[$rating_id] = $this->ipsclass->DB->fetch_row($rs); + $report[ $rating_num ] = $this->ipsclass->DB->fetch_row($rs); } // While we are at it, let's generate the html here also. - if ( $report[$rating_id]['rating_count'] > 0 ) + if ( $report[ $rating_num ]['rating_count'] > 0 ) { // If there are votes, report real value - $report[$rating_id]['rating_image'] = $this->get_rating_image( $report[$rating_id]['rating_sum'] / $report[$rating_id]['rating_count'] ); + $report[ $rating_num ]['rating_image'] = $this->get_rating_image( $report[ $rating_num ]['rating_sum'] / $report[ $rating_num ]['rating_count'] ); } else { // If there aren't any votes report medium neutral value - $report[$rating_id]['rating_image'] = $this->get_rating_image( ($this->class->registry_config['rating_max'] + $this->class->registry_config['rating_min'])/2 ); + $report[ $rating_num ]['rating_image'] = $this->get_rating_image( ($this->class->registry_config['rating_max'] + $this->class->registry_config['rating_min'])/2 ); } // Also cram in rating info - $report[$rating_id]['rating_name'] = $rating_row['rating_name']; - $report[$rating_id]['rating_order'] = $rating_row['rating_order']; + $report[ $rating_num ]['rating_id'] = $rating_row['rating_id']; + $report[ $rating_num ]['rating_name'] = $rating_row['rating_name']; + $report[ $rating_num ]['rating_order'] = $rating_row['rating_order']; } return $report; @@ -282,14 +344,14 @@ $rating_default = round( ($this->class->registry_config['rating_min'] + $this->class->registry_config['rating_min'])/2 ); // Loop through each valid rating def and determine if they have voted before or not - foreach ( $ratings_def as $rating_id => $rating_row ) + foreach ( $ratings_def as $rating_num => $rating_row ) { // Determine rating value to be recorded - $rating_value = ( !empty( $user_ratings[$rating_id] ) ) ? $user_ratings[$rating_id] : $rating_default; + $rating_value = ( !empty( $user_ratings[ $rating_row['rating_id'] ] ) ) ? $user_ratings[ $rating_row['rating_id'] ] : $rating_default; // Have they voted for this before? $query = "SELECT entry_id,rating_value FROM ibf_registry_rating_entries ". - "WHERE item_id = '$item_id' AND rating_id = '$rating_id' AND member_id = '". $this->ipsclass->member['id'] ."'"; + "WHERE item_id = '$item_id' AND rating_id = '". $rating_row['rating_id'] ."' AND member_id = '". $this->ipsclass->member['id'] ."'"; $rs = $this->ipsclass->DB->query($query); @@ -298,7 +360,7 @@ // They have not voted for this before, add new entry $db_string = $this->ipsclass->DB->compile_db_insert_string( array( 'member_id' => $this->ipsclass->member['id'], 'item_id' => $item_id, - 'rating_id' => $rating_id, + 'rating_id' => $rating_row['rating_id'], 'rating_value' => $rating_value, 'rating_date' => $epoch_time, ) ); @@ -308,13 +370,13 @@ // Now we need to add this to the rating report. First see if a report exists, // if not create one. $rs2 = $this->ipsclass->DB->query("SELECT entry_id, rating_count, rating_sum FROM ibf_registry_rating_reports ". - "WHERE item_id = '$item_id' AND rating_id = '$rating_id'"); + "WHERE item_id = '$item_id' AND rating_id = '". $rating_row['rating_id'] ."'"); if ( !$this->ipsclass->DB->get_num_rows() ) { // No report yet, create new one $db_string = $this->ipsclass->DB->compile_db_insert_string( array( 'item_id' => $item_id, - 'rating_id' => $rating_id, + 'rating_id' => $rating_row['rating_id'], 'rating_count' => 1, 'rating_sum' => $rating_value, ) ); @@ -351,13 +413,13 @@ // we'll create a new one here just incase. This will patch a problem if it exists // but a clean up routine will need to be run to fix this items rating report. $rs2 = $this->ipsclass->DB->query("SELECT entry_id, rating_count, rating_sum FROM ibf_registry_rating_reports ". - "WHERE item_id = '$item_id' AND rating_id = '$rating_id'"); + "WHERE item_id = '$item_id' AND rating_id = '". $rating_row['rating_id'] ."'"); if ( !$this->ipsclass->DB->get_num_rows() ) { // No report yet, create new one $db_string = $this->ipsclass->DB->compile_db_insert_string( array( 'item_id' => $item_id, - 'rating_id' => $rating_id, + 'rating_id' => $rating_row['rating_id'], 'rating_count' => 1, 'rating_sum' => $rating_value, ) ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-17 09:56:08
|
Revision: 49 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=49&view=rev Author: copland007 Date: 2008-02-17 01:56:12 -0800 (Sun, 17 Feb 2008) Log Message: ----------- Remove some todo comments. Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php 2008-02-17 09:35:56 UTC (rev 48) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php 2008-02-17 09:56:12 UTC (rev 49) @@ -92,7 +92,6 @@ * Generate HTML for featured item * * @param integer $in_ipdl Pass in '1' to toggle the output template bit for the IPDL portal - * @todo Implement function and/or caching for field highlight name/value lookups in all the 'show_' functions * @todo Change param $in_ipdl to be more generic to support more portals * @return string Template bit 'featured_item', or 'tmpl_ipdl_registry_featured_item' if {@link $in_ipdl} set to 1 */ Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php 2008-02-17 09:35:56 UTC (rev 48) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php 2008-02-17 09:56:12 UTC (rev 49) @@ -142,7 +142,6 @@ * This function's job is only to retrieve the data from the cache, * it should not process the returned data. * - * @todo Finish the ORDER BY clause for cache retrieval * @param array $opts Optional custom cmd/value pair attributes * @return array An array of an array, outer key is field_id */ Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-17 09:35:56 UTC (rev 48) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-17 09:56:12 UTC (rev 49) @@ -292,7 +292,7 @@ /** * Build the 'My Items' HTML * - * @todo Implement session based cache of items and custom highlight fields + * @todo Implement session based cache of items * @return string Template 'my_items' or empty value */ function do_my_items() @@ -404,8 +404,6 @@ * Update/Rebuild main menu statistics cache * * This gets run by the the session task and on demand in the ACP tools. - * - * @todo Case study needed - is this worth caching? */ function update_stats_cache() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-17 09:35:52
|
Revision: 48 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=48&view=rev Author: copland007 Date: 2008-02-17 01:35:56 -0800 (Sun, 17 Feb 2008) Log Message: ----------- Add support for ORDER BY clause in get_cf_defs for cache retrieval sorting. Change get_cf_groups to retrieve from cache instead of database. Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php 2008-02-16 21:06:45 UTC (rev 47) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php 2008-02-17 09:35:56 UTC (rev 48) @@ -172,10 +172,21 @@ // Now handle the ORDER BY clause if ( isset($opts['ORDER BY']) && is_array($opts['ORDER BY']) ) { + $sorted = array(); foreach ( $opts['ORDER BY'] as $order_field => $order_value ) { - // TODO - loop through $results and re-sort + foreach ( $results as $field_num => $field_row ) + { + $sorted[ intval($field_row[ $order_field ]) ] = $field_row; + } + + if ( $order_value == 'DESC' ) + { + $sorted = array_reverse($results); + } } + + $results = $sorted; } } @@ -278,23 +289,20 @@ } else { - $query = 'SELECT field_id, field_name, field_type, field_options, '. - 'field_default, field_required, field_size, field_rows, '. - 'field_cols, field_order, field_browse, field_highlight, '. - 'field_group_id, field_search '. - 'FROM ibf_registry_field_defs '. - 'WHERE field_group_id IS NOT NULL '. - 'ORDER BY field_group_id ASC, field_order ASC, field_name ASC'; - - $rs = $this->ipsclass->DB->query($query); - // Build our Custom Field Group data structure, we will be returning // a complex structure of arrays of arrays $this->_cf_groups = array(); - while ( $row = $this->ipsclass->DB->fetch_row($rs) ) + $cf_defs = $this->get_cf_defs( array('ORDER BY' => array('field_order' => 'ASC') ) ); + + foreach ( $cf_defs as $field_num => $field_row ) { - $this->_cf_groups[$row['field_group_id']][] = $row; + if ( $field_row['field_group_id'] == "" ) + { + continue; + } + + $this->_cf_groups[ $field_row['field_group_id'] ][] = $field_row; } return $this->_cf_groups; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-16 21:06:41
|
Revision: 47 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=47&view=rev Author: copland007 Date: 2008-02-16 13:06:45 -0800 (Sat, 16 Feb 2008) Log Message: ----------- Add cache statement to guestbook and modification files, reduce sql query count by 1. Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/guestbook.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/modification.php Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/guestbook.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/guestbook.php 2008-02-16 21:02:37 UTC (rev 46) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/guestbook.php 2008-02-16 21:06:45 UTC (rev 47) @@ -64,6 +64,7 @@ var $nav_bar = array(); var $html = array( 'core', 'guestbook' ); var $lib = array( 'custom_fields', 'functions', 'parser' ); + var $cache = array( 'registry_field_defs' ); /**#@-*/ /** @var object Fusion Registry core */ Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/modification.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/modification.php 2008-02-16 21:02:37 UTC (rev 46) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/modification.php 2008-02-16 21:06:45 UTC (rev 47) @@ -64,7 +64,7 @@ var $nav_bar = array(); var $html = array( 'core', 'mod', 'gallery' ); var $lib = array( 'custom_fields', 'functions', 'upload', 'parser' ); - var $cache = array( 'registry_categories' ); + var $cache = array( 'registry_categories', 'registry_field_defs' ); /**#@-*/ /** @var object registry_core */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-16 21:02:32
|
Revision: 46 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=46&view=rev Author: copland007 Date: 2008-02-16 13:02:37 -0800 (Sat, 16 Feb 2008) Log Message: ----------- Add cache statement to gallery management page, reduce sql query count by 1. Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/attach.php Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/attach.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/attach.php 2008-02-16 20:58:37 UTC (rev 45) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/attach.php 2008-02-16 21:02:37 UTC (rev 46) @@ -64,6 +64,7 @@ var $nav_bar = array(); var $html = array( 'core', 'gallery' ); var $lib = array( 'upload', 'functions', 'custom_fields' ); + var $cache = array( 'registry_field_defs' ); /**#@-*/ /** @var object Fusion Registry core */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-16 20:58:32
|
Revision: 45 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=45&view=rev Author: copland007 Date: 2008-02-16 12:58:37 -0800 (Sat, 16 Feb 2008) Log Message: ----------- The first level key returned from any of the cf cache get routines is no longer the field_id, it is just a reference number. Switch all post-get logic to use sub key 'field_id' as the guaranteed field_id of what was retrieved. Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/main.php Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php 2008-02-15 00:15:56 UTC (rev 44) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php 2008-02-16 20:58:37 UTC (rev 45) @@ -692,7 +692,7 @@ $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Fusion Registry Custom Fields" ); // Loop through our custom field definitions we got from up above - foreach ( $cf_defs as $cf_id => $cf_row ) + foreach ( $cf_defs as $cf_rum => $cf_row ) { $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( '<center><a href="'.$this->ipsclass->base_url.'&act='.REGISTRY_URL.'§ion=components&menu=custom_fields&code=edit&f='.$cf_row['field_id'].'">'. $this->ad_registry_loader->imgs['edit'] .'</a></center>', '<center><a href="javascript:confirm_delete_field( '.$cf_row['field_id'].' )">'. $this->ad_registry_loader->imgs['delete'] .'</a></center>', Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php 2008-02-15 00:15:56 UTC (rev 44) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php 2008-02-16 20:58:37 UTC (rev 45) @@ -333,18 +333,18 @@ $cf_required = array(); - foreach ( $cf_defs as $cf_id => $cf_row ) + foreach ( $cf_defs as $cf_num => $cf_row ) { if ( $cf_row['field_required'] == 1 ) { - $cf_required[$cf_id] = $cf_row; + $cf_required[ $cf_row['field_id'] ] = $cf_row; } } // Compile list of missing fields (if any) $missing_fields = ''; - foreach ( $cf_required as $cf_id => $cf_row ) + foreach ( $cf_required as $cf_num => $cf_row ) { // We have to special case the make/model since they don't use the field_id as the field name if ( $cf_row['field_options'] == 'make' or $cf_row['field_options'] == 'model' ) @@ -356,7 +356,7 @@ } else { - if ( !isset($this->ipsclass->input[$cf_id]) or empty($this->ipsclass->input[$cf_id]) ) + if ( !isset($this->ipsclass->input[ $cf_row['field_id'] ]) or empty($this->ipsclass->input[ $cf_row['field_id'] ]) ) { $missing_fields .= $cf_row['field_name'] . ', '; } @@ -394,17 +394,17 @@ unset($db_string); // Now save their custom field data - foreach ( $cf_input as $cf_id => $cf_value ) + foreach ( $cf_input as $cf_num => $cf_value ) { // Determine if we need to update or insert row - $rs = $this->ipsclass->DB->query("SELECT entry_id FROM ibf_registry_field_entries WHERE item_id = '". $this->ipsclass->input['CID'] ."' AND field_id = '$cf_id'"); + $rs = $this->ipsclass->DB->query("SELECT entry_id FROM ibf_registry_field_entries WHERE item_id = '". $this->ipsclass->input['CID'] ."' AND field_id = '". $cf_row['field_id'] ."'"); $existing = $this->ipsclass->DB->fetch_row($rs); if ( isset($existing['entry_id']) and !empty($existing['entry_id']) ) { // Update existing entry - $db_string = $this->ipsclass->DB->compile_db_update_string( array( 'field_id' => $cf_id, + $db_string = $this->ipsclass->DB->compile_db_update_string( array( 'field_id' => $cf_row['field_id'], 'item_id' => $this->ipsclass->input['CID'], 'field_value' => $cf_value, ) ); @@ -414,7 +414,7 @@ else { // Insert new entry - $db_string = $this->ipsclass->DB->compile_db_insert_string( array( 'field_id' => $cf_id, + $db_string = $this->ipsclass->DB->compile_db_insert_string( array( 'field_id' => $cf_row['field_id'], 'item_id' => $this->ipsclass->input['CID'], 'field_value' => $cf_value, ) ); @@ -473,18 +473,18 @@ $cf_required = array(); - foreach ( $cf_defs as $cf_id => $cf_row ) + foreach ( $cf_defs as $cf_num => $cf_row ) { if ( $cf_row['field_required'] == 1 ) { - $cf_required[$cf_id] = $cf_row; + $cf_required[ $cf_row['field_id'] ] = $cf_row; } } // Compile list of missing fields (if any) $missing_fields = ''; - foreach ( $cf_required as $cf_id => $cf_row ) + foreach ( $cf_required as $cf_num => $cf_row ) { // We have to special case the make/model since they don't use the field_id as the field name if ( $cf_row['field_options'] == 'make' or $cf_row['field_options'] == 'model' ) @@ -496,7 +496,7 @@ } else { - if ( !isset($this->ipsclass->input[$cf_id]) or empty($this->ipsclass->input[$cf_id]) ) + if ( !isset($this->ipsclass->input[ $cf_row['field_id'] ]) or empty($this->ipsclass->input[ $cf_row['field_id'] ]) ) { $missing_fields .= $cf_row['field_name'] . ', '; } @@ -545,9 +545,9 @@ $cid = $this->ipsclass->DB->get_insert_id(); // Now save their custom field data - foreach ( $cf_input as $cf_id => $cf_value ) + foreach ( $cf_input as $cf_num => $cf_value ) { - $db_string = $this->ipsclass->DB->compile_db_insert_string( array( 'field_id' => $cf_id, + $db_string = $this->ipsclass->DB->compile_db_insert_string( array( 'field_id' => $cf_row['field_id'], 'item_id' => $cid, 'field_value' => $cf_value, ) ); Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php 2008-02-15 00:15:56 UTC (rev 44) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php 2008-02-16 20:58:37 UTC (rev 45) @@ -132,7 +132,12 @@ $cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight(); // Create our sql id list, this will be used when retrieving the custom field entries. - $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'"; + $cf_ids = "'"; + foreach ( $cf_highlight as $cf_num => $cf_row ) + { + $cf_ids .= $cf_row['field_id']. "','"; + } + $cf_ids = substr($cf_ids, 0, -2); // Grab the vehicle info and prep the HTML $this->ipsclass->DB->query("SELECT g.id, g.image_id, g.member_id, images.attach_id, images.attach_hits, @@ -256,9 +261,9 @@ // Process the highlight field values $vehicle_data['highlight_fields'] = ''; - foreach ( $cf_highlight as $cf_id => $cf_row ) + foreach ( $cf_highlight as $cf_num => $cf_row ) { - $vehicle_data['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) ); + $vehicle_data['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) ); $vehicle_data['highlight_fields'] .= ' '; } @@ -293,7 +298,12 @@ $cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight(); // Create our sql id list, this will be used when retrieving the custom field entries. - $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'"; + $cf_ids = "'"; + foreach ( $cf_highlight as $cf_num => $cf_row ) + { + $cf_ids .= $cf_row['field_id']. "','"; + } + $cf_ids = substr($cf_ids, 0, -2); // What's the count? Default to 10 $limit = $this->class->registry_config['tmpl_lastcommented_limit'] ? $this->class->registry_config['tmpl_lastcommented_limit'] : 10; @@ -314,9 +324,9 @@ // Process the highlight field values $row['highlight_fields'] = ''; - foreach ( $cf_highlight as $cf_id => $cf_row ) + foreach ( $cf_highlight as $cf_num => $cf_row ) { - $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) ); + $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) ); $row['highlight_fields'] .= ' '; } @@ -358,7 +368,12 @@ $cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight(); // Create our sql id list, this will be used when retrieving the custom field entries. - $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'"; + $cf_ids = "'"; + foreach ( $cf_highlight as $cf_num => $cf_row ) + { + $cf_ids .= $cf_row['field_id']. "','"; + } + $cf_ids = substr($cf_ids, 0, -2); // What's the count? Default to 10 $limit = $this->class->registry_config['tmpl_lastupdateditems_limit'] ? $this->class->registry_config['tmpl_lastupdateditems_limit'] : 10; @@ -378,9 +393,9 @@ // Process the highlight field values $row['highlight_fields'] = ''; - foreach ( $cf_highlight as $cf_id => $cf_row ) + foreach ( $cf_highlight as $cf_num => $cf_row ) { - $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) ); + $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) ); $row['highlight_fields'] .= ' '; } @@ -459,7 +474,12 @@ $cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight(); // Create our sql id list, this will be used when retrieving the custom field entries. - $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'"; + $cf_ids = "'"; + foreach ( $cf_highlight as $cf_num => $cf_row ) + { + $cf_ids .= $cf_row['field_id']. "','"; + } + $cf_ids = substr($cf_ids, 0, -2); // What's the count? Default to 10 $limit = $this->class->registry_config['tmpl_mostmodded_limit'] ? $this->class->registry_config['tmpl_mostmodded_limit'] : 10; @@ -481,9 +501,9 @@ // Process the highlight field values $row['highlight_fields'] = ''; - foreach ( $cf_highlight as $cf_id => $cf_row ) + foreach ( $cf_highlight as $cf_num => $cf_row ) { - $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) ); + $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) ); $row['highlight_fields'] .= ' '; } @@ -520,7 +540,12 @@ $cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight(); // Create our sql id list, this will be used when retrieving the custom field entries. - $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'"; + $cf_ids = "'"; + foreach ( $cf_highlight as $cf_num => $cf_row ) + { + $cf_ids .= $cf_row['field_id']. "','"; + } + $cf_ids = substr($cf_ids, 0, -2); // What's the count? Default to 10 $limit = $this->class->registry_config['tmpl_mostmoneyspent_limit'] ? $this->class->registry_config['tmpl_mostmoneyspent_limit'] : 10; @@ -542,9 +567,9 @@ // Process the highlight field values $row['highlight_fields'] = ''; - foreach ( $cf_highlight as $cf_id => $cf_row ) + foreach ( $cf_highlight as $cf_num => $cf_row ) { - $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) ); + $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) ); $row['highlight_fields'] .= ' '; } @@ -583,7 +608,12 @@ $cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight(); // Create our sql id list, this will be used when retrieving the custom field entries. - $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'"; + $cf_ids = "'"; + foreach ( $cf_highlight as $cf_num => $cf_row ) + { + $cf_ids .= $cf_row['field_id']. "','"; + } + $cf_ids = substr($cf_ids, 0, -2); // What's the count? Default to 10 $limit = $this->class->registry_config['tmpl_mostviewed_limit'] ? $this->class->registry_config['tmpl_mostviewed_limit'] : 10; @@ -603,9 +633,9 @@ // Process the highlight field values $row['highlight_fields'] = ''; - foreach ( $cf_highlight as $cf_id => $cf_row ) + foreach ( $cf_highlight as $cf_num => $cf_row ) { - $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) ); + $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) ); $row['highlight_fields'] .= ' '; } @@ -641,7 +671,12 @@ $cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight(); // Create our sql id list, this will be used when retrieving the custom field entries. - $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'"; + $cf_ids = "'"; + foreach ( $cf_highlight as $cf_num => $cf_row ) + { + $cf_ids .= $cf_row['field_id']. "','"; + } + $cf_ids = substr($cf_ids, 0, -2); // What's the count? Default to 10 $limit = $this->class->registry_config['tmpl_newestitems_limit'] ? $this->class->registry_config['tmpl_newestitems_limit'] : 10; @@ -661,9 +696,9 @@ // Process the highlight field values $row['highlight_fields'] = ''; - foreach ( $cf_highlight as $cf_id => $cf_row ) + foreach ( $cf_highlight as $cf_num => $cf_row ) { - $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) ); + $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) ); $row['highlight_fields'] .= ' '; } Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php 2008-02-15 00:15:56 UTC (rev 44) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php 2008-02-16 20:58:37 UTC (rev 45) @@ -146,7 +146,7 @@ * @param array $opts Optional custom cmd/value pair attributes * @return array An array of an array, outer key is field_id */ - function get_cf_defs($opts=array(), $live=0) + function get_cf_defs($opts=array()) { $results = $this->ipsclass->cache['registry_field_defs']; @@ -192,7 +192,7 @@ * @param array $opts Optional custom SQL cmd/value pair attributes * @return array An array of an array, outer key is field_id */ - function get_cf_defs_live($opts=array(), $live=0) + function get_cf_defs_live($opts=array()) { $query = "SELECT field_id, field_name, field_type, field_options, field_default, field_required, field_size, field_rows, @@ -328,7 +328,7 @@ if ( is_array($this->ipsclass->cache['registry_field_defs']) ) { - foreach ($this->ipsclass->cache['registry_field_defs'] as $field_id => $field_row) + foreach ($this->ipsclass->cache['registry_field_defs'] as $field_num => $field_row) { if ( $field_row['field_highlight'] == 1 ) { @@ -344,7 +344,7 @@ if ( count($this->_cf_highlight) < 1 ) { $field_id = end(array_slice(array_keys($this->ipsclass->cache['registry_field_defs']), 0, 1)); - $this->_cf_highlight[$field_id] = $this->ipsclass->cache['registry_field_defs'][$field_id]; + $this->_cf_highlight[ $field_row['field_id'] ] = $this->ipsclass->cache['registry_field_defs'][ $field_row['field_id'] ]; } return $this->_cf_highlight; @@ -728,7 +728,7 @@ if ( is_array($opts['cf_defs']) ) { - foreach ( $opts['cf_defs'] as $cf_id => $cf_row ) + foreach ( $opts['cf_defs'] as $cf_num => $cf_row ) { if ( $cf_row['field_type'] == 'S' ) { @@ -953,16 +953,16 @@ return $cf_input; } - foreach ( $cf_defs as $cf_id => $cf_row ) + foreach ( $cf_defs as $cf_rum => $cf_row ) { // This 'if' will fail for make & model, we need to special // case them afterwards! - if ( !empty( $this->ipsclass->input[$cf_id] ) ) + if ( !empty( $this->ipsclass->input[ $cf_row['field_id'] ] ) ) { if ( preg_match('/^(T|M)$/', $cf_row['field_type']) ) { // Single line text, or Textarea - $cf_input[$cf_id] = $this->class->lib['parser']->pre_db_parse( $this->ipsclass->input[$cf_id] ); + $cf_input[ $cf_row['field_id'] ] = $this->class->lib['parser']->pre_db_parse( $this->ipsclass->input[ $cf_row['field_id'] ] ); } elseif ( preg_match('/^(R|L)$/', $cf_row['field_type']) ) { @@ -970,16 +970,16 @@ $valid_options = $this->explode_assoc('|', $cf_row['field_options']); // Only configured values are valid! - $cf_input[$cf_id] = ( in_array( $this->ipsclass->input[$cf_id], array_keys($valid_options) ) ) - ? htmlspecialchars( $this->ipsclass->input[$cf_id] ) - : ''; + $cf_input[ $cf_row['field_id'] ] = ( in_array( $this->ipsclass->input[ $cf_row['field_id'] ], array_keys($valid_options) ) ) + ? htmlspecialchars( $this->ipsclass->input[ $cf_row['field_id'] ] ) + : ''; } elseif ( $cf_row['field_type'] == 'F' ) { // Money (floating point), make sure comma and dollar signs don't cause problems - $this->ipsclass->input[$cf_id] = preg_replace('/(\,|$)/', '', $this->ipsclass->input[$cf_id]); + $this->ipsclass->input[ $cf_row['field_id'] ] = preg_replace('/(\,|$)/', '', $this->ipsclass->input[ $cf_row['field_id'] ]); - $cf_input[$cf_id] = floatval( $this->ipsclass->input[$cf_id] ); + $cf_input[ $cf_row['field_id'] ] = floatval( $this->ipsclass->input[ $cf_row['field_id'] ] ); } elseif ( $cf_row['field_type'] == 'C' ) { @@ -989,7 +989,7 @@ // We need to loop through and only allow valid options through $options = array(); - foreach ( $this->ipsclass->input[$cf_id] as $cf_value ) + foreach ( $this->ipsclass->input[ $cf_row['field_id'] ] as $cf_value ) { $cf_value = htmlspecialchars( $cf_value ); @@ -1001,7 +1001,7 @@ } // We are returning a serialized data structure to store to the DB - $cf_input[$cf_id] = serialize($options); + $cf_input[ $cf_row['field_id'] ] = serialize($options); } elseif ( $cf_row['field_type'] == 'S' ) { @@ -1010,9 +1010,9 @@ if ( $cf_row['field_options'] == 'year' ) { // Validate year format - if ( preg_match('/^\d{4}$/', $this->ipsclass->input[$cf_id]) ) + if ( preg_match('/^\d{4}$/', $this->ipsclass->input[ $cf_row['field_id'] ]) ) { - $cf_input[$cf_id] = htmlspecialchars( $this->ipsclass->input[$cf_id] ); + $cf_input[ $cf_row['field_id'] ] = htmlspecialchars( $this->ipsclass->input[ $cf_row['field_id'] ] ); } } } @@ -1024,7 +1024,7 @@ if ( !empty( $this->ipsclass->input[$cf_row['field_options']] ) ) { // Type cast integer - $cf_input[$cf_id] = intval( $this->ipsclass->input[$cf_row['field_options']] ); + $cf_input[ $cf_row['field_id'] ] = intval( $this->ipsclass->input[$cf_row['field_options']] ); } } elseif ( $cf_row['field_type'] == 'C' ) @@ -1032,7 +1032,7 @@ // This elseif will catch any defined checkbox fields which did not // have any selected values. In this case the field is not returned // in the query string by the browser. - $cf_input[$cf_id] = ''; + $cf_input[ $cf_row['field_id'] ] = ''; } } Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-15 00:15:56 UTC (rev 44) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-16 20:58:37 UTC (rev 45) @@ -249,7 +249,12 @@ $cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight(); // Create our sql id list, this will be used when retrieving the custom field entries. - $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'"; + $cf_ids = "'"; + foreach ( $cf_highlight as $cf_num => $cf_row ) + { + $cf_ids .= $cf_row['field_id']. "','"; + } + $cf_ids = substr($cf_ids, 0, -2); // Get data $query = $this->ipsclass->DB->query( "SELECT g.id, g.member_id, g.date_updated, m.members_display_name @@ -266,9 +271,9 @@ // Process the highlight field values $row['highlight_fields'] = ''; - foreach ( $cf_highlight as $cf_id => $cf_row ) + foreach ( $cf_highlight as $cf_num => $cf_row ) { - $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) ); + $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) ); $row['highlight_fields'] .= ' '; } @@ -296,7 +301,12 @@ $cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight(); // Create our sql id list, this will be used when retrieving the custom field entries. - $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'"; + $cf_ids = "'"; + foreach ( $cf_highlight as $cf_num => $cf_row ) + { + $cf_ids .= $cf_row['field_id']. "','"; + } + $cf_ids = substr($cf_ids, 0, -2); $show_add = 0; @@ -325,9 +335,9 @@ // Process the highlight field values $row['highlight_fields'] = ''; - foreach ( $cf_highlight as $cf_id => $cf_row ) + foreach ( $cf_highlight as $cf_num => $cf_row ) { - $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) ); + $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) ); $row['highlight_fields'] .= ' '; } Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/main.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/main.php 2008-02-15 00:15:56 UTC (rev 44) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/main.php 2008-02-16 20:58:37 UTC (rev 45) @@ -290,9 +290,13 @@ if ( is_array($cf_defs) ) { // Create our sql id list, this will be used when retrieving the custom field entries - $cf_ids = "'". implode( "','", array_keys($cf_defs) ) . "'"; + $cf_ids = "'"; + foreach ( $cf_defs as $cf_num => $cf_row ) + { + $cf_ids .= $cf_row['field_id'] ."','"; + } + $cf_ids = substr($cf_ids, 0, -2); - // Build our <th>'s for the custom fields $data['custom_field_th'] = ''; @@ -303,7 +307,7 @@ $cf_width .= '%'; // Loop through each one and add the <th> html to the output - foreach ( $cf_defs as $cf_id => $cf_row ) + foreach ( $cf_defs as $cf_num => $cf_row ) { $cf_data['field_name'] = $cf_row['field_name']; $cf_data['field_width'] = $cf_width; @@ -340,7 +344,7 @@ // Build our <td>'s for the custom fields $row['custom_fields'] = ''; - foreach ( $cf_defs as $cf_id => $cf_row ) + foreach ( $cf_defs as $cf_num => $cf_row ) { // Which css class should we be? This isn't perfect, but will have to do. $cf_data['field_class'] = $total_cars_printed % 2 ? 'row2' : 'row1'; @@ -348,7 +352,7 @@ $cf_data['item_id'] = $row['id']; $cf_data['field_value'] = $this->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, - 'value' => $cf_entries[$cf_id]['field_value'], + 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view', ) ); @@ -516,17 +520,17 @@ $where_sql = ' WHERE '; - foreach ( $cf_defs as $cf_id => $cf_row ) + foreach ( $cf_defs as $cf_num => $cf_row ) { // Did they enter a keyword for this field, and did they choose this field? - if ( !empty($cf_input[$cf_id]) AND $this->ipsclass->input['search_' . $cf_id] == 1 ) + if ( !empty($cf_input[ $cf_row['field_id'] ]) AND $this->ipsclass->input['search_' . $cf_row['field_id']] == 1 ) { - $where_sql .= " ( field_id = '$cf_id' AND field_value LIKE '%$cf_input[$cf_id]%' ) OR "; + $where_sql .= " ( field_id = '". $cf_row['field_id'] ."' AND field_value LIKE '%". $cf_input[ $cf_row['field_id'] ] ."%' ) OR "; // This will be used later in our 'AND' logic if ( $this->ipsclass->input['search_logic'] == 'AND' ) { - array_push( $searched_fields, $cf_id ); + array_push( $searched_fields, $cf_row['field_id'] ); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-15 00:15:55
|
Revision: 44 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=44&view=rev Author: copland007 Date: 2008-02-14 16:15:56 -0800 (Thu, 14 Feb 2008) Log Message: ----------- Explain the registrysessions.php task setup in the INSTALL a little more detailed Modified Paths: -------------- branches/stable_3_0_x/INSTALL.txt Modified: branches/stable_3_0_x/INSTALL.txt =================================================================== --- branches/stable_3_0_x/INSTALL.txt 2008-02-14 09:01:47 UTC (rev 43) +++ branches/stable_3_0_x/INSTALL.txt 2008-02-15 00:15:56 UTC (rev 44) @@ -131,13 +131,21 @@ ============================================================================ -Step 5: Configuring periodic tasks +Step 5: Configure periodic task ============================================================================ -Although this step is not required it is highly recommended to keep your -ibf_registry_sessions table nice and tidy. Head into your Task Manager and -click 'Add New Task' near the bottom. Enter the following values: +The peiodic task serves two purposes, to clean up old registry_sessions entries +in your database, and to recalculate the statistics shown on the main menu +of the Registry. +You can set any value you wish for the scheduling of this task, the longer +the delay the smaller the impact on CPU load, but the greater the delay will +be for statistics being updated. The recommended settings below are for +running the task once every hour. + +Head into your Task Manager and click 'Add New Task' near the bottom. +Enter the following values: + - Task Title: "Fusion Registry Periodic Tasks" - Task Short Description: "Remove old Fusion Registry sessions, recalculate main menu stats" - Task PHP File To Run: "registrysessions.php" @@ -180,4 +188,4 @@ Please note that many features are disabled by default, you will need to enable them in your AdminCP. All editable text is available in the language -section of your AdminCP under the filename lang_registry.php. \ No newline at end of file +section of your AdminCP under the filename lang_registry.php. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-14 09:01:43
|
Revision: 43 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=43&view=rev Author: copland007 Date: 2008-02-14 01:01:47 -0800 (Thu, 14 Feb 2008) Log Message: ----------- Lots of cache updates, work in progress. Lots of sql query count drops on every registry page. Implemented client side cache support for get_cf_defs and get_cf_highlight in custom_fields.php and item.php. ad_custom_fields and ad_makes_models change to '_live' function calls to ensure live data, not cached in ACP. Added rating_id to rating_defs cache. Added registry_stats cache item and implemented on main menu screen. Main menu statistics no longer live, they are cached, and recalculated when the registrysessions.php task item is run. Task updated to rebuild main menu stats. Added update_stats_cache routine. Prevent duplicate sql query in show_featureditem. Changed some leftover references from 'cars' to 'items'. Updated INSTALL.txt registrysessions.php task config information. Modified Paths: -------------- branches/stable_3_0_x/INSTALL.txt branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_makes_models.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/ratings.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/main.php branches/stable_3_0_x/upload/sources/tasks/registrysessions.php Modified: branches/stable_3_0_x/INSTALL.txt =================================================================== --- branches/stable_3_0_x/INSTALL.txt 2008-02-13 19:06:25 UTC (rev 42) +++ branches/stable_3_0_x/INSTALL.txt 2008-02-14 09:01:47 UTC (rev 43) @@ -131,18 +131,18 @@ ============================================================================ -Step 5: Configuring session cleanup task +Step 5: Configuring periodic tasks ============================================================================ Although this step is not required it is highly recommended to keep your ibf_registry_sessions table nice and tidy. Head into your Task Manager and click 'Add New Task' near the bottom. Enter the following values: -- Task Title: "Fusion Registry Session Cleanup" -- Task Short Description: "Remove old Fusion Registry sessions" +- Task Title: "Fusion Registry Periodic Tasks" +- Task Short Description: "Remove old Fusion Registry sessions, recalculate main menu stats" - Task PHP File To Run: "registrysessions.php" - Time Options... - - Task Time: Minutes: "0" + - Task Time: Minutes: "59" - Task Time: Hours: "Every Hour" - Task Time: Week Day: "Every Week Day" - Task Time: Month Day: "Every Day of the Month" Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php 2008-02-13 19:06:25 UTC (rev 42) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php 2008-02-14 09:01:47 UTC (rev 43) @@ -249,9 +249,9 @@ } // Go get our Custom Field definition - $cf_data = $this->lib['custom_fields']->get_cf_defs( array( 'WHERE' => 'field_id='.$this->ipsclass->input['f'] ) ); + $cf_data = $this->lib['custom_fields']->get_cf_defs_live( array( 'WHERE' => 'field_id='.$this->ipsclass->input['f'] ) ); - // Since get_cf_defs() returns an array of arrays, we are removing a layer here. + // Since get_cf_defs_live() returns an array of arrays, we are removing a layer here. // The key is the field_id which was passed in from the beginning ;) $field = $cf_data[$this->ipsclass->input['f']]; @@ -642,10 +642,10 @@ function show_fields() { // Grab all the custom field definitions and groups first as they will be used by a few things below - $cf_defs = $this->lib['custom_fields']->get_cf_defs( array( 'ORDER BY' => 'field_order ASC, field_name ASC' ) ); + $cf_defs = $this->lib['custom_fields']->get_cf_defs_live( array( 'ORDER BY' => 'field_order ASC, field_name ASC' ) ); $cf_groups = $this->lib['custom_fields']->get_cf_groups(); - $this->ipsclass->html .= $this->ipsclass->skin_acp_global->information_box( "Fusion Registry Custom Fields Overview", "You can manage your garage custom fields from here.<br /><br /><span style='color:red'><b>PLEASE NOTE:</b> You must not configure the same order number for more than 1 custom field. Doing so will result in some of your custom fields from not showing up!</span>".'<br /> ' ) . "<br >"; + $this->ipsclass->html .= $this->ipsclass->skin_acp_global->information_box( "Fusion Registry Custom Fields Overview", "You can manage your garage custom fields from here.<br /><br /><span style='color:red'><b>PLEASE NOTE:</b> You must not configure the same order number for more than 1 custom field. Doing so will result in some of your custom fields not showing up!</span>".'<br /> ' ) . "<br >"; // Get the processed list of all custom fields and groups $cf_processed = $this->lib['custom_fields']->process_cf_defs( array( 'cf_defs' => $cf_defs, 'cf_groups' => $cf_groups, 'type' => 'acp_highlight' ) ); @@ -826,7 +826,8 @@ // Loop through each setting while ( $row = $this->ipsclass->DB->fetch_row() ) { - $this->ipsclass->cache['registry_field_defs'][ $row['field_id'] ] = array( 'field_name' => $row['field_name'], + $this->ipsclass->cache['registry_field_defs'][ $row['field_id'] ] = array( 'field_id' => $row['field_id'], + 'field_name' => $row['field_name'], 'field_type' => $row['field_type'], 'field_options' => $row['field_options'], 'field_default' => $row['field_default'], Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_makes_models.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_makes_models.php 2008-02-13 19:06:25 UTC (rev 42) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_makes_models.php 2008-02-14 09:01:47 UTC (rev 43) @@ -717,7 +717,7 @@ $make_to_delete = substr($make_to_delete, 0, -2); // Get our custom field def for the make field - $cf_def = $this->lib['custom_fields']->get_cf_defs( array('WHERE' => "field_options='make'") ); + $cf_def = $this->lib['custom_fields']->get_cf_defs_live( array('WHERE' => "field_options='make'") ); // It will/should be are first and only returned value! $make_def = array_shift($cf_def); @@ -890,7 +890,7 @@ $model_to_delete = substr($model_to_delete, 0, -2); // Get our custom field def for the model field - $cf_def = $this->lib['custom_fields']->get_cf_defs( array('WHERE' => "field_options='model'") ); + $cf_def = $this->lib['custom_fields']->get_cf_defs_live( array('WHERE' => "field_options='model'") ); // It will/should be are first and only returned value! $model_def = array_shift($cf_def); Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php 2008-02-13 19:06:25 UTC (rev 42) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php 2008-02-14 09:01:47 UTC (rev 43) @@ -440,7 +440,8 @@ // Loop through each setting while ( $row = $this->ipsclass->DB->fetch_row() ) { - $this->ipsclass->cache['registry_rating_defs'][ $row['rating_id'] ] = array( 'rating_name' => $row['rating_name'], + $this->ipsclass->cache['registry_rating_defs'][ $row['rating_id'] ] = array( 'rating_id' => $row['rating_id'], + 'rating_name' => $row['rating_name'], 'rating_order' => $row['rating_order'], ); } Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php 2008-02-13 19:06:25 UTC (rev 42) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php 2008-02-14 09:01:47 UTC (rev 43) @@ -102,6 +102,7 @@ 'registry_field_defs' => 'Custom field definitions', 'registry_rating_defs' => 'Custom rating definitions', 'registry_categories' => 'Modification categories', + 'registry_stats' => 'Main menu statistics', ); switch($this->ipsclass->input['code']) @@ -490,6 +491,15 @@ $this->ipsclass->main_msg = 'Registry modification category cache updated'; break; + case 'registry_stats': + require_once( REGISTRY_PATH.'/lib/functions.php' ); + $this->fr_cache = new registry_functions(); + $this->fr_cache->ipsclass =& $this->ipsclass; + + $this->fr_cache->update_stats_cache(); + $this->ipsclass->main_msg = 'Registry main menu statistics cache updated'; + break; + default: $this->ipsclass->main_msg = 'No valid cache was specified to update'; break; Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php 2008-02-13 19:06:25 UTC (rev 42) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php 2008-02-14 09:01:47 UTC (rev 43) @@ -451,11 +451,11 @@ $this->ipsclass->Error( array( LEVEL => 1, MSG => 'no_permission') ); } - // Make sure they haven't exceeded the max vehicle limit - $this->ipsclass->DB->query("SELECT count(*) AS total_cars FROM ibf_registry_items WHERE member_id = '". $this->ipsclass->member['id'] ."'"); + // Make sure they haven't exceeded the max item limit + $this->ipsclass->DB->query("SELECT count(*) AS total_items FROM ibf_registry_items WHERE member_id = '". $this->ipsclass->member['id'] ."'"); $row = $this->ipsclass->DB->fetch_row(); - if ($row['total_cars'] >= $this->registry_config['max_user_cars']) + if ($row['total_items'] >= $this->registry_config['max_user_cars']) { // Sorry, too many vehicles :) $data = array( message => $this->ipsclass->lang['exceeded_car_limit'], @@ -972,11 +972,11 @@ $this->ipsclass->Error( array( LEVEL => 1, MSG => 'no_permission') ); } - // Make sure they haven't exceeded the max vehicle limit - $this->ipsclass->DB->query("SELECT count(*) AS total_cars FROM ibf_registry_items WHERE member_id = '". $this->ipsclass->member['id'] ."'"); + // Make sure they haven't exceeded the max item limit + $this->ipsclass->DB->query("SELECT count(*) AS total_items FROM ibf_registry_items WHERE member_id = '". $this->ipsclass->member['id'] ."'"); $row = $this->ipsclass->DB->fetch_row(); - if ($row['total_cars'] >= $this->registry_config['max_user_cars']) + if ($row['total_items'] >= $this->registry_config['max_user_cars']) { // Sorry, too many vehicles :) $data = array( message => $this->ipsclass->lang['exceeded_car_limit'], Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php 2008-02-13 19:06:25 UTC (rev 42) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php 2008-02-14 09:01:47 UTC (rev 43) @@ -30,6 +30,7 @@ /** * Functions for the main menu HTML of the Fusion Registry * + * @todo Cache all statistics * @package Fusion Registry * @subpackage lib * @version $Id$ @@ -97,6 +98,8 @@ */ function show_featureditem($in_ipdl='0') { + $exists = 0; + // If we are using random, go fetch! if ( $this->class->registry_config['featured_item_random'] == 1 ) { @@ -110,12 +113,20 @@ $vehicle_data = $this->ipsclass->DB->fetch_row(); $this->class->registry_config['featured_item_id'] = $vehicle_data['id']; + + $exists = 1; } + else + { + // Make sure the configured item id exists + $this->ipsclass->DB->query("SELECT id FROM ibf_registry_items WHERE id='". $this->class->registry_config['featured_item_id'] ."'"); + if ( $this->ipsclass->DB->get_num_rows() > 0 ) + { + $exists = 1; + } + } - // Make sure the vehicle exists - $this->ipsclass->DB->query("SELECT id FROM ibf_registry_items WHERE id='". $this->class->registry_config['featured_item_id'] ."'"); - - if ( $this->ipsclass->DB->get_num_rows() > 0 ) + if ( $exists ) { // Get our fields that are going to be displayed $cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight(); Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php 2008-02-13 19:06:25 UTC (rev 42) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php 2008-02-14 09:01:47 UTC (rev 43) @@ -82,6 +82,12 @@ { $this->class = &$class; + // Load the cache if needed, don't load if we're in the ACP + if ( !is_array( $this->ipsclass->cache['registry_field_defs'] ) && IPB_THIS_SCRIPT != 'admin' ) + { + $this->ipsclass->init_load_cache( array( 'registry_field_defs' ) ); + } + // Initialize post_parser if it hasn't already if ( !is_object( $this->class->lib['parser']) ) { @@ -131,15 +137,62 @@ /** - * Get Custom Field definitions + * Get Custom Field definitions from cache * + * This function's job is only to retrieve the data from the cache, + * it should not process the returned data. + * + * @todo Finish the ORDER BY clause for cache retrieval + * @param array $opts Optional custom cmd/value pair attributes + * @return array An array of an array, outer key is field_id + */ + function get_cf_defs($opts=array(), $live=0) + { + $results = $this->ipsclass->cache['registry_field_defs']; + + // Did we get any restrictions passed? + if ( count($opts) > 0 && is_array($this->ipsclass->cache['registry_field_defs']) ) + { + // First handle the WHERE clause + if ( isset($opts['WHERE']) && is_array($opts['WHERE']) ) + { + foreach ( $opts['WHERE'] as $where_field => $where_value ) + { + foreach ( $results as $field_id => $field_row ) + { + if ( $field_row[ $where_field ] != $where_value ) + { + // WHERE did not match, remove from results + unset( $results[ $field_id ] ); + } + } + } + } + + // Now handle the ORDER BY clause + if ( isset($opts['ORDER BY']) && is_array($opts['ORDER BY']) ) + { + foreach ( $opts['ORDER BY'] as $order_field => $order_value ) + { + // TODO - loop through $results and re-sort + } + } + } + + return $results; + } + + + /** + * Get Custom Field definitions from live DB (only ACP calls) + * * This function's job is only to retrieve the data from the database, * it should not process the returned data. * * @param array $opts Optional custom SQL cmd/value pair attributes * @return array An array of an array, outer key is field_id */ - function get_cf_defs($opts=array()) + function get_cf_defs_live($opts=array(), $live=0) { $query = "SELECT field_id, field_name, field_type, field_options, field_default, field_required, field_size, field_rows, @@ -169,13 +222,13 @@ return $cf_defs; } - /** * Get Custom Field entries * * This function's job is only to retrieve the data from the database, * it should not process the returned data. * + * @todo Smartly cache these calls * @param array $opts Optional custom SQL cmd/value pair attributes * @return array An array of an array, outer key is field_id */ @@ -264,45 +317,43 @@ */ function get_cf_highlight() { - // Check for cached value + // Have we already figured this out? if ( !empty($this->_cf_highlight) ) { return $this->_cf_highlight; } else { - $query = 'SELECT field_id, field_name, field_type, field_options, '. - 'field_default, field_required, field_size, field_rows, '. - 'field_cols, field_order, field_browse, field_highlight, '. - 'field_group_id, field_search '. - 'FROM ibf_registry_field_defs '. - "WHERE field_highlight = '1' ". - 'ORDER BY field_order ASC, field_name ASC'; + $this->_cf_highlight = array(); - $rs = $this->ipsclass->DB->query($query); - - // If we didn't get any, let's default to the first by order num - if ( $this->ipsclass->DB->get_num_rows() < 1 ) + if ( is_array($this->ipsclass->cache['registry_field_defs']) ) { - $query = 'SELECT field_id, field_name, field_type, field_options, '. - 'field_default, field_required, field_size, field_rows, '. - 'field_cols, field_order, field_browse, field_highlight, '. - 'field_group_id, field_search '. - 'FROM ibf_registry_field_defs '. - "WHERE field_order = '1' LIMIT 1"; + foreach ($this->ipsclass->cache['registry_field_defs'] as $field_id => $field_row) + { + if ( $field_row['field_highlight'] == 1 ) + { + // Order the results by field_order, if they have the same field_order + // set for more than one row this will clobber the dups. There is a + // warning about this in the ACP for them, but at some point the code + // needs to take care of that possible end-user blunder automatically. + $this->_cf_highlight[ $field_row['field_order'] ] = $field_row; + } + } - $rs = $this->ipsclass->DB->query($query); + // If we didn't get any, let's default to the first + if ( count($this->_cf_highlight) < 1 ) + { + $field_id = end(array_slice(array_keys($this->ipsclass->cache['registry_field_defs']), 0, 1)); + $this->_cf_highlight[$field_id] = $this->ipsclass->cache['registry_field_defs'][$field_id]; + } + + return $this->_cf_highlight; } - - // Build our Custom Field highlight data structure - $this->_cf_highlight = array(); - - while ( $row = $this->ipsclass->DB->fetch_row($rs) ) + else { - $this->_cf_highlight[$row['field_id']] = $row; + // There is no cache, sorry :( + return array(); } - - return $this->_cf_highlight; } } @@ -394,7 +445,7 @@ $cf_data = array(); // First off the custom field definitions - $cf_data['cf_defs'] = $this->get_cf_defs( array('ORDER BY' => 'field_order ASC') ); + $cf_data['cf_defs'] = $this->get_cf_defs( array('ORDER BY' => array('field_order' => 'ASC') ) ); // Grab the custom field groups $cf_data['cf_groups'] = $this->get_cf_groups(); Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-13 19:06:25 UTC (rev 42) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-14 09:01:47 UTC (rev 43) @@ -305,7 +305,7 @@ $list = ''; // Make sure they haven't exceeded the max item limit - $this->ipsclass->DB->query("SELECT count(*) AS total_cars FROM ibf_registry_items WHERE member_id = '". $this->ipsclass->member['id'] ."'"); + $this->ipsclass->DB->query("SELECT count(*) AS total_items FROM ibf_registry_items WHERE member_id = '". $this->ipsclass->member['id'] ."'"); $row = $this->ipsclass->DB->fetch_row(); if ($row['total_cars'] < $this->class->registry_config['max_user_cars']) @@ -388,6 +388,45 @@ return TRUE; } + + + /** + * Update/Rebuild main menu statistics cache + * + * This gets run by the the session task and on demand in the ACP tools. + * + * @todo Case study needed - is this worth caching? + */ + function update_stats_cache() + { + // Start with an empty cache + $this->ipsclass->cache['registry_stats'] = array(); + + // Total items + $items = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'count(*) AS total_items', + 'from' => 'registry_items' ) ); + + // Total mods + $mods = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'count(*) AS total_mods', + 'from' => 'registry_mods' ) ); + + // Total comments + $comments = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'count(*) AS total_comments', + 'from' => 'registry_guestbooks' ) ); + + // Total views + $views = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'SUM(views) AS total_views', + 'from' => 'registry_items' ) ); + + $this->ipsclass->cache['registry_stats'] = array( 'total_items' => $items['total_items'], + 'total_mods' => $mods['total_mods'], + 'total_comments' => $comments['total_comments'], + 'total_views' => $views['total_views'], + ); + + // Save it back to the cache_store + $this->ipsclass->update_cache( array( 'name' => 'registry_stats', 'array' => 1, 'deletefirst' => 1, 'donow' => 0 ) ); + } } ?> Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/ratings.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/ratings.php 2008-02-13 19:06:25 UTC (rev 42) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/ratings.php 2008-02-14 09:01:47 UTC (rev 43) @@ -75,6 +75,7 @@ * This function's job is only to retrieve the data from the database, * it should not process the returned data. * + * @todo Cache just like get_field_defs, create new get_field_defs_live for ACP * @param array $opts Optional custom SQL cmd/value pair attributes * @return array An array of an array, outer key is field_id */ Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/main.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/main.php 2008-02-13 19:06:25 UTC (rev 42) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/main.php 2008-02-14 09:01:47 UTC (rev 43) @@ -65,6 +65,7 @@ var $nav_bar = array(); var $html = array( 'core', 'main', 'gallery', 'item' ); var $lib = array( 'custom_fields', 'content', 'functions', 'attach' ); + var $cache = array( 'registry_field_defs', 'registry_stats' ); /**#@-*/ /** @var object Fusion Registry core */ @@ -283,31 +284,34 @@ ) ); // Get our custom fields to be shown on the browse screen, if any - $cf_defs = $this->lib['custom_fields']->get_cf_defs( array('WHERE' => "field_browse='1'", 'ORDER BY' => 'field_order ASC') ); + $cf_defs = $this->lib['custom_fields']->get_cf_defs( array('WHERE' => array('field_browse' => 1), + 'ORDER BY' => array('field_order' => 'ASC') ) ); - // Create our sql id list, this will be used when retrieving the custom field entries - $cf_ids = "'". implode( "','", array_keys($cf_defs) ) . "'"; + if ( is_array($cf_defs) ) + { + // Create our sql id list, this will be used when retrieving the custom field entries + $cf_ids = "'". implode( "','", array_keys($cf_defs) ) . "'"; - // Build our <th>'s for the custom fields - $data['custom_field_th'] = ''; + // Build our <th>'s for the custom fields + $data['custom_field_th'] = ''; - // How much width should each get? We're going to be nice and share equally :) - // 48% is the amount left over from the static columns. - $denom = count($cf_defs) ? count($cf_defs) : 1; - $cf_width = 48 / $denom; - $cf_width .= '%'; + // How much width should each get? We're going to be nice and share equally :) + // 48% is the amount left over from the static columns. + $denom = count($cf_defs) ? count($cf_defs) : 1; + $cf_width = 48 / $denom; + $cf_width .= '%'; - // Loop through each one and add the <th> html to the output - foreach ( $cf_defs as $cf_id => $cf_row ) - { - $cf_data['field_name'] = $cf_row['field_name']; - $cf_data['field_width'] = $cf_width; + // Loop through each one and add the <th> html to the output + foreach ( $cf_defs as $cf_id => $cf_row ) + { + $cf_data['field_name'] = $cf_row['field_name']; + $cf_data['field_width'] = $cf_width; - $data['custom_field_th'] .= $this->ipsclass->compiled_templates['skin_registry_main']->browse_th($cf_data); + $data['custom_field_th'] .= $this->ipsclass->compiled_templates['skin_registry_main']->browse_th($cf_data); + } } - // Start building the query for the garage $query = "SELECT g.id, g.image_id, g.member_id, g.views, g.date_updated, g.date_created, m.members_display_name, count(mods.id) AS total_mods @@ -329,24 +333,27 @@ while ( $row = $this->ipsclass->DB->fetch_row($outer_resource) ) { // Get our custom fields data - $cf_entries = $this->lib['custom_fields']->get_cf_entries( array( 'WHERE' => "item_id='".$row['id']."' AND field_id IN (".$cf_ids.")" ) ); + if ( is_array($cf_defs) ) + { + $cf_entries = $this->lib['custom_fields']->get_cf_entries( array( 'WHERE' => "item_id='".$row['id']."' AND field_id IN (".$cf_ids.")" ) ); - // Build our <td>'s for the custom fields - $row['custom_fields'] = ''; + // Build our <td>'s for the custom fields + $row['custom_fields'] = ''; - foreach ( $cf_defs as $cf_id => $cf_row ) - { - // Which css class should we be? This isn't perfect, but will have to do. - $cf_data['field_class'] = $total_cars_printed % 2 ? 'row2' : 'row1'; + foreach ( $cf_defs as $cf_id => $cf_row ) + { + // Which css class should we be? This isn't perfect, but will have to do. + $cf_data['field_class'] = $total_cars_printed % 2 ? 'row2' : 'row1'; - $cf_data['item_id'] = $row['id']; + $cf_data['item_id'] = $row['id']; - $cf_data['field_value'] = $this->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, - 'value' => $cf_entries[$cf_id]['field_value'], - 'type' => 'view', - ) ); + $cf_data['field_value'] = $this->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, + 'value' => $cf_entries[$cf_id]['field_value'], + 'type' => 'view', + ) ); - $row['custom_fields'] .= $this->ipsclass->compiled_templates['skin_registry_main']->browse_td($cf_data); + $row['custom_fields'] .= $this->ipsclass->compiled_templates['skin_registry_main']->browse_td($cf_data); + } } // Make the dates human readable @@ -496,7 +503,7 @@ } // Grab all the defs that are searchable first - $cf_defs = $this->lib['custom_fields']->get_cf_defs( array( 'WHERE' => "field_search='1'" ) ); + $cf_defs = $this->lib['custom_fields']->get_cf_defs( array( 'WHERE' => array('field_search' => 1) ) ); // Process the custom fields input $cf_input = $this->lib['custom_fields']->process_cf_input($cf_defs); @@ -622,25 +629,23 @@ { $data = array(); - // Get the total count of items and views in the garage - $this->ipsclass->DB->query("SELECT count(*) AS total_items, SUM(views) AS total_views FROM ibf_registry_items"); - $row = $this->ipsclass->DB->fetch_row(); + // Get the total count of items and views in the garage from cache + if ( isset( $this->ipsclass->cache['registry_stats'] ) && + is_array( $this->ipsclass->cache['registry_stats'] ) ) + { + $data['stats']['total_items'] = $this->ipsclass->cache['registry_stats']['total_items']; + $data['stats']['total_mods'] = $this->ipsclass->cache['registry_stats']['total_mods']; + $data['stats']['total_views'] = $this->ipsclass->cache['registry_stats']['total_views']; + $data['stats']['total_comments'] = $this->ipsclass->cache['registry_stats']['total_comments']; + } + else + { + $data['stats']['total_items'] = 0; + $data['stats']['total_mods'] = 0; + $data['stats']['total_views'] = 0; + $data['stats']['total_comments'] = 0; + } - $data['stats']['total_items'] = $row['total_items']; - $data['stats']['total_views'] = $row['total_views']; - - // Get the total count of mods in the garage - $this->ipsclass->DB->query("SELECT count(*) AS total_mods FROM ibf_registry_mods"); - $row = $this->ipsclass->DB->fetch_row(); - - $data['stats']['total_mods'] = $row['total_mods']; - - // Get the total count of comments in the garage - $this->ipsclass->DB->query("SELECT count(*) AS total_comments FROM ibf_registry_guestbooks"); - $row = $this->ipsclass->DB->fetch_row(); - - $data['stats']['total_comments'] = $row['total_comments']; - // Do we have a featured item? if ( ($this->registry_config['enable_featured_item'] == 1) AND ( (empty($this->registry_config['featured_item_id']) === FALSE) OR ($this->registry_config['featured_item_random'] == 1) ) ) Modified: branches/stable_3_0_x/upload/sources/tasks/registrysessions.php =================================================================== --- branches/stable_3_0_x/upload/sources/tasks/registrysessions.php 2008-02-13 19:06:25 UTC (rev 42) +++ branches/stable_3_0_x/upload/sources/tasks/registrysessions.php 2008-02-14 09:01:47 UTC (rev 43) @@ -45,6 +45,13 @@ exit(); } +/**#@+ + * Fusion Registry requires + */ +require( ROOT_PATH.'sources/components_public/fusion_config.php' ); +require( REGISTRY_PATH.'lib/functions.php' ); +/**#@-*/ + /** * Delete old Fusion Registry sessions * @@ -60,8 +67,10 @@ var $task = ""; /**#@-*/ - /** @var object */ + /**#@+ @var object */ var $class = ""; + var $fr_cache = ""; + /**#@-*/ /** @var integer Fusion Registry sessions older than this # seconds will be deleted */ var $gc_maxlifetime = 1800; @@ -79,8 +88,12 @@ // Bye-bye old sessions! $this->ipsclass->DB->simple_exec_query( array( 'delete' => 'registry_sessions', 'where' => "ses_time < $date" ) ); + $this->fr_cache = new registry_functions(); + $this->fr_cache->ipsclass =& $this->ipsclass; + $this->fr_cache->update_stats_cache(); + // Log to log table - $this->class->append_task_log( $this->task, 'Old Fusion Registry sessions removed' ); + $this->class->append_task_log( $this->task, 'Old Fusion Registry sessions removed, main menu stats recalculated' ); // Unlock Task: DO NOT MODIFY! $this->class->unlock_task( $this->task ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-13 19:06:29
|
Revision: 42 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=42&view=rev Author: copland007 Date: 2008-02-13 11:06:25 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Make view count increment on viewing registry item a shutdown_update instead of direct update. Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php 2008-02-13 06:54:06 UTC (rev 41) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php 2008-02-13 19:06:25 UTC (rev 42) @@ -1373,7 +1373,7 @@ } // Update the views counter for this vehicle - $this->ipsclass->DB->query("UPDATE ibf_registry_items SET views=views+1 WHERE id='". $this->ipsclass->input['CID'] ."'"); + $this->ipsclass->DB->do_shutdown_update( 'registry_items', array( 'views' => $vehicle_data[views]+1 ), "id='{$this->ipsclass->input['CID']}'" ); // Since we are not directly outputing the modifications, but instead // compiling them and then printing them out we can benefit by this This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-13 06:54:03
|
Revision: 41 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=41&view=rev Author: copland007 Date: 2008-02-12 22:54:06 -0800 (Tue, 12 Feb 2008) Log Message: ----------- Start of client side cache implementation, beginning of sql count drops. registry_config, registry_makemodel, registry_modification cache. Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/core.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/modification.php Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php 2008-02-13 05:13:52 UTC (rev 40) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php 2008-02-13 06:54:06 UTC (rev 41) @@ -65,6 +65,7 @@ var $nav_bar = array(); var $html = array( 'core', 'gallery', 'item' ); var $lib = array( 'custom_fields', 'functions', 'upload', 'parser', 'ratings' ); + var $cache = array( 'registry_categories', 'registry_field_defs', 'registry_rating_defs' ); /**#@-*/ /** @var object Fusion Registry core */ Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/core.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/core.php 2008-02-13 05:13:52 UTC (rev 40) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/core.php 2008-02-13 06:54:06 UTC (rev 41) @@ -77,14 +77,6 @@ { $this->class = &$class; - // Load Config variables - $this->ipsclass->DB->query("SELECT config_name,config_value FROM ibf_registry_config"); - - while ( $row = $this->ipsclass->DB->fetch_row() ) - { - $this->class->registry_config[ $row['config_name'] ] = $row['config_value']; - } - // Just to be safe, let's integer-ize these bad boys $cleaners = array( 'id', 'CID', 'MID', 'make_id', 'model_id', 'search' ); @@ -111,6 +103,24 @@ */ function init() { + // Load the caches, force config to be included + if ( is_array($this->class->cache) ) + { + if (!in_array('registry_config', $this->class->cache)) + { + array_push( $this->class->cache, 'registry_config' ); + } + } + else + { + $this->class->cache = array('registry_config'); + } + + $this->ipsclass->init_load_cache( $this->class->cache ); + + // Just so we don't have to change a bunch of code :) + $this->class->registry_config = $this->ipsclass->cache['registry_config']; + // Decode any html entities in our convert options/path $this->class->registry_config['convert_options'] = function_exists('html_entity_decode') ? html_entity_decode($this->class->registry_config['convert_options']) Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-13 05:13:52 UTC (rev 40) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-13 06:54:06 UTC (rev 41) @@ -106,8 +106,11 @@ */ function build_category_html($data = array()) { - // Load the cache - $this->ipsclass->init_load_cache( array( 'registry_categories' ) ); + // Load the cache if needed + if ( !is_array( $this->ipsclass->cache['registry_categories'] ) ) + { + $this->ipsclass->init_load_cache( array( 'registry_categories' ) ); + } // Build the category select HTML $categories_html = '<select name="category" class="forminput">'; @@ -186,8 +189,11 @@ $return = ''; - // Load the cache - $this->ipsclass->init_load_cache( array( 'registry_makemodel' ) ); + // Load the cache if needed + if ( !is_array( $this->ipsclass->cache['registry_makemodel'] ) ) + { + $this->ipsclass->init_load_cache( array( 'registry_makemodel' ) ); + } // Loop through all the makes if ( isset( $this->ipsclass->cache['registry_makemodel'] ) && Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/modification.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/modification.php 2008-02-13 05:13:52 UTC (rev 40) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/modification.php 2008-02-13 06:54:06 UTC (rev 41) @@ -64,6 +64,7 @@ var $nav_bar = array(); var $html = array( 'core', 'mod', 'gallery' ); var $lib = array( 'custom_fields', 'functions', 'upload', 'parser' ); + var $cache = array( 'registry_categories' ); /**#@-*/ /** @var object registry_core */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-13 05:13:46
|
Revision: 40 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=40&view=rev Author: copland007 Date: 2008-02-12 21:13:52 -0800 (Tue, 12 Feb 2008) Log Message: ----------- Add cache support to build_category_html() Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php 2008-02-12 06:54:16 UTC (rev 39) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php 2008-02-13 05:13:52 UTC (rev 40) @@ -446,7 +446,7 @@ } // Save it back to the cache_store - $this->ipsclass->update_cache( array( 'name' => 'registry_rating_defs', 'array' => 1, 'deletefirst' => 1, 'donow' => 0 ) ); + $this->ipsclass->update_cache( array( 'name' => 'registry_rating_defs', 'array' => 1, 'deletefirst' => 1, 'donow' => 0 ) ); } } -?> \ No newline at end of file +?> Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-12 06:54:16 UTC (rev 39) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-13 05:13:52 UTC (rev 40) @@ -106,20 +106,26 @@ */ function build_category_html($data = array()) { + // Load the cache + $this->ipsclass->init_load_cache( array( 'registry_categories' ) ); + // Build the category select HTML $categories_html = '<select name="category" class="forminput">'; - $this->ipsclass->DB->query("SELECT * FROM ibf_registry_categories ORDER BY title ASC"); - while ( $cat_row = $this->ipsclass->DB->fetch_row() ) + if ( isset( $this->ipsclass->cache['registry_categories'] ) && + is_array( $this->ipsclass->cache['registry_categories'] ) ) { - if ( $cat_row['id'] == $data['selected'] ) + foreach ( $this->ipsclass->cache['registry_categories'] as $cat_id => $cat_title ) { - $categories_html .= '<option value="'.$cat_row['id'].'" selected="selected">'.$cat_row['title'].'</option>'; + if ( $cat_id == $data['selected'] ) + { + $categories_html .= '<option value="'.$cat_id.'" selected="selected">'.$cat_title.'</option>'; + } + else + { + $categories_html .= '<option value="'.$cat_id.'">'.$cat_title.'</option>'; + } } - else - { - $categories_html .= '<option value="'.$cat_row['id'].'">'.$cat_row['title'].'</option>'; - } } // Finish off the category select HTML @@ -378,4 +384,4 @@ } } -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-12 06:54:12
|
Revision: 39 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=39&view=rev Author: copland007 Date: 2008-02-11 22:54:16 -0800 (Mon, 11 Feb 2008) Log Message: ----------- Typo Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php 2008-02-12 06:31:47 UTC (rev 38) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php 2008-02-12 06:54:16 UTC (rev 39) @@ -478,7 +478,7 @@ $this->fr_cache->ipsclass =& $this->ipsclass; $this->fr_cache->update_cache(); - $this->ipsclass->main_msg = 'Registry custom field cache updated'; + $this->ipsclass->main_msg = 'Registry rating field cache updated'; break; case 'registry_categories': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-12 06:31:43
|
Revision: 38 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=38&view=rev Author: copland007 Date: 2008-02-11 22:31:47 -0800 (Mon, 11 Feb 2008) Log Message: ----------- Added ACP cache rebuild of all supported caches. Fixed bug in rating fields ACP page, the delete link was not substituting the REGISTRY_URL macro. Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_categories.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_categories.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_categories.php 2008-02-12 05:01:50 UTC (rev 37) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_categories.php 2008-02-12 06:31:47 UTC (rev 38) @@ -139,6 +139,9 @@ // Bye-Bye... delete the category $this->ipsclass->DB->query("DELETE FROM ibf_registry_categories WHERE id='".$this->ipsclass->input['id']."'"); + // Rebuild cache + $this->update_cache(); + $text = "Deleted Fusion Registry Category '{$category['title']}'"; $url = 'act='.REGISTRY_URL.'§ion=components&menu=categories'; $time = 2; @@ -296,6 +299,9 @@ $this->ipsclass->DB->query("UPDATE ibf_registry_categories SET $db_string WHERE id='".$this->ipsclass->input['id']."'"); + // Rebuild cache + $this->update_cache(); + $text = "Modified Fusion Registry Category '{$registry_cat['title']}'"; $url = 'act='.REGISTRY_URL.'§ion=components&menu=categories'; $time = 2; @@ -373,6 +379,9 @@ // Add the category $this->ipsclass->DB->query("INSERT INTO ibf_registry_categories (".$db_string['FIELD_NAMES'].") VALUES(".$db_string['FIELD_VALUES'].")"); + // Rebuild cache + $this->update_cache(); + $text = "Added Fusion Registry Category '{$this->ipsclass->input['title']}'"; $url = 'act='.REGISTRY_URL.'§ion=components&menu=categories'; $time = 2; Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php 2008-02-12 05:01:50 UTC (rev 37) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php 2008-02-12 06:31:47 UTC (rev 38) @@ -164,6 +164,9 @@ $this->ad_registry_loader->update_config($config_array); + // Rebuild cache + $this->update_cache(); + $text = 'Updated Fusion Registry Config'; $url = 'act='.REGISTRY_URL.'§ion=components&menu=config'; $time = 2; Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php 2008-02-12 05:01:50 UTC (rev 37) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php 2008-02-12 06:31:47 UTC (rev 38) @@ -168,6 +168,9 @@ // Delete any end-user entries, if any.. $this->ipsclass->DB->simple_exec_query( array( 'delete' => 'registry_field_entries', 'where' => "field_id=".$this->ipsclass->input['f'] ) ); + // Rebuild cache + $this->update_cache(); + $this->ipsclass->admin->save_log("Fusion Registry Custom Field '{$field['field_name']}' removed"); $this->ipsclass->admin->done_screen("Fusion Registry Custom Field '{$field['field_name']}' removed", "Fusion Registry Custom Field Management", "act=".REGISTRY_URL."§ion=components&menu=custom_fields", 'redirect' ); @@ -200,6 +203,9 @@ 'field_search' => $this->ipsclass->input['field_search'], ) ); + // Rebuild cache + $this->update_cache(); + $this->ipsclass->admin->save_log("Fusion Registry Custom Field '{$this->ipsclass->input['field_name']}' created"); $this->ipsclass->admin->done_screen("Fusion Registry Custom Field '{$this->ipsclass->input['field_name']}' created", "Fusion Registry Custom Field Management", "act=".REGISTRY_URL."§ion=components&menu=custom_fields", 'redirect' ); @@ -369,6 +375,9 @@ 'field_search' => $this->ipsclass->input['field_search'] ), "field_id={$this->ipsclass->input['f']}" ); + // Rebuild cache + $this->update_cache(); + $this->ipsclass->admin->save_log("Fusion Registry Custom Field '{$this->ipsclass->input['field_name']}' edited"); $this->ipsclass->admin->done_screen("Fusion Registry Custom Field '{$this->ipsclass->input['field_name']}' edited", "Fusion Registry Custom Field Management", "act=".REGISTRY_URL."§ion=components&menu=custom_fields", 'redirect' ); @@ -394,6 +403,9 @@ // Wipe out this group, this is all that we have to do, really ;) $this->ipsclass->DB->query( "UPDATE ibf_registry_field_defs SET field_group_id = NULL WHERE field_group_id='".$this->ipsclass->input['g']."'" ); + // Rebuild cache + $this->update_cache(); + $this->ipsclass->admin->save_log("Fusion Registry Custom Field Group id '{$this->ipsclass->input['g']}' deleted"); $this->ipsclass->admin->done_screen("Fusion Registry Custom Field Group id '{$this->ipsclass->input['g']}' deleted", "Fusion Registry Custom Field Management", "act=".REGISTRY_URL."§ion=components&menu=custom_fields", 'redirect' ); @@ -437,6 +449,9 @@ $this->ipsclass->DB->do_update( 'registry_field_defs', array( 'field_group_id' => $this->ipsclass->input['g'] ), "field_id IN $field_list" ); + // Rebuild cache + $this->update_cache(); + $this->ipsclass->admin->save_log("Fusion Registry Custom Field Group id '{$this->ipsclass->input['g']}' edited"); $this->ipsclass->admin->done_screen("Fusion Registry Custom Field Group id '{$this->ipsclass->input['g']}' edited", "Fusion Registry Custom Field Management", "act=".REGISTRY_URL."§ion=components&menu=custom_fields", 'redirect' ); @@ -582,6 +597,9 @@ $this->ipsclass->DB->do_update( 'registry_field_defs', array( 'field_group_id' => $new_group_id ), "field_id IN $field_list" ); + // Rebuild cache + $this->update_cache(); + $this->ipsclass->admin->save_log("Fusion Registry Custom Field Group id '{$new_group_id}' Added"); $this->ipsclass->admin->done_screen("Fusion Registry Custom Field Group id '{$new_group_id}' Added", "Fusion Registry Custom Field Management", "act=".REGISTRY_URL."§ion=components&menu=custom_fields", 'redirect' ); @@ -609,6 +627,9 @@ $this->ipsclass->DB->query( "UPDATE ibf_registry_field_defs SET field_highlight='1' WHERE field_id='$field_id'" ); } + // Rebuild cache + $this->update_cache(); + $this->ipsclass->admin->save_log("Fusion Registry Custom Field Highlight fields '".$this->ipsclass->input['field_highlight']."' set"); $this->ipsclass->admin->done_screen("Fusion Registry Custom Field Highlight fields '".$this->ipsclass->input['field_highlight']."' set", "Fusion Registry Custom Field Management", "act=".REGISTRY_URL."§ion=components&menu=custom_fields", 'redirect' ); Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php 2008-02-12 05:01:50 UTC (rev 37) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php 2008-02-12 06:31:47 UTC (rev 38) @@ -153,6 +153,9 @@ // Delete any reports... $this->ipsclass->DB->simple_exec_query( array( 'delete' => 'registry_rating_reports', 'where' => "rating_id=".$this->ipsclass->input['r'] ) ); + // Rebuild cache + $this->update_cache(); + $this->ipsclass->admin->save_log("Fusion Registry Rating Field '{$rating['rating_name']}' removed"); $this->ipsclass->admin->done_screen("Fusion Registry Rating Field '{$rating['rating_name']}' removed", "Fusion Registry Rating Fields", "act=".REGISTRY_URL."§ion=components&menu=rating_fields", 'redirect' ); @@ -176,6 +179,9 @@ 'rating_order' => $this->ipsclass->input['rating_order'], ), "rating_id={$this->ipsclass->input['r']}" ); + // Rebuild cache + $this->update_cache(); + $this->ipsclass->admin->save_log("Fusion Registry Rating Field '{$this->ipsclass->input['rating_name']}' edited"); $this->ipsclass->admin->done_screen("Fusion Registry Rating Field '{$this->ipsclass->input['rating_name']}' edited", "Fusion Registry Rating Fields", "act=".REGISTRY_URL."§ion=components&menu=rating_fields", 'redirect' ); @@ -280,6 +286,9 @@ 'rating_order' => $this->ipsclass->input['rating_order'], ) ); + // Rebuild cache + $this->update_cache(); + $this->ipsclass->admin->save_log("Fusion Registry Rating Field '{$this->ipsclass->input['rating_name']}' created"); $this->ipsclass->admin->done_screen("Fusion Registry Rating Field '{$this->ipsclass->input['rating_name']}' created", "Fusion Registry Rating Fields", "act=".REGISTRY_URL."§ion=components&menu=rating_fields", 'redirect' ); @@ -347,7 +356,7 @@ { if ( confirm('Are you sure you want to delete this Fusion Registry Rating field and all votes associated with it? This operation is not undo-able!') ) { - window.location.href = '{$this->ipsclass->base_url}&act={REGISTRY_URL}§ion=components&menu=rating_fields&code=delete&r=' + rating_id; + window.location.href = '{$this->ipsclass->base_url}&act=".REGISTRY_URL."§ion=components&menu=rating_fields&code=delete&r=' + rating_id; } } // --> Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php 2008-02-12 05:01:50 UTC (rev 37) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php 2008-02-12 06:31:47 UTC (rev 38) @@ -59,6 +59,7 @@ /** @var object */ var $class = ''; + var $fr_cache; /** @var array Used as a shortcut lookup for the images used in the various admin interfaces */ var $imgs = array(); @@ -167,6 +168,12 @@ } } + require_once( AD_REGISTRY_PATH.'ad_config.php' ); + $this->fr_cache = new ad_registry_config(); + $this->fr_cache->ipsclass =& $this->ipsclass; + + $this->fr_cache->update_cache(); + return TRUE; } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-12 05:01:46
|
Revision: 37 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=37&view=rev Author: copland007 Date: 2008-02-11 21:01:50 -0800 (Mon, 11 Feb 2008) Log Message: ----------- Added registry_categories to cache support. Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_categories.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_categories.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_categories.php 2008-02-11 07:39:45 UTC (rev 36) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_categories.php 2008-02-12 05:01:50 UTC (rev 37) @@ -383,5 +383,29 @@ // End of the show, c'ya $this->ipsclass->admin->redirect( $url, $text, 0, $time ); } + + + /** + * Update/Rebuild cache + * + * This gets run any time a change is made and on demand in the ACP tools. + */ + function update_cache() + { + // Start with an empty cache + $this->ipsclass->cache['registry_categories'] = array(); + + $this->ipsclass->DB->simple_construct( array( 'select' => 'id,title', 'from' => 'registry_categories' ) ); + $this->ipsclass->DB->simple_exec(); + + // Loop through each setting + while ( $row = $this->ipsclass->DB->fetch_row() ) + { + $this->ipsclass->cache['registry_categories'][ $row['id'] ] = $row['title']; + } + + // Save it back to the cache_store + $this->ipsclass->update_cache( array( 'name' => 'registry_categories', 'array' => 1, 'deletefirst' => 1, 'donow' => 0 ) ); + } } ?> \ No newline at end of file Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php 2008-02-11 07:39:45 UTC (rev 36) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php 2008-02-12 05:01:50 UTC (rev 37) @@ -101,6 +101,7 @@ 'registry_config' => 'Runtime configuration', 'registry_field_defs' => 'Custom field definitions', 'registry_rating_defs' => 'Custom rating definitions', + 'registry_categories' => 'Modification categories', ); switch($this->ipsclass->input['code']) @@ -480,6 +481,15 @@ $this->ipsclass->main_msg = 'Registry custom field cache updated'; break; + case 'registry_categories': + require_once( AD_REGISTRY_PATH.'ad_categories.php' ); + $this->fr_cache = new ad_registry_categories(); + $this->fr_cache->ipsclass =& $this->ipsclass; + + $this->fr_cache->update_cache(); + $this->ipsclass->main_msg = 'Registry modification category cache updated'; + break; + default: $this->ipsclass->main_msg = 'No valid cache was specified to update'; break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-11 07:39:40
|
Revision: 36 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=36&view=rev Author: copland007 Date: 2008-02-10 23:39:45 -0800 (Sun, 10 Feb 2008) Log Message: ----------- Implemented multi-cache support, add cache control to ACP Tools page. Support for new caches added not yet implemented (config, field_defs, rating_defs). Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_makes_models.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php 2008-02-10 19:18:29 UTC (rev 35) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php 2008-02-11 07:39:45 UTC (rev 36) @@ -420,5 +420,29 @@ // That's all folk! $this->ipsclass->admin->output(); } + + + /** + * Update/Rebuild cache + * + * This gets run any time a change is made and on demand in the ACP tools. + */ + function update_cache() + { + // Start with an empty cache + $this->ipsclass->cache['registry_config'] = array(); + + $this->ipsclass->DB->simple_construct( array( 'select' => 'config_name,config_value', 'from' => 'registry_config' ) ); + $this->ipsclass->DB->simple_exec(); + + // Loop through each setting + while ( $row = $this->ipsclass->DB->fetch_row() ) + { + $this->ipsclass->cache['registry_config'][ $row['config_name'] ] = $row['config_value']; + } + + // Save it back to the cache_store + $this->ipsclass->update_cache( array( 'name' => 'registry_config', 'array' => 1, 'deletefirst' => 1, 'donow' => 0 ) ); + } } ?> \ No newline at end of file Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php 2008-02-10 19:18:29 UTC (rev 35) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php 2008-02-11 07:39:45 UTC (rev 36) @@ -787,5 +787,42 @@ return $field_array; } + + + /** + * Update/Rebuild cache + * + * This gets run any time a change is made and on demand in the ACP tools. + */ + function update_cache() + { + // Start with an empty cache + $this->ipsclass->cache['registry_field_defs'] = array(); + + $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'registry_field_defs' ) ); + $this->ipsclass->DB->simple_exec(); + + // Loop through each setting + while ( $row = $this->ipsclass->DB->fetch_row() ) + { + $this->ipsclass->cache['registry_field_defs'][ $row['field_id'] ] = array( 'field_name' => $row['field_name'], + 'field_type' => $row['field_type'], + 'field_options' => $row['field_options'], + 'field_default' => $row['field_default'], + 'field_required' => $row['field_required'], + 'field_size' => $row['field_size'], + 'field_rows' => $row['field_rows'], + 'field_cols' => $row['field_cols'], + 'field_order' => $row['field_order'], + 'field_browse' => $row['field_browse'], + 'field_group_id' => $row['field_group_id'], + 'field_highlight' => $row['field_highlight'], + 'field_search' => $row['field_search'], + ); + } + + // Save it back to the cache_store + $this->ipsclass->update_cache( array( 'name' => 'registry_field_defs', 'array' => 1, 'deletefirst' => 1, 'donow' => 0 ) ); + } } ?> \ No newline at end of file Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_makes_models.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_makes_models.php 2008-02-10 19:18:29 UTC (rev 35) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_makes_models.php 2008-02-11 07:39:45 UTC (rev 36) @@ -90,11 +90,9 @@ $this->ad_registry_loader->ipsclass =& $this->ipsclass; $this->ad_registry_loader->auto_run(&$this); - // Initialize custom_fields and functions + // Initialize custom_fields $this->lib['custom_fields'] = new registry_custom_fields(&$class); $this->lib['custom_fields']->ipsclass =& $this->ipsclass; - $this->lib['functions'] = new registry_functions(&$class); - $this->lib['functions']->ipsclass =& $this->ipsclass; switch($this->ipsclass->input['code']) { @@ -180,7 +178,7 @@ } // Rebuild cache - $this->lib['functions']->update_makemodel_cache(); + $this->update_cache(); $added_makes = substr($added_makes, 0, -2); @@ -237,7 +235,7 @@ } // Rebuild cache - $this->lib['functions']->update_makemodel_cache(); + $this->update_cache(); $added_models = substr($added_models, 0, -2); @@ -532,7 +530,7 @@ $this->ipsclass->DB->query("UPDATE ibf_registry_makes SET $db_string WHERE id='".$this->ipsclass->input['make_id']."'"); // Rebuild cache - $this->lib['functions']->update_makemodel_cache(); + $this->update_cache(); $text = "Modified Fusion Registry Make ID: '{$this->ipsclass->input['make_id']}' to '{$this->ipsclass->input['change_to']}'"; $url = 'act='.REGISTRY_URL.'§ion=components&menu=makes_models&code=make_menu'; @@ -565,7 +563,7 @@ $this->ipsclass->DB->query("UPDATE ibf_registry_models SET $db_string WHERE id='".$this->ipsclass->input['model_id']."'"); // Rebuild cache - $this->lib['functions']->update_makemodel_cache(); + $this->update_cache(); $text = "Modified Fusion Registry Model ID: '{$this->ipsclass->input['model_id']}' to '{$this->ipsclass->input['change_to']}'"; $url = 'act='.REGISTRY_URL.'§ion=components&menu=makes_models&code=model_menu&make_id='. $this->ipsclass->input['make_id']; @@ -735,7 +733,7 @@ $this->ipsclass->DB->query("DELETE FROM ibf_registry_models WHERE make_id IN $sql_make_ids"); // Rebuild cache - $this->lib['functions']->update_makemodel_cache(); + $this->update_cache(); $text = "Deleted Fusion Registry Vehicle Make '$make_to_delete' and Models"; $url = 'act='.REGISTRY_URL.'§ion=components&menu=makes_models&code=make_menu'; @@ -905,7 +903,7 @@ $this->ipsclass->DB->query("DELETE FROM ibf_registry_models WHERE id IN $sql_model_ids"); // Rebuild cache - $this->lib['functions']->update_makemodel_cache(); + $this->update_cache(); $text = "Deleted Fusion Registry Vehicle Model '$model_to_delete'"; $url = 'act='.REGISTRY_URL.'§ion=components&menu=makes_models&code=model_menu&make_id='. $this->ipsclass->input['make_id']; @@ -917,4 +915,37 @@ // End of the show, c'ya $this->ipsclass->admin->redirect( $url, $text, 0, $time ); } + + /** + * Update/Rebuild cache + * + * This gets run any time a change is made and on demand in the ACP tools. + */ + function update_cache() + { + // Start with an empty cache + $this->ipsclass->cache['registry_makemodel'] = array(); + + // Loop through each make + $make_q_id = $this->ipsclass->DB->query("SELECT id, make FROM ibf_registry_makes"); + + // Loop through all the makes + while ( $make_row = $this->ipsclass->DB->fetch_row($make_q_id) ) + { + // Create the base make entry + $this->ipsclass->cache['registry_makemodel'][ $make_row['id'] ] = array( 'name' => $make_row['make'], + 'models' => array() ); + + $model_q_id = $this->ipsclass->DB->query("SELECT id, model FROM ibf_registry_models WHERE make_id='".$make_row['id']."'"); + + // Loop through all the models of this make + while ( $model_row = $this->ipsclass->DB->fetch_row($model_q_id) ) + { + $this->ipsclass->cache['registry_makemodel'][ $make_row['id'] ]['models'][ $model_row['id'] ] = $model_row['model']; + } + } + + // Save it back to the cache_store + $this->ipsclass->update_cache( array( 'name' => 'registry_makemodel', 'array' => 1, 'deletefirst' => 1, 'donow' => 0 ) ); + } } \ No newline at end of file Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php 2008-02-10 19:18:29 UTC (rev 35) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_rating_fields.php 2008-02-11 07:39:45 UTC (rev 36) @@ -413,5 +413,31 @@ // End of the show, c'ya $this->ipsclass->admin->redirect( $url, $text, 0, $time ); } + + + /** + * Update/Rebuild cache + * + * This gets run any time a change is made and on demand in the ACP tools. + */ + function update_cache() + { + // Start with an empty cache + $this->ipsclass->cache['registry_rating_defs'] = array(); + + $this->ipsclass->DB->simple_construct( array( 'select' => 'rating_id,rating_name,rating_order', 'from' => 'registry_rating_defs' ) ); + $this->ipsclass->DB->simple_exec(); + + // Loop through each setting + while ( $row = $this->ipsclass->DB->fetch_row() ) + { + $this->ipsclass->cache['registry_rating_defs'][ $row['rating_id'] ] = array( 'rating_name' => $row['rating_name'], + 'rating_order' => $row['rating_order'], + ); + } + + // Save it back to the cache_store + $this->ipsclass->update_cache( array( 'name' => 'registry_rating_defs', 'array' => 1, 'deletefirst' => 1, 'donow' => 0 ) ); + } } ?> \ No newline at end of file Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php 2008-02-10 19:18:29 UTC (rev 35) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php 2008-02-11 07:39:45 UTC (rev 36) @@ -46,7 +46,6 @@ */ require_once( AD_REGISTRY_PATH.'ad_registry_loader.php' ); require_once( KERNEL_PATH.'class_image.php' ); -require_once( REGISTRY_PATH.'lib/functions.php' ); /**#@-*/ /** @@ -61,11 +60,15 @@ var $ipsclass; var $ad_registry_loader; var $ad_registry_verify; + var $fr_cache; /**#@-*/ /** @var resource */ var $log_handle; + /** @var array */ + var $map; + /** * Intialization of ad_registry_tools * @@ -88,6 +91,18 @@ $this->ad_registry_loader->ipsclass =& $this->ipsclass; $this->ad_registry_loader->auto_run(&$this); + // Load the base skin_tools skin to piggy back the cache templates + $this->html = $this->ipsclass->acp_load_template('cp_skin_tools'); + $this->ipsclass->form_code .= "&menu=tools"; + $this->ipsclass->form_code_js .= "&menu=tools"; + + // Cache mappings + $this->map = array( 'registry_makemodel' => 'All automobile makes and models', + 'registry_config' => 'Runtime configuration', + 'registry_field_defs' => 'Custom field definitions', + 'registry_rating_defs' => 'Custom rating definitions', + ); + switch($this->ipsclass->input['code']) { case 'rebuild_thumbs': @@ -110,9 +125,21 @@ $this->db_remove_1742529(); break; - case 'rebuild_makemodel_cache': - $this->rebuild_makemodel_cache(); + case 'cacheend': + $this->cache_end(); break; + + case 'viewcache': + $this->view_cache(); + break; + + case 'cache_update_all': + $this->ipsclass->admin->output_multiple_redirect_init( $this->ipsclass->base_url.'&'.$this->ipsclass->form_code_js.'&code=cache_update_all_process&id=0' ); + break; + + case 'cache_update_all_process': + $this->cache_update_all_process(); + break; default: $this->main_menu(); @@ -406,29 +433,135 @@ /** - * Rebuild make/model cache + * Rebuild cache */ - function rebuild_makemodel_cache() + function cache_end( $cache_name='', $dontcancel=0 ) { - $registry_funcs = new registry_functions(); - $registry_funcs->ipsclass =& $this->ipsclass; + if ( ! $cache_name ) + { + $cache_name = $this->ipsclass->input['cache']; + } - $registry_funcs->update_makemodel_cache(); + switch ( $cache_name ) + { + case 'registry_makemodel': + require_once( AD_REGISTRY_PATH.'ad_makes_models.php' ); + $this->fr_cache = new ad_registry_makes_models(); + $this->fr_cache->ipsclass =& $this->ipsclass; - // Report our mischief ways :) - $text = "<b>Fusion Registry make/model cache rebuilt</b>"; - $url = "act=".REGISTRY_URL."§ion=components&menu=tools"; - $time = 5; + $this->fr_cache->update_cache(); + $this->ipsclass->main_msg = 'Registry Make/Model cache updated'; + break; - // Big brother is watching :) - $this->ipsclass->admin->save_log("Rebuilt Fusion Registry make/model cache"); + case 'registry_config': + require_once( AD_REGISTRY_PATH.'ad_config.php' ); + $this->fr_cache = new ad_registry_config(); + $this->fr_cache->ipsclass =& $this->ipsclass; - // End of the show, c'ya - $this->ipsclass->admin->redirect( $url, $text, 0, $time ); + $this->fr_cache->update_cache(); + $this->ipsclass->main_msg = 'Registry configuration cache updated'; + break; + + case 'registry_field_defs': + require_once( AD_REGISTRY_PATH.'ad_custom_fields.php' ); + $this->fr_cache = new ad_registry_custom_fields(); + $this->fr_cache->ipsclass =& $this->ipsclass; + + $this->fr_cache->update_cache(); + $this->ipsclass->main_msg = 'Registry custom field cache updated'; + break; + + case 'registry_rating_defs': + require_once( AD_REGISTRY_PATH.'ad_rating_fields.php' ); + $this->fr_cache = new ad_registry_rating_fields(); + $this->fr_cache->ipsclass =& $this->ipsclass; + + $this->fr_cache->update_cache(); + $this->ipsclass->main_msg = 'Registry custom field cache updated'; + break; + + default: + $this->ipsclass->main_msg = 'No valid cache was specified to update'; + break; + } + + if ( ! $dontcancel ) + { + $this->main_menu(); + } } /** + * View cache + */ + function view_cache() + { + if ( ! $this->ipsclass->input['cache'] ) + { + $this->ipsclass->main_msg = "No ID was passed, please try again"; + $this->cache_start(); + } + + $row = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'cs_array,cs_value', 'from' => 'cache_store', + 'where' => "cs_key='{$this->ipsclass->input['cache']}'" ) ); + + ob_start(); + if ( $row['cs_array'] ) + { + print_r( unserialize($this->ipsclass->txt_stripslashes($row['cs_value'])) ); + } + else + { + print $row['cs_value']; + } + + $out = ob_get_contents(); + ob_end_clean(); + + $this->ipsclass->html = "<pre>".htmlspecialchars($out)."</pre>"; + + $this->ipsclass->admin->print_popup(); + } + + + /** + * Update all caches + */ + function cache_update_all_process() + { + $id = intval( $this->ipsclass->input['id'] ); + $cache_name = ''; + $count = 0; + $img = '<img src="'.$this->ipsclass->skin_acp_url.'/images/aff_tick_small.png" border="0" alt="-" /> '; + + // Get cache name + foreach( $this->map as $name => $desc ) + { + if ( $count == $id ) + { + $cache_name = $name; + break; + } + + $count++; + } + + $id++; + if ( $cache_name ) + { + $this->cache_end( $cache_name, 1 ); + + $this->ipsclass->admin->output_multiple_redirect_hit( $this->ipsclass->base_url.'&'.$this->ipsclass->form_code_js.'&code=cache_update_all_process&id='.$id, $img.$cache_name.' processed...' ); + } + else + { + $this->ipsclass->admin->output_multiple_redirect_done(); + } + } + + + /** * Rebuild All Thumbnails * * If the end user opted to create a log we will use function {@link _log} @@ -878,6 +1011,53 @@ $this->ipsclass->html .= $this->ipsclass->skin_acp_global->information_box( "Fusion Registry Tools", "Below are tools that can help you keep your Fusion Registry running smooth.".'<br /> ' ) . "<br >"; //------------------------------- + // Cache + //------------------------------- + + $used = array(); + $cache_html = ""; + $cache_keys = implode("','", array_keys( $this->map ) ); + + $this->ipsclass->DB->simple_construct( array( 'select' => 'cs_key,cs_value,cs_array', 'from' => 'cache_store', + 'where' => "cs_key IN ('$cache_keys')", 'order' => 'cs_key' ) ); + $this->ipsclass->DB->simple_exec(); + + while ( $row = $this->ipsclass->DB->fetch_row() ) + { + // Keep track of the caches actually in the db + $used[ $row['cs_key'] ] = $row['cs_key']; + $row['_size'] = ceil( intval( strlen( $row['cs_value'] ) ) / 1024 ); + $row['_desc'] = $this->map[ $row['cs_key'] ]; + + $cache_html .= $this->html->cache_row( $row ); + } + + // cache entries in map that aren't in the db + if ( count( $used ) != count( $this->map ) ) + { + foreach( $this->map as $k => $v ) + { + if ( in_array( $k, array_keys( $used ) ) ) + { + continue; + } + else + { + $row['cs_key'] = $k; + $row['cs_value'] = $v; + $row['_size'] = 0; + $row['_desc'] = $this->map[ $row['cs_key'] ]; + + $cache_html .= $this->html->cache_row( $row ); + } + } + } + + $this->ipsclass->html .= $this->html->cache_overview( $cache_html ); + + $this->ipsclass->html .= '<br /><br />'; + + //------------------------------- // Rebuild Thumbs //------------------------------- @@ -944,26 +1124,6 @@ $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); - $this->ipsclass->html .= '<br />'; - - //------------------------------- - // Rebuild make/model cache tool - //------------------------------- - - $this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code', 'rebuild_makemodel_cache' ), - 2 => array( 'act' , REGISTRY_URL ), - 3 => array( 'menu', 'tools' ), - 4 => array( 'section', 'components' ), - ) ); - - $desc = 'The rebuild make/model cache tool will refresh the cache of all the makes and models in the database.'; - - $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Rebuild make/model cache", $desc ); - - $this->ipsclass->html .= $this->ipsclass->adskin->end_form('Rebuild make/model cache'); - - $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); - // That's all folk! $this->ipsclass->admin->output(); } Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-10 19:18:29 UTC (rev 35) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-11 07:39:45 UTC (rev 36) @@ -376,41 +376,6 @@ return TRUE; } - - - /** - * Update/Rebuild make and model cache - * - * This gets run any time a change is made to makes/models, and - * on demand in the ACP tools. - */ - function update_makemodel_cache() - { - // Start with an empty cache - $this->ipsclass->cache['registry_makemodel'] = array(); - - // Loop through each make - $make_q_id = $this->ipsclass->DB->query("SELECT id, make FROM ibf_registry_makes"); - - // Loop through all the makes - while ( $make_row = $this->ipsclass->DB->fetch_row($make_q_id) ) - { - // Create the base make entry - $this->ipsclass->cache['registry_makemodel'][ $make_row['id'] ] = array( 'name' => $make_row['make'], - 'models' => array() ); - - $model_q_id = $this->ipsclass->DB->query("SELECT id, model FROM ibf_registry_models WHERE make_id='".$make_row['id']."'"); - - // Loop through all the models of this make - while ( $model_row = $this->ipsclass->DB->fetch_row($model_q_id) ) - { - $this->ipsclass->cache['registry_makemodel'][ $make_row['id'] ]['models'][ $model_row['id'] ] = $model_row['model']; - } - } - - // Save it back to the cache_store - $this->ipsclass->update_cache( array( 'name' => 'registry_makemodel', 'array' => 1, 'deletefirst' => 1, 'donow' => 0 ) ); - } } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-10 19:18:24
|
Revision: 35 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=35&view=rev Author: copland007 Date: 2008-02-10 11:18:29 -0800 (Sun, 10 Feb 2008) Log Message: ----------- Check for empty cache, prevents script error. Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-10 07:19:03 UTC (rev 34) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-10 19:18:29 UTC (rev 35) @@ -184,28 +184,32 @@ $this->ipsclass->init_load_cache( array( 'registry_makemodel' ) ); // Loop through all the makes - foreach ( $this->ipsclass->cache['registry_makemodel'] as $make_id => $make_array ) + if ( isset( $this->ipsclass->cache['registry_makemodel'] ) && + is_array( $this->ipsclass->cache['registry_makemodel'] ) ) { - // Start this makes' row in the output, this is where it gets confusing! - $return .= 'cars["'.$make_array['name'].'"] = new Array("'.$make_id.'", new Array('; + foreach ( $this->ipsclass->cache['registry_makemodel'] as $make_id => $make_array ) + { + // Start this makes' row in the output, this is where it gets confusing! + $return .= 'cars["'.$make_array['name'].'"] = new Array("'.$make_id.'", new Array('; - $model_string = ''; - $model_id_string = ''; + $model_string = ''; + $model_id_string = ''; - // Loop through all the models of this make - foreach ( $make_array['models'] as $model_id => $model_name ) - { - // Create the arrays that we will use in the output - $model_string .= '"'.$model_name.'",'; - $model_id_string .= '"'.$model_id .'",'; - } + // Loop through all the models of this make + foreach ( $make_array['models'] as $model_id => $model_name ) + { + // Create the arrays that we will use in the output + $model_string .= '"'.$model_name.'",'; + $model_id_string .= '"'.$model_id .'",'; + } - // Strip off the last comma - $model_string = substr($model_string, 0, -1); - $model_id_string = substr($model_id_string, 0, -1); + // Strip off the last comma + $model_string = substr($model_string, 0, -1); + $model_id_string = substr($model_id_string, 0, -1); - // Finish off this makes' row in the output - $return .= $model_string ."), new Array(". $model_id_string ."));\n"; + // Finish off this makes' row in the output + $return .= $model_string ."), new Array(". $model_id_string ."));\n"; + } } return $return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-10 07:18:59
|
Revision: 34 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=34&view=rev Author: copland007 Date: 2008-02-09 23:19:03 -0800 (Sat, 09 Feb 2008) Log Message: ----------- Introduced make/model cache 'registry_makemodel'. Implemented on 'add new item' and all acp make/model pages that modify database tables. Added an on-demand rebuild of registry_makemodel cache tool. Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_makes_models.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_makes_models.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_makes_models.php 2008-02-10 05:28:00 UTC (rev 33) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_makes_models.php 2008-02-10 07:19:03 UTC (rev 34) @@ -46,6 +46,7 @@ */ require_once( AD_REGISTRY_PATH.'ad_registry_loader.php' ); require_once( REGISTRY_PATH.'lib/custom_fields.php' ); +require_once( REGISTRY_PATH.'lib/functions.php' ); /** * Class ad_registry_makes_models deals with the vehicle makes & models of the Fusion Registry @@ -89,9 +90,11 @@ $this->ad_registry_loader->ipsclass =& $this->ipsclass; $this->ad_registry_loader->auto_run(&$this); - // Initialize custom_fields + // Initialize custom_fields and functions $this->lib['custom_fields'] = new registry_custom_fields(&$class); $this->lib['custom_fields']->ipsclass =& $this->ipsclass; + $this->lib['functions'] = new registry_functions(&$class); + $this->lib['functions']->ipsclass =& $this->ipsclass; switch($this->ipsclass->input['code']) { @@ -176,6 +179,9 @@ $added_makes .= "$make, "; } + // Rebuild cache + $this->lib['functions']->update_makemodel_cache(); + $added_makes = substr($added_makes, 0, -2); $text = "Added Fusion Registry Vehicle Make(s) '$added_makes'"; @@ -230,6 +236,9 @@ $added_models .= "$model, "; } + // Rebuild cache + $this->lib['functions']->update_makemodel_cache(); + $added_models = substr($added_models, 0, -2); $text = "Added Fusion Registry Vehicle Model(s) '$added_models'"; @@ -522,6 +531,9 @@ $this->ipsclass->DB->query("UPDATE ibf_registry_makes SET $db_string WHERE id='".$this->ipsclass->input['make_id']."'"); + // Rebuild cache + $this->lib['functions']->update_makemodel_cache(); + $text = "Modified Fusion Registry Make ID: '{$this->ipsclass->input['make_id']}' to '{$this->ipsclass->input['change_to']}'"; $url = 'act='.REGISTRY_URL.'§ion=components&menu=makes_models&code=make_menu'; $time = 2; @@ -552,6 +564,9 @@ $this->ipsclass->DB->query("UPDATE ibf_registry_models SET $db_string WHERE id='".$this->ipsclass->input['model_id']."'"); + // Rebuild cache + $this->lib['functions']->update_makemodel_cache(); + $text = "Modified Fusion Registry Model ID: '{$this->ipsclass->input['model_id']}' to '{$this->ipsclass->input['change_to']}'"; $url = 'act='.REGISTRY_URL.'§ion=components&menu=makes_models&code=model_menu&make_id='. $this->ipsclass->input['make_id']; $time = 2; @@ -719,6 +734,9 @@ // Delete any models of this make $this->ipsclass->DB->query("DELETE FROM ibf_registry_models WHERE make_id IN $sql_make_ids"); + // Rebuild cache + $this->lib['functions']->update_makemodel_cache(); + $text = "Deleted Fusion Registry Vehicle Make '$make_to_delete' and Models"; $url = 'act='.REGISTRY_URL.'§ion=components&menu=makes_models&code=make_menu'; $time = 2; @@ -886,6 +904,9 @@ // Bye-Bye... delete the model $this->ipsclass->DB->query("DELETE FROM ibf_registry_models WHERE id IN $sql_model_ids"); + // Rebuild cache + $this->lib['functions']->update_makemodel_cache(); + $text = "Deleted Fusion Registry Vehicle Model '$model_to_delete'"; $url = 'act='.REGISTRY_URL.'§ion=components&menu=makes_models&code=model_menu&make_id='. $this->ipsclass->input['make_id']; $time = 2; Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php 2008-02-10 05:28:00 UTC (rev 33) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php 2008-02-10 07:19:03 UTC (rev 34) @@ -46,6 +46,7 @@ */ require_once( AD_REGISTRY_PATH.'ad_registry_loader.php' ); require_once( KERNEL_PATH.'class_image.php' ); +require_once( REGISTRY_PATH.'lib/functions.php' ); /**#@-*/ /** @@ -109,6 +110,10 @@ $this->db_remove_1742529(); break; + case 'rebuild_makemodel_cache': + $this->rebuild_makemodel_cache(); + break; + default: $this->main_menu(); break; @@ -401,6 +406,29 @@ /** + * Rebuild make/model cache + */ + function rebuild_makemodel_cache() + { + $registry_funcs = new registry_functions(); + $registry_funcs->ipsclass =& $this->ipsclass; + + $registry_funcs->update_makemodel_cache(); + + // Report our mischief ways :) + $text = "<b>Fusion Registry make/model cache rebuilt</b>"; + $url = "act=".REGISTRY_URL."§ion=components&menu=tools"; + $time = 5; + + // Big brother is watching :) + $this->ipsclass->admin->save_log("Rebuilt Fusion Registry make/model cache"); + + // End of the show, c'ya + $this->ipsclass->admin->redirect( $url, $text, 0, $time ); + } + + + /** * Rebuild All Thumbnails * * If the end user opted to create a log we will use function {@link _log} @@ -916,6 +944,26 @@ $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); + $this->ipsclass->html .= '<br />'; + + //------------------------------- + // Rebuild make/model cache tool + //------------------------------- + + $this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code', 'rebuild_makemodel_cache' ), + 2 => array( 'act' , REGISTRY_URL ), + 3 => array( 'menu', 'tools' ), + 4 => array( 'section', 'components' ), + ) ); + + $desc = 'The rebuild make/model cache tool will refresh the cache of all the makes and models in the database.'; + + $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Rebuild make/model cache", $desc ); + + $this->ipsclass->html .= $this->ipsclass->adskin->end_form('Rebuild make/model cache'); + + $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); + // That's all folk! $this->ipsclass->admin->output(); } Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-10 05:28:00 UTC (rev 33) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-10 07:19:03 UTC (rev 34) @@ -180,26 +180,24 @@ $return = ''; - $make_q_id = $this->ipsclass->DB->query("SELECT id, make FROM ibf_registry_makes ORDER BY make ASC"); + // Load the cache + $this->ipsclass->init_load_cache( array( 'registry_makemodel' ) ); // Loop through all the makes - while ( $make_row = $this->ipsclass->DB->fetch_row($make_q_id) ) + foreach ( $this->ipsclass->cache['registry_makemodel'] as $make_id => $make_array ) { // Start this makes' row in the output, this is where it gets confusing! - $return .= 'cars["'.$make_row['make'].'"] = new Array("'.$make_row['id'].'", new Array('; + $return .= 'cars["'.$make_array['name'].'"] = new Array("'.$make_id.'", new Array('; - $model_q_id = $this->ipsclass->DB->query("SELECT id, model FROM ibf_registry_models - WHERE make_id='".$make_row['id']."' ORDER BY model ASC"); - $model_string = ''; $model_id_string = ''; // Loop through all the models of this make - while ( $model_row = $this->ipsclass->DB->fetch_row($model_q_id) ) + foreach ( $make_array['models'] as $model_id => $model_name ) { // Create the arrays that we will use in the output - $model_string .= '"'.$model_row['model'].'",'; - $model_id_string .= '"'.$model_row['id'] .'",'; + $model_string .= '"'.$model_name.'",'; + $model_id_string .= '"'.$model_id .'",'; } // Strip off the last comma @@ -375,6 +373,40 @@ return TRUE; } + + /** + * Update/Rebuild make and model cache + * + * This gets run any time a change is made to makes/models, and + * on demand in the ACP tools. + */ + function update_makemodel_cache() + { + // Start with an empty cache + $this->ipsclass->cache['registry_makemodel'] = array(); + + // Loop through each make + $make_q_id = $this->ipsclass->DB->query("SELECT id, make FROM ibf_registry_makes"); + + // Loop through all the makes + while ( $make_row = $this->ipsclass->DB->fetch_row($make_q_id) ) + { + // Create the base make entry + $this->ipsclass->cache['registry_makemodel'][ $make_row['id'] ] = array( 'name' => $make_row['make'], + 'models' => array() ); + + $model_q_id = $this->ipsclass->DB->query("SELECT id, model FROM ibf_registry_models WHERE make_id='".$make_row['id']."'"); + + // Loop through all the models of this make + while ( $model_row = $this->ipsclass->DB->fetch_row($model_q_id) ) + { + $this->ipsclass->cache['registry_makemodel'][ $make_row['id'] ]['models'][ $model_row['id'] ] = $model_row['model']; + } + } + + // Save it back to the cache_store + $this->ipsclass->update_cache( array( 'name' => 'registry_makemodel', 'array' => 1, 'deletefirst' => 1, 'donow' => 0 ) ); + } } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-10 05:27:55
|
Revision: 33 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=33&view=rev Author: copland007 Date: 2008-02-09 21:28:00 -0800 (Sat, 09 Feb 2008) Log Message: ----------- Hide the installer/upgrader present messages when IN_DEV is set to 1. Modified Paths: -------------- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php 2008-02-09 23:56:00 UTC (rev 32) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php 2008-02-10 05:28:00 UTC (rev 33) @@ -80,8 +80,8 @@ unset($$k); } - // Installer present? - if ( @file_exists(REGISTRY_PATH.'install/index.php') ) + // Installer present? Don't show this while in DEV mode + if ( !IN_DEV && @file_exists(REGISTRY_PATH.'install/index.php') ) { if ( !@file_exists(REGISTRY_PATH.'install/install.lock') ) { @@ -93,8 +93,8 @@ } } - // Upgrader present? - if ( @file_exists(REGISTRY_PATH.'upgrade/index.php') ) + // Upgrader present? Don't show this while in DEV mode + if ( !IN_DEV && @file_exists(REGISTRY_PATH.'upgrade/index.php') ) { if ( !@file_exists(REGISTRY_PATH.'upgrade/upgrade.lock') ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-09 23:55:57
|
Revision: 32 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=32&view=rev Author: copland007 Date: 2008-02-09 15:56:00 -0800 (Sat, 09 Feb 2008) Log Message: ----------- Pickup merge from trunk r25:31 Modified Paths: -------------- branches/stable_3_0_x/ipb_skin-fusionregistry.xml.gz branches/stable_3_0_x/upload/cache/lang_cache/en/lang_registry.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/install/sql/inserts.sql.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/core.php branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/version_history.php Added Paths: ----------- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/version_upgrade.php Removed Paths: ------------- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/version_upgrade.php Modified: branches/stable_3_0_x/ipb_skin-fusionregistry.xml.gz =================================================================== (Binary files differ) Modified: branches/stable_3_0_x/upload/cache/lang_cache/en/lang_registry.php =================================================================== --- branches/stable_3_0_x/upload/cache/lang_cache/en/lang_registry.php 2008-02-04 05:48:50 UTC (rev 31) +++ branches/stable_3_0_x/upload/cache/lang_cache/en/lang_registry.php 2008-02-09 23:56:00 UTC (rev 32) @@ -63,10 +63,10 @@ manage_vehicle => "Manage <{R_ITEM}>", search_form => "Search Form", guest_book_empty => "There are currently no comments in this guestbook, be the first to leave a message below!", - pm_notify_subject => "<#FROM_MEMBER#> has signed your registry guestbook", - pm_notify_text => "This is an automated message from the Registry.\n\n<#FROM_MEMBER#> has added a comment to your registry guestbook!\n\n[URL=<#GUESTBOOK_LINK#>]Click here[/URL] to view your registry guestbook.", + pm_notify_subject => "<#FROM_MEMBER#> has signed your <{R_NAME}> guestbook", + pm_notify_text => "This is an automated message from the <{R_NAME}>.\n\n<#FROM_MEMBER#> has added a comment to your <{R_NAME}> guestbook!\n\n[URL=<#GUESTBOOK_LINK#>]Click here[/URL] to view your <{R_NAME}> guestbook.", guestbook_pm_notify => "PM Guestbook Notifications?", - guestbook_pm_notify_explain => "Check this to receive a PM when someone signs your registry guestbook.", + guestbook_pm_notify_explain => "Check this to receive a PM when someone signs your <{R_NAME}> guestbook.", error_comment_empty => "You must enter a message to post!", Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php 2008-02-04 05:48:50 UTC (rev 31) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php 2008-02-09 23:56:00 UTC (rev 32) @@ -225,7 +225,7 @@ $this->ipsclass->adskin->form_input('year_start', $this->registry_config['year_start']), ) ); - $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Year Range Ending Offset</b><div style='color:gray'>This is the amount of years offset from the current year for the latest year you want to appear as a selection for a the 'year' special custom field. If set to a positive integer the amount will be added to the current year, and if you set this to a negative integer the amount will be subtracted from the current year. Default is to offset positive 1 since model year numbers are usually one year ahead current year.</div>", + $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Year Range Ending Offset</b><div style='color:gray'>This is the amount of years offset from the current year for the latest year you want to appear as a selection for the 'year' special custom field. If set to a positive integer the amount will be added to the current year, and if you set this to a negative integer the amount will be subtracted from the current year. Default is to offset positive 1 since model year numbers are usually one year ahead current year.</div>", $this->ipsclass->adskin->form_input('year_end', $this->registry_config['year_end']), ) ); @@ -280,7 +280,7 @@ $this->ipsclass->adskin->form_yes_no('enable_featured_item', $this->registry_config['enable_featured_item']), ) ); - $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Item ID</b><div style='color:gray'>Enter the Item ID to feature.</div>", + $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Featured Item ID</b><div style='color:gray'>Enter the Item ID to feature.</div>", $this->ipsclass->adskin->form_input('featured_item_id', $this->registry_config['featured_item_id']).'<br />'. $this->ipsclass->adskin->form_checkbox('featured_item_random', $this->registry_config['featured_item_random'], '1'). ' Random? '. $this->ipsclass->adskin->form_checkbox('featured_item_only_image', $this->registry_config['featured_item_only_image'], '1'). ' Only items with highlight images?', Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php 2008-02-04 05:48:50 UTC (rev 31) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php 2008-02-09 23:56:00 UTC (rev 32) @@ -53,8 +53,8 @@ /**#@+ @var string */ var $base_url; - var $r_version_short = 'v3.0.4'; - var $r_version_long = '30004'; + var $r_version_short = 'v3.0.5'; + var $r_version_long = '30005'; /**#@-*/ /** @var object */ Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php 2008-02-04 05:48:50 UTC (rev 31) +++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_tools.php 2008-02-09 23:56:00 UTC (rev 32) @@ -101,6 +101,14 @@ $this->orphan_remove(); break; + case 'db_search_1742529': + $this->db_search_1742529(); + break; + + case 'db_remove_1742529': + $this->db_remove_1742529(); + break; + default: $this->main_menu(); break; @@ -109,6 +117,133 @@ /** + * Find those duplicate ibf_registry_field_entry rows! + * + * Basic chain of events are to loop through the field_entry table + * for each item_id, then loop through each set of entry_id and + * field_id for that item. Find the largest value entry_id, mark the + * rest for removal. + */ + function db_search_1742529() + { + $marked_for_death = $this->execute_db_search_1742529(); + + //------------------------------- + // Construct menu HTML + //------------------------------- + + $this->ipsclass->html .= $this->ipsclass->skin_acp_global->information_box( "Fusion Registry Duplicate Row Locator", "Below are all the duplicate rows in the ibf_registry_field_entry table that were found.<br /><br />". $this->ad_registry_loader->imgs['warning'] ." <b>This operation is not undo-able! Once you choose to remove these duplicate rows they will be gone, please make a backup of your ibf_registry_field_entries sql table before proceeding!!</b>".'<br /> ' ) . "<br >"; + + $this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code', 'db_remove_1742529' ), + 2 => array( 'act' , REGISTRY_URL ), + 3 => array( 'menu', 'tools' ), + 4 => array( 'section', 'components' ), + ) ); + + $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Duplicate ibf_registry_field_entry rows to be deleted" ); + + // If they don't have any, let them know + if ( count($marked_for_death) <= 0 ) + { + $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Congratulations! You have no duplicate rows to clean up!" ) ); + } + else + { + // Otherwise print them all out baby! + $list_html = join(', ', $marked_for_death); + + $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( $list_html ) ); + } + + $this->ipsclass->html .= $this->ipsclass->adskin->end_form('Remove '. count($marked_for_death) .' Duplicate Rows'); + + $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); + + $this->ipsclass->admin->output(); + } + + + /** + * Do the actual removal of dup entries + */ + function db_remove_1742529() + { + $output = array(); + + $marked_for_death = $this->execute_db_search_1742529(); + + // If we don't get anything in our returned array, there's nothing to do ;) + if ( count($marked_for_death) > 0 ) + { + $rm_list = join("','", $marked_for_death); + $this->ipsclass->DB->simple_exec_query( array( 'delete' => 'registry_field_entries', 'where' => "entry_id IN ( '$rm_list' )" ) ); + + // Report our mischief ways :) + $text = "<b>Duplicate rows removed</b><br /><br />".implode( "<br />", $output ); + $url = "act=".REGISTRY_URL."§ion=components&menu=tools"; + $time = 5; + + // Big brother is watching :) + $this->ipsclass->admin->save_log("Removed Duplicate Fusion Registry sql field_entries"); + } + else + { + $text = "<b>No duplicate rows were found, therefore none were removed ;)</b>"; + $url = "act=".REGISTRY_URL."§ion=components&menu=tools"; + $time = 5; + } + + // End of the show, c'ya + $this->ipsclass->admin->redirect( $url, $text, 0, $time ); + } + + + /** + * Helper function to search for dup entries in field_entries table + */ + function execute_db_search_1742529() + { + $marked_for_death = array(); + + // Loop through for each item + $item_query_id = $this->ipsclass->DB->query("SELECT DISTINCT (item_id) FROM ibf_registry_field_entries"); + while ( $item_row = $this->ipsclass->DB->fetch_row($item_query_id) ) + { + $dup_rows = array(); // Bad boy rows marked for death + $max_rows = array(); // Keep track of max values (valid rows) + + $entry_query_id = $this->ipsclass->DB->query("SELECT entry_id,field_id FROM ibf_registry_field_entries WHERE item_id='$item_row[item_id]'"); + + // Loop through each entry_id for each item_id + while ( $entry_row = $this->ipsclass->DB->fetch_row($entry_query_id) ) + { + if ( isset( $max_rows[$entry_row[field_id]] ) ) { + if ( $entry_row[entry_id] > $max_rows[$entry_row[field_id]] ) + { + // This looks better, keep it, mark the last known max for death + array_push($dup_rows, $max_rows[$entry_row[field_id]]); + $max_rows[$entry_row[field_id]] = $entry_row[entry_id]; + } + } + else + { + // There isn't a max row set yet, so set it now + $max_rows[$entry_row[field_id]] = $entry_row[entry_id]; + } + } + + // Push to big array + foreach ($dup_rows as $dup_id) + { + array_push($marked_for_death, $dup_id); + } + } + + return $marked_for_death; + } + + + /** * Find those Orphans! * * Basic chain of events are to compare all the known file names @@ -761,6 +896,26 @@ $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); + $this->ipsclass->html .= '<br />'; + + //------------------------------- + // Find/Remove Duplicate DB records from bug #1742529 + //------------------------------- + + $this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code', 'db_search_1742529' ), + 2 => array( 'act' , REGISTRY_URL ), + 3 => array( 'menu', 'tools' ), + 4 => array( 'section', 'components' ), + ) ); + + $desc = 'The \'Cleanup Database - bug #1742529 fix\' tool is used to locate any duplicate rows in the ibf_registry_field_entries that the Fusion Registry had once created. The duplicate rows were created as the result of a bug in the code that was present until version 3.0.5. Under normal circumstances there should be no duplicate rows.<br /><br />The first step of this tool is just to search for duplicate rows, no action will be taken unless you confirm the findings on the next step.'; + + $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Cleanup Database - bug #1742529 fix", $desc ); + + $this->ipsclass->html .= $this->ipsclass->adskin->end_form('Search for Duplicate Rows'); + + $this->ipsclass->html .= $this->ipsclass->adskin->end_table(); + // That's all folk! $this->ipsclass->admin->output(); } Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/install/sql/inserts.sql.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/install/sql/inserts.sql.php 2008-02-04 05:48:50 UTC (rev 31) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/install/sql/inserts.sql.php 2008-02-09 23:56:00 UTC (rev 32) @@ -2,5 +2,5 @@ INSERT INTO `ibf_registry_config` VALUES ('convert_path', '/usr/bin/convert'); INSERT INTO `ibf_registry_config` VALUES ('convert_options', '-antialias +profile "*"'); INSERT INTO `ibf_registry_config` VALUES ('date_format', 'm-j-y H:i'); -INSERT INTO `ibf_registry_config` VALUES ('version_long', '30004'); -INSERT INTO `ibf_registry_config` VALUES ('version_short', 'v3.0.4'); \ No newline at end of file +INSERT INTO `ibf_registry_config` VALUES ('version_long', '30005'); +INSERT INTO `ibf_registry_config` VALUES ('version_short', 'v3.0.5'); \ No newline at end of file Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/core.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/core.php 2008-02-04 05:48:50 UTC (rev 31) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/core.php 2008-02-09 23:56:00 UTC (rev 32) @@ -59,8 +59,8 @@ var $class = ""; /** @var string */ - var $r_version_short = 'v3.0.4'; - var $r_version_long = '30004'; + var $r_version_short = 'v3.0.5'; + var $r_version_long = '30005'; var $r_session = ""; /**#@-*/ Copied: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005 (from rev 31, trunk/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005) Deleted: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/version_upgrade.php =================================================================== --- trunk/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/version_upgrade.php 2008-02-04 05:48:50 UTC (rev 31) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/version_upgrade.php 2008-02-09 23:56:00 UTC (rev 32) @@ -1,144 +0,0 @@ -<?php -/*-------------------------------------------------------------------------\ -| -| ======================================================== -| Fusion Registry GPL -| Copyright (C) 2007 Fusion Scripts -| -| This program is free software; you can redistribute it and/or -| modify it under the terms of the GNU General Public License -| as published by the Free Software Foundation; either version 2 -| of the License, or (at your option) any later version. -| -| This program is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -| GNU General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with this program; if not, write to the Free Software -| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -| ======================================================== -| -| Email: in...@fu... -| Web-Site: http://www.fusionscripts.com/ -| -| $Id$ -| -\-------------------------------------------------------------------------*/ - -/** - * Installation template class - * - * @package Fusion Registry - * @subpackage installer - * @version $Id$ - */ -if ( ! defined( 'IN_IPB' ) ) -{ - print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files."; - exit(); -} - -class version_upgrade -{ - var $ipsclass; - var $instagrade; - var $this_version = '30005'; - var $upgrade_from = '30004'; - var $base_url = ''; - var $mod_to_run = ''; - - - /** - * Generate the upgrades to happen string - */ - function version_process() - { - $this->base_url = "index.php?act=kit"; - - if ( is_array( $this->instagrade->modules_to_run ) and count( $this->instagrade->modules_to_run ) ) - { - $tmp = array_shift( $this->instagrade->modules_to_run ); - - $this->mod_to_run = implode( ', ', $this->instagrade->modules_to_run ); - } - - if ( ! $this->mod_to_run ) - { - $this->mod_to_run = 'None'; - } - } - - - /** - * Oh how we love to upgrade! - */ - function auto_run() - { - switch( $this->ipsclass->input['kitact'] ) - { - case 'cleanup': - $this->do_cleanup(); - break; - - default: - $this->upgrade_kit_intro(); - break; - } - } - - - - /** - * Only thing we need to do is update the DB version - */ - function do_cleanup() - { - $executed = 0; - - // Update the database version strings - $vers = array( 'version_long' => $this->this_version, - 'version_short' => 'v3.0.5' ); - - foreach ( $vers as $name => $value ) - { - $db_string = $this->ipsclass->DB->compile_db_update_string( array( 'config_name' => $name, - 'config_value' => $value - ) ); - - $this->ipsclass->DB->query( "UPDATE ".$this->ipsclass->vars['sql_tbl_prefix']."registry_config SET $db_string ". - "WHERE config_name='$name'" ); - - $executed++; - } - - - // All done - $this->instagrade->redirect( "index.php?act=done", "Cleanup complete, $executed queries run...." ); - } - - - /** - * Print intro - */ - function upgrade_kit_intro() - { - $this->ipsclass->template->print_header(); - - $this->ipsclass->template->contents .= <<<HTML -This upgrade kit will upgrade you from <b>"{$this->instagrade->version_history[$this->upgrade_from]}"</b> to <b>"{$this->instagrade->version_history[$this->this_version]}"</b> -<br /> -<br /> -<div align='center'><a href="{$this->base_url}&kitact=cleanup" class='button' style='color: #003366'>Continue >></a></div> -<br /> -<br /> -<div align='center'>Upgrade kits still to run after this upgrade: {$this->mod_to_run}</div> -HTML; - - $this->ipsclass->template->output(); - } - -} - -?> \ No newline at end of file Copied: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/version_upgrade.php (from rev 31, trunk/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/version_upgrade.php) =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/version_upgrade.php (rev 0) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/version_upgrade.php 2008-02-09 23:56:00 UTC (rev 32) @@ -0,0 +1,144 @@ +<?php +/*-------------------------------------------------------------------------\ +| +| ======================================================== +| Fusion Registry GPL +| Copyright (C) 2007 Fusion Scripts +| +| This program is free software; you can redistribute it and/or +| modify it under the terms of the GNU General Public License +| as published by the Free Software Foundation; either version 2 +| of the License, or (at your option) any later version. +| +| This program is distributed in the hope that it will be useful, +| but WITHOUT ANY WARRANTY; without even the implied warranty of +| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +| GNU General Public License for more details. +| +| You should have received a copy of the GNU General Public License +| along with this program; if not, write to the Free Software +| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +| ======================================================== +| +| Email: in...@fu... +| Web-Site: http://www.fusionscripts.com/ +| +| $Id$ +| +\-------------------------------------------------------------------------*/ + +/** + * Installation template class + * + * @package Fusion Registry + * @subpackage installer + * @version $Id$ + */ +if ( ! defined( 'IN_IPB' ) ) +{ + print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files."; + exit(); +} + +class version_upgrade +{ + var $ipsclass; + var $instagrade; + var $this_version = '30005'; + var $upgrade_from = '30004'; + var $base_url = ''; + var $mod_to_run = ''; + + + /** + * Generate the upgrades to happen string + */ + function version_process() + { + $this->base_url = "index.php?act=kit"; + + if ( is_array( $this->instagrade->modules_to_run ) and count( $this->instagrade->modules_to_run ) ) + { + $tmp = array_shift( $this->instagrade->modules_to_run ); + + $this->mod_to_run = implode( ', ', $this->instagrade->modules_to_run ); + } + + if ( ! $this->mod_to_run ) + { + $this->mod_to_run = 'None'; + } + } + + + /** + * Oh how we love to upgrade! + */ + function auto_run() + { + switch( $this->ipsclass->input['kitact'] ) + { + case 'cleanup': + $this->do_cleanup(); + break; + + default: + $this->upgrade_kit_intro(); + break; + } + } + + + + /** + * Only thing we need to do is update the DB version + */ + function do_cleanup() + { + $executed = 0; + + // Update the database version strings + $vers = array( 'version_long' => $this->this_version, + 'version_short' => 'v3.0.5' ); + + foreach ( $vers as $name => $value ) + { + $db_string = $this->ipsclass->DB->compile_db_update_string( array( 'config_name' => $name, + 'config_value' => $value + ) ); + + $this->ipsclass->DB->query( "UPDATE ".$this->ipsclass->vars['sql_tbl_prefix']."registry_config SET $db_string ". + "WHERE config_name='$name'" ); + + $executed++; + } + + + // All done + $this->instagrade->redirect( "index.php?act=done", "Cleanup complete, $executed queries run...." ); + } + + + /** + * Print intro + */ + function upgrade_kit_intro() + { + $this->ipsclass->template->print_header(); + + $this->ipsclass->template->contents .= <<<HTML +This upgrade kit will upgrade you from <b>"{$this->instagrade->version_history[$this->upgrade_from]}"</b> to <b>"{$this->instagrade->version_history[$this->this_version]}"</b> +<br /> +<br /> +<div align='center'><a href="{$this->base_url}&kitact=cleanup" class='button' style='color: #003366'>Continue >></a></div> +<br /> +<br /> +<div align='center'>Upgrade kits still to run after this upgrade: {$this->mod_to_run}</div> +HTML; + + $this->ipsclass->template->output(); + } + +} + +?> \ No newline at end of file Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/version_history.php =================================================================== --- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/version_history.php 2008-02-04 05:48:50 UTC (rev 31) +++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/version_history.php 2008-02-09 23:56:00 UTC (rev 32) @@ -8,6 +8,7 @@ '30002' => 'Fusion Registry v3.0.2 Final', '30003' => 'Fusion Registry v3.0.3', '30004' => 'Fusion Registry v3.0.4', + '30005' => 'Fusion Registry v3.0.5', ); ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-04 05:48:49
|
Revision: 31 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=31&view=rev Author: copland007 Date: 2008-02-03 21:48:50 -0800 (Sun, 03 Feb 2008) Log Message: ----------- Fix bug# 1748687, replace hardcoded "registry" with <{R_NAME}> Modified Paths: -------------- trunk/upload/cache/lang_cache/en/lang_registry.php Modified: trunk/upload/cache/lang_cache/en/lang_registry.php =================================================================== --- trunk/upload/cache/lang_cache/en/lang_registry.php 2008-02-04 05:44:49 UTC (rev 30) +++ trunk/upload/cache/lang_cache/en/lang_registry.php 2008-02-04 05:48:50 UTC (rev 31) @@ -63,10 +63,10 @@ manage_vehicle => "Manage <{R_ITEM}>", search_form => "Search Form", guest_book_empty => "There are currently no comments in this guestbook, be the first to leave a message below!", - pm_notify_subject => "<#FROM_MEMBER#> has signed your registry guestbook", - pm_notify_text => "This is an automated message from the Registry.\n\n<#FROM_MEMBER#> has added a comment to your registry guestbook!\n\n[URL=<#GUESTBOOK_LINK#>]Click here[/URL] to view your registry guestbook.", + pm_notify_subject => "<#FROM_MEMBER#> has signed your <{R_NAME}> guestbook", + pm_notify_text => "This is an automated message from the <{R_NAME}>.\n\n<#FROM_MEMBER#> has added a comment to your <{R_NAME}> guestbook!\n\n[URL=<#GUESTBOOK_LINK#>]Click here[/URL] to view your <{R_NAME}> guestbook.", guestbook_pm_notify => "PM Guestbook Notifications?", - guestbook_pm_notify_explain => "Check this to receive a PM when someone signs your registry guestbook.", + guestbook_pm_notify_explain => "Check this to receive a PM when someone signs your <{R_NAME}> guestbook.", error_comment_empty => "You must enter a message to post!", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-04 05:44:44
|
Revision: 30 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=30&view=rev Author: copland007 Date: 2008-02-03 21:44:49 -0800 (Sun, 03 Feb 2008) Log Message: ----------- Minor text changes to ACP config page for readability. Modified Paths: -------------- trunk/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php Modified: trunk/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php =================================================================== --- trunk/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php 2008-02-04 05:27:10 UTC (rev 29) +++ trunk/upload/sources/components_acp/fusionscripts/fusionregistry/ad_config.php 2008-02-04 05:44:49 UTC (rev 30) @@ -225,7 +225,7 @@ $this->ipsclass->adskin->form_input('year_start', $this->registry_config['year_start']), ) ); - $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Year Range Ending Offset</b><div style='color:gray'>This is the amount of years offset from the current year for the latest year you want to appear as a selection for a the 'year' special custom field. If set to a positive integer the amount will be added to the current year, and if you set this to a negative integer the amount will be subtracted from the current year. Default is to offset positive 1 since model year numbers are usually one year ahead current year.</div>", + $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Year Range Ending Offset</b><div style='color:gray'>This is the amount of years offset from the current year for the latest year you want to appear as a selection for the 'year' special custom field. If set to a positive integer the amount will be added to the current year, and if you set this to a negative integer the amount will be subtracted from the current year. Default is to offset positive 1 since model year numbers are usually one year ahead current year.</div>", $this->ipsclass->adskin->form_input('year_end', $this->registry_config['year_end']), ) ); @@ -280,7 +280,7 @@ $this->ipsclass->adskin->form_yes_no('enable_featured_item', $this->registry_config['enable_featured_item']), ) ); - $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Item ID</b><div style='color:gray'>Enter the Item ID to feature.</div>", + $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Featured Item ID</b><div style='color:gray'>Enter the Item ID to feature.</div>", $this->ipsclass->adskin->form_input('featured_item_id', $this->registry_config['featured_item_id']).'<br />'. $this->ipsclass->adskin->form_checkbox('featured_item_random', $this->registry_config['featured_item_random'], '1'). ' Random? '. $this->ipsclass->adskin->form_checkbox('featured_item_only_image', $this->registry_config['featured_item_only_image'], '1'). ' Only items with highlight images?', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-04 05:27:05
|
Revision: 29 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=29&view=rev Author: copland007 Date: 2008-02-03 21:27:10 -0800 (Sun, 03 Feb 2008) Log Message: ----------- Merged fix from stable_3_0_x to trunk. Modified Paths: -------------- trunk/upload/sources/components_public/fusionscripts/fusionregistry/item.php Modified: trunk/upload/sources/components_public/fusionscripts/fusionregistry/item.php =================================================================== --- trunk/upload/sources/components_public/fusionscripts/fusionregistry/item.php 2008-02-04 04:54:13 UTC (rev 28) +++ trunk/upload/sources/components_public/fusionscripts/fusionregistry/item.php 2008-02-04 05:27:10 UTC (rev 29) @@ -400,7 +400,7 @@ $existing = $this->ipsclass->DB->fetch_row($rs); - if ( defined($existing['entry_id']) and !empty($existing['entry_id']) ) + if ( isset($existing['entry_id']) and !empty($existing['entry_id']) ) { // Update existing entry $db_string = $this->ipsclass->DB->compile_db_update_string( array( 'field_id' => $cf_id, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-04 04:54:08
|
Revision: 28 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=28&view=rev Author: copland007 Date: 2008-02-03 20:54:13 -0800 (Sun, 03 Feb 2008) Log Message: ----------- Update version number, add 3.0.4 to 3.0.5 upgrade kit. Modified Paths: -------------- trunk/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php trunk/upload/sources/components_public/fusionscripts/fusionregistry/install/sql/inserts.sql.php trunk/upload/sources/components_public/fusionscripts/fusionregistry/lib/core.php trunk/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/version_history.php Added Paths: ----------- trunk/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/ trunk/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/version_upgrade.php Modified: trunk/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php =================================================================== --- trunk/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php 2008-02-04 04:52:04 UTC (rev 27) +++ trunk/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php 2008-02-04 04:54:13 UTC (rev 28) @@ -53,8 +53,8 @@ /**#@+ @var string */ var $base_url; - var $r_version_short = 'v3.0.4'; - var $r_version_long = '30004'; + var $r_version_short = 'v3.0.5'; + var $r_version_long = '30005'; /**#@-*/ /** @var object */ Modified: trunk/upload/sources/components_public/fusionscripts/fusionregistry/install/sql/inserts.sql.php =================================================================== --- trunk/upload/sources/components_public/fusionscripts/fusionregistry/install/sql/inserts.sql.php 2008-02-04 04:52:04 UTC (rev 27) +++ trunk/upload/sources/components_public/fusionscripts/fusionregistry/install/sql/inserts.sql.php 2008-02-04 04:54:13 UTC (rev 28) @@ -2,5 +2,5 @@ INSERT INTO `ibf_registry_config` VALUES ('convert_path', '/usr/bin/convert'); INSERT INTO `ibf_registry_config` VALUES ('convert_options', '-antialias +profile "*"'); INSERT INTO `ibf_registry_config` VALUES ('date_format', 'm-j-y H:i'); -INSERT INTO `ibf_registry_config` VALUES ('version_long', '30004'); -INSERT INTO `ibf_registry_config` VALUES ('version_short', 'v3.0.4'); \ No newline at end of file +INSERT INTO `ibf_registry_config` VALUES ('version_long', '30005'); +INSERT INTO `ibf_registry_config` VALUES ('version_short', 'v3.0.5'); \ No newline at end of file Modified: trunk/upload/sources/components_public/fusionscripts/fusionregistry/lib/core.php =================================================================== --- trunk/upload/sources/components_public/fusionscripts/fusionregistry/lib/core.php 2008-02-04 04:52:04 UTC (rev 27) +++ trunk/upload/sources/components_public/fusionscripts/fusionregistry/lib/core.php 2008-02-04 04:54:13 UTC (rev 28) @@ -59,8 +59,8 @@ var $class = ""; /** @var string */ - var $r_version_short = 'v3.0.4'; - var $r_version_long = '30004'; + var $r_version_short = 'v3.0.5'; + var $r_version_long = '30005'; var $r_session = ""; /**#@-*/ Added: trunk/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/version_upgrade.php =================================================================== --- trunk/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/version_upgrade.php (rev 0) +++ trunk/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/version_upgrade.php 2008-02-04 04:54:13 UTC (rev 28) @@ -0,0 +1,144 @@ +<?php +/*-------------------------------------------------------------------------\ +| +| ======================================================== +| Fusion Registry GPL +| Copyright (C) 2007 Fusion Scripts +| +| This program is free software; you can redistribute it and/or +| modify it under the terms of the GNU General Public License +| as published by the Free Software Foundation; either version 2 +| of the License, or (at your option) any later version. +| +| This program is distributed in the hope that it will be useful, +| but WITHOUT ANY WARRANTY; without even the implied warranty of +| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +| GNU General Public License for more details. +| +| You should have received a copy of the GNU General Public License +| along with this program; if not, write to the Free Software +| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +| ======================================================== +| +| Email: in...@fu... +| Web-Site: http://www.fusionscripts.com/ +| +| $Id$ +| +\-------------------------------------------------------------------------*/ + +/** + * Installation template class + * + * @package Fusion Registry + * @subpackage installer + * @version $Id$ + */ +if ( ! defined( 'IN_IPB' ) ) +{ + print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files."; + exit(); +} + +class version_upgrade +{ + var $ipsclass; + var $instagrade; + var $this_version = '30005'; + var $upgrade_from = '30004'; + var $base_url = ''; + var $mod_to_run = ''; + + + /** + * Generate the upgrades to happen string + */ + function version_process() + { + $this->base_url = "index.php?act=kit"; + + if ( is_array( $this->instagrade->modules_to_run ) and count( $this->instagrade->modules_to_run ) ) + { + $tmp = array_shift( $this->instagrade->modules_to_run ); + + $this->mod_to_run = implode( ', ', $this->instagrade->modules_to_run ); + } + + if ( ! $this->mod_to_run ) + { + $this->mod_to_run = 'None'; + } + } + + + /** + * Oh how we love to upgrade! + */ + function auto_run() + { + switch( $this->ipsclass->input['kitact'] ) + { + case 'cleanup': + $this->do_cleanup(); + break; + + default: + $this->upgrade_kit_intro(); + break; + } + } + + + + /** + * Only thing we need to do is update the DB version + */ + function do_cleanup() + { + $executed = 0; + + // Update the database version strings + $vers = array( 'version_long' => $this->this_version, + 'version_short' => 'v3.0.5' ); + + foreach ( $vers as $name => $value ) + { + $db_string = $this->ipsclass->DB->compile_db_update_string( array( 'config_name' => $name, + 'config_value' => $value + ) ); + + $this->ipsclass->DB->query( "UPDATE ".$this->ipsclass->vars['sql_tbl_prefix']."registry_config SET $db_string ". + "WHERE config_name='$name'" ); + + $executed++; + } + + + // All done + $this->instagrade->redirect( "index.php?act=done", "Cleanup complete, $executed queries run...." ); + } + + + /** + * Print intro + */ + function upgrade_kit_intro() + { + $this->ipsclass->template->print_header(); + + $this->ipsclass->template->contents .= <<<HTML +This upgrade kit will upgrade you from <b>"{$this->instagrade->version_history[$this->upgrade_from]}"</b> to <b>"{$this->instagrade->version_history[$this->this_version]}"</b> +<br /> +<br /> +<div align='center'><a href="{$this->base_url}&kitact=cleanup" class='button' style='color: #003366'>Continue >></a></div> +<br /> +<br /> +<div align='center'>Upgrade kits still to run after this upgrade: {$this->mod_to_run}</div> +HTML; + + $this->ipsclass->template->output(); + } + +} + +?> \ No newline at end of file Property changes on: trunk/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30005/version_upgrade.php ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Modified: trunk/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/version_history.php =================================================================== --- trunk/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/version_history.php 2008-02-04 04:52:04 UTC (rev 27) +++ trunk/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/version_history.php 2008-02-04 04:54:13 UTC (rev 28) @@ -8,6 +8,7 @@ '30002' => 'Fusion Registry v3.0.2 Final', '30003' => 'Fusion Registry v3.0.3', '30004' => 'Fusion Registry v3.0.4', + '30005' => 'Fusion Registry v3.0.5', ); ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SVN c. <fus...@li...> - 2008-02-04 04:52:04
|
Revision: 27 http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=27&view=rev Author: copland007 Date: 2008-02-03 20:52:04 -0800 (Sun, 03 Feb 2008) Log Message: ----------- Update version number, no skin changes. Modified Paths: -------------- trunk/ipb_skin-fusionregistry.xml.gz Modified: trunk/ipb_skin-fusionregistry.xml.gz =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |