CVS update: /cowiki/includes/cowiki/class/dao/
[email protected] 13 Sep 2005 01:55:46 -0000
| Newsgroups | gmane.comp.php.cowiki.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: dgorski Date: 2005/09/12 18:55:46 Modified: cowiki/includes/cowiki/class/dao/class.DocumentDAO.php Log: Save the changelog field 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.74&r2=1.75 Delta lines: +35 -13 --------------------- --- class.DocumentDAO.php 17 Jul 2005 18:48:03 -0000 1.74 +++ class.DocumentDAO.php 13 Sep 2005 01:55:43 -0000 1.75 @@ -2,7 +2,7 @@ /** * - * $Id: class.DocumentDAO.php,v 1.74 2005/07/17 18:48:03 dgorski Exp $ + * $Id: class.DocumentDAO.php,v 1.75 2005/09/13 01:55:43 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.74 $ + * @version $Revision: 1.75 $ * */ @@ -44,7 +44,7 @@ UNIX_TIMESTAMP(created) as created, author_id, revision, name, wikiname, encoding, notify_user, notify_group, - menu, foot, views, sort_order'; + comments, menu, foot, views, sort_order'; protected $Storage = null, @@ -1335,12 +1335,13 @@ || $Node->get('name') == '..'; if ($bCheck) { - // Missing directory name or missing document name - $this->Context->addError($Node->get('isContainer') ? 421 : 423); // {{{ DEBUG }}} Logger::warn('Missing directory or document name. Aborting.'); + // Missing directory name or missing document name + $this->Context->addError($Node->get('isContainer') ? 421 : 423); + return false; } @@ -1350,11 +1351,12 @@ // versions and go to the "spill" tables. $nCapacity = $this->Storage->getTextCapacity(); if (strlen($Node->get('content')) > $nCapacity) { - $this->Context->addError(441); // {{{ DEBUG }}} Logger::warn('Data too large. Aborting.'); + $this->Context->addError(441); + return false; } @@ -1366,14 +1368,14 @@ // Check for a duplicate names if ($this->getNameDupesCount($Node) > 0) { + // {{{ DEBUG }}} + Logger::warn('Name already exists. Aborting.'); + // Rollback transaction $this->Storage->rollback(); $this->Context->addError($Node->get('isWeb') ? 411 : 422); - // {{{ DEBUG }}} - Logger::warn('Name already exists. Aborting.'); - return false; } @@ -1396,6 +1398,9 @@ if ($aData !== false && $aData['rec_tan'] != $Node->get('recTan')) { + // {{{ DEBUG }}} + Logger::warn('Record TAN mismatch. Record has been changed.'); + // Rollback transaction $this->Storage->rollback(); @@ -1403,9 +1408,6 @@ $Node->set('recTan', $aData['rec_tan']); $this->Context->addError(440); - // {{{ DEBUG }}} - Logger::warn('Record TAN mismatch. Record has been changed.'); - return false; } @@ -1458,6 +1460,7 @@ 'content' => $Node->get('content'), 'summary' => $sSummary, 'keywords' => $Node->get('keywords'), + 'changelog' => $Node->get('changelog'), 'comments' => $Node->get('isCommentable') ? 'Y' : '', 'views' => $Node->get('views') ); @@ -1474,6 +1477,21 @@ // If this is an update if ((int)$Node->get('id') !== 0) { + // Change log given? Check only if not a 'minor change' - or - + // vice versa: Check only if we need a backup. + if ($bDoBackup && strlen($Node->get('changelog')) <= 3) { + + // {{{ DEBUG }}} + Logger::warn('Missing change log summary.'); + + // Rollback transaction + $this->Storage->rollback(); + + $this->Context->addError(426); + + return false; + } + // {{{ DEBUG }}} Logger::info( 'Preparing record update for node id #'.$Node->get('id') @@ -2351,6 +2369,10 @@ if (isset($aData['keywords'])) { $Node->set('keywords', $aData['keywords']); + } + + if (isset($aData['changelog'])) { + $Node->set('changelog', $aData['changelog']); } if (isset($aData['comments'])) {