Thread: [fusionregistry-commitlog] SF.net SVN: fusionregistry: [18] branches/stable_3_0_x
Brought to you by:
copland007
|
From: SVN c. <fus...@li...> - 2007-06-19 03:42:45
|
Revision: 18
http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=18&view=rev
Author: copland007
Date: 2007-06-18 20:42:46 -0700 (Mon, 18 Jun 2007)
Log Message:
-----------
Update version number to 3.0.4
Modified Paths:
--------------
branches/stable_3_0_x/fusionregistry_component.xml
branches/stable_3_0_x/ipb_skin-fusionregistry.xml.gz
branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php
branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/install/index.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_30004/
branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30004/version_upgrade.php
Modified: branches/stable_3_0_x/fusionregistry_component.xml
===================================================================
--- branches/stable_3_0_x/fusionregistry_component.xml 2007-06-19 03:34:29 UTC (rev 17)
+++ branches/stable_3_0_x/fusionregistry_component.xml 2007-06-19 03:42:46 UTC (rev 18)
@@ -6,7 +6,7 @@
<com_title>Fusion Registry</com_title>
<com_author>Fusion Scripts</com_author>
<com_url>http://www.fusionscripts.com</com_url>
- <com_version>3.0.3</com_version>
+ <com_version>3.0.4</com_version>
<com_date_added>1181093473</com_date_added>
<com_menu_data><![CDATA[a:7:{i:1;a:5:{s:9:"menu_text";s:13:"Configuration";s:8:"menu_url";s:11:"menu=config";s:13:"menu_redirect";i:0;s:12:"menu_permbit";s:6:"config";s:13:"menu_permlang";s:29:"Allow ACCESS to configuration";}i:11;a:5:{s:9:"menu_text";s:13:"Custom Fields";s:8:"menu_url";s:18:"menu=custom_fields";s:13:"menu_redirect";i:0;s:12:"menu_permbit";s:13:"custom_fields";s:13:"menu_permlang";s:29:"Allow ACCESS to custom fields";}i:111;a:5:{s:9:"menu_text";s:13:"Rating Fields";s:8:"menu_url";s:18:"menu=rating_fields";s:13:"menu_redirect";i:0;s:12:"menu_permbit";s:13:"rating_fields";s:13:"menu_permlang";s:29:"Allow ACCESS to rating fields";}i:1111;a:5:{s:9:"menu_text";s:18:"Makes & Models";s:8:"menu_url";s:17:"menu=makes_models";s:13:"menu_redirect";i:0;s:12:"menu_permbit";s:12:"makes_models";s:13:"menu_permlang";s:34:"Allow ACCESS to makes & models";}i:11111;a:5:{s:9:"menu_text";s:23:"Modification Categories";s:8:"menu_url";s:15:"menu=categories";s:13:"menu_redirect";i:0;s:12:"menu_permbit";s:10:"categories";s:13:"menu_permlang";s:39:"Allow ACCESS to modification categories";}i:111111;a:5:{s:9:"menu_text";s:11:"Permissions";s:8:"menu_url";s:16:"menu=permissions";s:13:"menu_redirect";i:0;s:12:"menu_permbit";s:11:"permissions";s:13:"menu_permlang";s:27:"Allow ACCESS to permissions";}i:1111111;a:5:{s:9:"menu_text";s:5:"Tools";s:8:"menu_url";s:10:"menu=tools";s:13:"menu_redirect";i:0;s:12:"menu_permbit";s:5:"tools";s:13:"menu_permlang";s:21:"Allow ACCESS to tools";}}]]></com_menu_data>
<com_enabled>1</com_enabled>
Modified: branches/stable_3_0_x/ipb_skin-fusionregistry.xml.gz
===================================================================
(Binary files differ)
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 2007-06-19 03:34:29 UTC (rev 17)
+++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_registry_loader.php 2007-06-19 03:42:46 UTC (rev 18)
@@ -53,8 +53,8 @@
/**#@+ @var string */
var $base_url;
- var $r_version_short = 'v3.0.3';
- var $r_version_long = '30003';
+ var $r_version_short = 'v3.0.4';
+ var $r_version_long = '30004';
/**#@-*/
/** @var object */
Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/install/index.php
===================================================================
--- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/install/index.php 2007-06-19 03:34:29 UTC (rev 17)
+++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/install/index.php 2007-06-19 03:42:46 UTC (rev 18)
@@ -42,8 +42,8 @@
define( 'INS_ROOT_PATH', '../../../../../' );
define( 'INS_KERNEL_PATH', INS_ROOT_PATH.'ips_kernel/' );
-define( 'FR_VERSION_SHORT', 'v3.0.3' );
-define( 'FR_VERSION_LONG', '30003' );
+define( 'FR_VERSION_SHORT', 'v3.0.4' );
+define( 'FR_VERSION_LONG', '30004' );
require './template.php';
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 2007-06-19 03:34:29 UTC (rev 17)
+++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/install/sql/inserts.sql.php 2007-06-19 03:42:46 UTC (rev 18)
@@ -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', '30003');
-INSERT INTO `ibf_registry_config` VALUES ('version_short', 'v3.0.3');
\ No newline at end of file
+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
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 2007-06-19 03:34:29 UTC (rev 17)
+++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/core.php 2007-06-19 03:42:46 UTC (rev 18)
@@ -59,8 +59,8 @@
var $class = "";
/** @var string */
- var $r_version_short = 'v3.0.3';
- var $r_version_long = '30003';
+ var $r_version_short = 'v3.0.4';
+ var $r_version_long = '30004';
var $r_session = "";
/**#@-*/
Added: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30004/version_upgrade.php
===================================================================
--- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30004/version_upgrade.php (rev 0)
+++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30004/version_upgrade.php 2007-06-19 03:42:46 UTC (rev 18)
@@ -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 = '30004';
+ var $upgrade_from = '30003';
+ 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.4' );
+
+ 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: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/upgrade_30004/version_upgrade.php
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
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 2007-06-19 03:34:29 UTC (rev 17)
+++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/upgrade/version_history.php 2007-06-19 03:42:46 UTC (rev 18)
@@ -7,6 +7,7 @@
'30001' => 'Fusion Registry v3.0.1 Final',
'30002' => 'Fusion Registry v3.0.2 Final',
'30003' => 'Fusion Registry v3.0.3',
+ '30004' => 'Fusion Registry v3.0.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-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-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 =...
[truncated message content] |