|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2011 Sebastian Kurfürst <sebastian@garbage-group.de> 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00027 00028 /** 00029 * Contains the update class for not in menu pages. Used by the update wizard in the install tool. 00030 * 00031 * @author Sebastian Kurfürst <sebastian@garbage-group.de> 00032 * @author Steffen Kamper <info@sk-typo3.de> 00033 * @version $Id: class.tx_coreupdates_notinmenu.php 10120 2011-01-18 20:03:36Z ohader $ 00034 */ 00035 class tx_coreupdates_notinmenu extends Tx_Install_Updates_Base { 00036 protected $title = 'Update Pages with Doktype "Not in menu"'; 00037 00038 00039 /** 00040 * Checks if an update is needed 00041 * 00042 * @param string &$description: The description for the update 00043 * @return boolean whether an update is needed (true) or not (false) 00044 */ 00045 public function checkForUpdate(&$description) { 00046 $result = false; 00047 $description = 'Removes the deprecated pages doktype "Not in menu". It sets the successing flag "Not in menu" for the corresponding pages instead.'; 00048 00049 if ($this->versionNumber >= 4002000) { 00050 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'doktype=5', '', '', '1'); 00051 if($GLOBALS['TYPO3_DB']->sql_num_rows($res)) { 00052 $result = true; 00053 } 00054 $GLOBALS['TYPO3_DB']->sql_free_result($res); 00055 } 00056 return $result; 00057 } 00058 00059 00060 /** 00061 * Performs the database update. Changes the doktype from 5 ("not in menu") to 1 (standard) and sets the "nav_hide" flag to 1 00062 * 00063 * @param array &$dbQueries: queries done in this update 00064 * @param mixed &$customMessages: custom messages 00065 * @return boolean whether it worked (true) or not (false) 00066 */ 00067 public function performUpdate(&$dbQueries, &$customMessages) { 00068 $result = false; 00069 if($this->versionNumber >= 4002000) { 00070 $updateArray = array( 00071 'doktype' => 1, 00072 'nav_hide' => 1 00073 ); 00074 00075 $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'doktype=5', $updateArray); 00076 $dbQueries[] = str_replace(chr(10), ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery); 00077 00078 if ($GLOBALS['TYPO3_DB']->sql_error()) { 00079 $customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error()); 00080 } else { 00081 $result = true; 00082 } 00083 } 00084 return $result; 00085 } 00086 } 00087 ?>
1.8.0