git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4874 709f56b5-9817-0410-a4d7...
authorKasper Skårhøj <kasper@typo3.org>
Tue, 27 Jan 2009 15:21:12 +0000 (15:21 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Tue, 27 Jan 2009 15:21:12 +0000 (15:21 +0000)
ChangeLog
t3lib/class.t3lib_befunc.php

index 7885276..bc11ec5 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,13 @@
 2009-01-27     Kasper Sk\8crh¿j  <kasper@typo3.org>
 
+       * selectVersionsOfRecord() has been optimized. It will give a significant speed boost for the cleaner when it traverses the page tree (up to 80 times for a customer of mine! Read: 8000%!) But it will also improve backend speed in the Web > List module. It only affect websites with large amounts of versioned records (like any website with thousands or pages and tt_content elements). The optimization was to split one MySQL query into two, each of which could make use of indexes in the database, which the single combined query couldn't.
+       * Fixed simple bugs in getFuncCheck() and getFuncInput()
+
+2009-01-27     Kasper Sk\8crh¿j  <kasper@typo3.org>
+
        * Made changes to logging function calls, mainly so they include information of the page ID on which the operation took place. TODO: Go through the rest of the newlog() function calls and make them report the PID as well! It's a task that requires that you test it simultaneously in the backend that things get logged correctly.
        * Made a change to which users get notified when elements are rejected in a workspace which is set to "Notify users on next stage only": When an element is rejected only the users involved in raising the stage of the element since last rejection or creation will get notified (instead of every member of the workspace!)
-
+       
 2009-01-27     Kasper Sk\8crh¿j  <kasper@typo3.org>
 
        * Made a number of changes to log-display (Tools > Log): Filter on workspace, users, grouping by pages, plus option to specify a time interval manually.
index d7bfad1..bb3b81c 100755 (executable)
@@ -2636,7 +2636,11 @@ final class t3lib_BEfunc {
                }
                $mainParams = t3lib_div::implodeArrayForUrl('', $mainParams);
 
-               if (!$script) {basename(PATH_thisScript);}
+               if (!$script) {
+                       $script = basename(PATH_thisScript);
+                       $mainParams.= (t3lib_div::_GET('M') ? '&M='.rawurlencode(t3lib_div::_GET('M')) : '');
+               }
+
                $onClick = 'jumpToUrl(\''.$script.'?'.$mainParams.$addparams.'&'.$elementName.'=\'+(this.checked?1:0),this);';
                return '<input type="checkbox" class="checkbox" name="'.$elementName.'"'.($currentValue?' checked="checked"':'').' onclick="'.htmlspecialchars($onClick).'"'.($tagParams?' '.$tagParams:'').' />';
        }
@@ -2661,7 +2665,11 @@ final class t3lib_BEfunc {
                }
                $mainParams = t3lib_div::implodeArrayForUrl('', $mainParams);
 
-               if (!$script) {basename(PATH_thisScript);}
+               if (!$script) {
+                       $script = basename(PATH_thisScript);
+                       $mainParams.= (t3lib_div::_GET('M') ? '&M='.rawurlencode(t3lib_div::_GET('M')) : '');
+               }
+
                $onChange = 'jumpToUrl(\''.$script.'?'.$mainParams.$addparams.'&'.$elementName.'=\'+escape(this.value),this);';
                return '<input type="text"'.$GLOBALS['TBE_TEMPLATE']->formWidth($size).' name="'.$elementName.'" value="'.htmlspecialchars($currentValue).'" onchange="'.htmlspecialchars($onChange).'" />';
        }
@@ -3461,26 +3469,41 @@ final class t3lib_BEfunc {
 
                if ($TCA[$table] && $TCA[$table]['ctrl']['versioningWS'])       {
 
-                               // Select all versions of record:
+                       $realPid = 0;
+                       $outputRows = array();
+
+                               // Select UID version:
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
+                               $fields,
+                               $table,
+                               'uid='.intval($uid).
+                                       ($includeDeletedRecords ? '' : t3lib_BEfunc::deleteClause($table)),
+                               '',
+                               't3ver_id DESC'
+                       );
+
+                                               // Add rows to output array:
+                       while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
+                               $row['_CURRENT_VERSION'] = TRUE;
+                               $realPid = $row['pid'];
+                               $outputRows[] = $row;
+                       }
+
+                               // Select all offline versions of record:
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                $fields,
                                $table,
-                               '((pid=-1 AND t3ver_oid='.intval($uid).($workspace!=0?' AND t3ver_wsid='.intval($workspace):'').') OR uid='.intval($uid).')'.
+                               'pid=-1 AND uid!='.intval($uid).' AND t3ver_oid='.intval($uid).($workspace!=0?' AND t3ver_wsid='.intval($workspace):'').
                                        ($includeDeletedRecords ? '' : t3lib_BEfunc::deleteClause($table)),
                                '',
                                't3ver_id DESC'
                        );
 
                                // Add rows to output array:
-                       $realPid = 0;
-                       $outputRows = array();
-                       while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                               if ($uid==$row['uid']) {
-                                       $row['_CURRENT_VERSION'] = TRUE;
-                                       $realPid = $row['pid'];
-                               }
+                       while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
                                $outputRows[] = $row;
                        }
+                       
                        $GLOBALS['TYPO3_DB']->sql_free_result($res);
 
                                // Set real-pid: