CVS update: /cowiki/includes/cowiki/class/dao/
[email protected] 17 Jul 2005 18:40:49 -0000
| Newsgroups | gmane.comp.php.cowiki.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: dgorski Date: 2005/07/17 11:40:49 Modified: cowiki/includes/cowiki/class/dao/class.DocumentDAO.php Log: Fighting the "bad magic" heisenbug. As this bug is not reproducible, there is no direct way to test the changes. They _may_ help. File Changes: Directory: /cowiki/includes/cowiki/class/dao/ ============================================= File [changed]: class.DocumentDAO.php Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/dao/class.DocumentDAO.php?r1=1.72&r2=1.73 Delta lines: +34 -25 --------------------- --- class.DocumentDAO.php 26 May 2005 23:44:39 -0000 1.72 +++ class.DocumentDAO.php 17 Jul 2005 18:40:47 -0000 1.73 @@ -2,7 +2,7 @@ /** * - * $Id: class.DocumentDAO.php,v 1.72 2005/05/26 23:44:39 dgorski Exp $ + * $Id: class.DocumentDAO.php,v 1.73 2005/07/17 18:40:47 dgorski Exp $ * * This file is part of coWiki. coWiki is free software under the terms of * the GNU General Public License (GPL). Read the LICENSE file. If you did @@ -17,7 +17,7 @@ * @author Daniel T. Gorski, <[email protected]> * @copyright (C) Daniel T. Gorski, {@link http://www.develnet.org} * @license http://www.gnu.org/licenses/gpl.html - * @version $Revision: 1.72 $ + * @version $Revision: 1.73 $ * */ @@ -775,6 +775,12 @@ // {{{ DEBUG }}} Logger::info('Fetching historical node for node id #'.$nId); + $nId = (int)$nId; + + if ($nId === 0) { + return null; + } + // Get historical document $sQuery = " SELECT ".$sFields.", node_hist_id, @@ -1460,14 +1466,14 @@ // ---------------------------------------------------------------- // If this is an update - if ($Node->get('id') != 0) { + if ((int)$Node->get('id') !== 0) { // {{{ DEBUG }}} Logger::info( 'Preparing record update for node id #'.$Node->get('id') ); - if ($this->getNodeById($Node->get('id'))) { + if ($this->getNodeById($Node->get('id')) != null) { // Store only if changes has been made (if prepareBackup() // says, that this is necessary) @@ -1515,6 +1521,8 @@ $LastHistNode = $this->getHistNodeForId($Node->get('id')); + if ($LastHistNode != null) { + // This is a recover insert: add required fields $aInitial = array( 'node_id' => $Node->get('id'), @@ -1537,6 +1545,7 @@ // Execute insert $this->Storage->insert($aInsert); + } } } else {