|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com) 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 * Publishing pages to static 00029 * 00030 * Is included from index_ts.php 00031 * $Id: publish.php 10120 2011-01-18 20:03:36Z ohader $ 00032 * 00033 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00034 * @package TYPO3 00035 * @subpackage tslib 00036 */ 00037 00038 00039 /* 00040 00041 TODO: 00042 00043 - Show publish-dir in interface 00044 - enabled checkboxes to select pages / frames 00045 - which-frames selecteble by TS 00046 - disable publishing of hidden/starttime/endtime/fe_group pages. 00047 - remove published files option 00048 - enable writing of images 00049 - Policy: HTML-files overridden always, mediafiles are only overwritten if mtime is different. 00050 00051 */ 00052 00053 00054 00055 if (!is_object($TSFE)) {die('You cannot execute this file directly. It\'s meant to be included from index_ts.php');} 00056 00057 00058 // Storing the TSFE object 00059 $temp_publish_TSFE = $TSFE; 00060 $TT->push('Publishing',''); 00061 $temp_publish_pages = explode(',', $BE_USER->adminPanel->getExtPublishList()); 00062 $temp_publish_imagesTotal = array(); 00063 $temp_publish_array = array(); // Collects the rendered pages. 00064 00065 foreach ($temp_publish_pages as $temp_publish_id) { 00066 $TT->push('Page '.$temp_publish_id,''); 00067 //debug($temp_publish_id); 00068 $TSFE = t3lib_div::makeInstance('tslib_fe', $TYPO3_CONF_VARS, $temp_publish_id, 0); 00069 00070 $TSFE->initFEuser(); 00071 $TSFE->clear_preview(); 00072 $TSFE->determineId(); 00073 $TSFE->initTemplate(); 00074 $TSFE->getFromCache(); 00075 00076 $TSFE->getConfigArray(); 00077 $TSFE->setUrlIdToken(); 00078 if ($TSFE->isGeneratePage()) { 00079 $TSFE->generatePage_preProcessing(); 00080 $temp_theScript=$TSFE->generatePage_whichScript(); 00081 if ($temp_theScript) { 00082 include($temp_theScript); 00083 } else { 00084 include(PATH_tslib.'pagegen.php'); 00085 } 00086 $TSFE->generatePage_postProcessing(); 00087 } elseif ($TSFE->isINTincScript()) { 00088 include(PATH_tslib.'pagegen.php'); 00089 } 00090 00091 // ******************************** 00092 // $GLOBALS['TSFE']->config['INTincScript'] 00093 // ******************************* 00094 if ($TSFE->isINTincScript()) { 00095 $TT->push('Internal PHP-scripts',''); 00096 $TSFE->INTincScript(); 00097 $TT->pull(); 00098 } 00099 00100 // Get filename 00101 $temp_fileName = $TSFE->getSimulFileName(); 00102 00103 if (!isset($temp_publish_array[$temp_fileName])) { // If the page is not rendered allready, which will happen if a hidden page is 'published' 00104 // Images file 00105 // $temp_publish_row = $TSFE->getSearchCache(); 00106 // $temp_publish_imagesOnPage= unserialize($temp_publish_row['tempFile_data']); 00107 // $temp_publish_imagesTotal = array_merge($temp_publish_imagesTotal, $temp_publish_imagesOnPage); 00108 // Store the data for this page: 00109 $temp_publish_array[$temp_fileName]= array($temp_publish_id, $temp_publish_imagesOnPage, $TSFE->content); 00110 } 00111 $TT->pull(); 00112 } 00113 //debug($temp_publish_imagesTotal); 00114 //debug(array_unique($temp_publish_imagesTotal)); 00115 00116 00117 // *************************** 00118 // Publishing, writing files 00119 // *************************** 00120 $publishDir = $TYPO3_CONF_VARS['FE']['publish_dir']; 00121 if ($publishDir && @is_dir($publishDir)) { 00122 $publishDir = rtrim($publishDir, '/').'/'; 00123 debug('Publishing in: '.$publishDir, 'Publish'); 00124 foreach ($temp_publish_array as $key => $val) { 00125 $file = $publishDir.$key; 00126 t3lib_div::writeFile($file,$val[2]); 00127 debug('Writing: '.$file, 'Publish'); 00128 } 00129 // debug($temp_publish_array); 00130 } else { 00131 debug('No publish_dir specified...'); 00132 } 00133 00134 00135 $TT->pull(); 00136 // Restoring the TSFE object 00137 $TSFE = $temp_publish_TSFE; 00138 00139 ?>
1.8.0