📄 class.tx_install.php
字号:
INPUT {font-family: Verdana,Arial,Helvetica,Sans-serif; font-size: 10px;} //--></style> '; $backupFile = $this->getBackupFilename($this->INSTALL['typo3conf_files']); $fileContent = t3lib_div::getUrl($this->INSTALL['typo3conf_files']); $this->contentBeforeTable.= '<form action="'.$this->action.'" method="post">'.(substr($this->INSTALL['typo3conf_files'],-1)!='~' && !strstr($this->INSTALL['typo3conf_files'],'_bak') ? ' <input type="submit" name="TYPO3_INSTALL[SAVE_FILE]" value="Save file"> ' : '').' <input type="submit" name="_close" value="Close"> <br />File: '.$this->INSTALL['typo3conf_files'].' <br />MD5-sum: '.md5($fileContent).' <br /> <input type="hidden" name="TYPO3_INSTALL[FILE][name]" value="'.$this->INSTALL['typo3conf_files'].'"> '.($this->allowFileEditOutsite_typo3conf_dir?'<input type="hidden" name="TYPO3_INSTALL[FILE][EDIT_path]" value="'.$this->INSTALL['FILE']['EDIT_path'].'">':'').' <input type="hidden" name="TYPO3_INSTALL[FILE][prevMD5]" value="'.md5($fileContent).'"> <textarea rows="30" name="TYPO3_INSTALL[FILE]['.md5($this->INSTALL['typo3conf_files']).']" wrap="off"'.$this->formWidthText(48,'width:98%;height:80%','off').' class="fixed-font enable-tab">'.t3lib_div::formatForTextarea($fileContent).'</textarea><br /> <input type="checkbox" name="TYPO3_INSTALL[FILE][win_to_unix_br]" id="win_to_unix_br" value="1"'.(TYPO3_OS=='WIN'?'':' checked="checked"').'> <label for="win_to_unix_br">Convert Windows linebreaks (13-10) to Unix (10)</label><br /> <input type="checkbox" name="TYPO3_INSTALL[FILE][backup]" id="backup" value="1"'.(@is_file($backupFile) ? ' checked="checked"' : '').'> <label for="backup">Make backup copy (rename to '.basename($backupFile).')</label><br /> '. '</form>'; } if ($this->contentBeforeTable) { $this->contentBeforeTable = $this->fw($this->contentBeforeTable); } $this->message($headCode,'Files in folder',$fileList); echo $this->outputWrapper($this->printAll()); } /** * Outputs system information * * @return [type] ... */ function phpinformation() { $headCode = 'PHP information'; $sVar = t3lib_div::getIndpEnv('_ARRAY'); $sVar['CONST: PHP_OS']=PHP_OS; $sVar['CONST: TYPO3_OS']=TYPO3_OS; $sVar['CONST: PATH_thisScript']=PATH_thisScript; $sVar['CONST: php_sapi_name()']=php_sapi_name(); $sVar['OTHER: TYPO3_VERSION']=TYPO3_version; $sVar['OTHER: PHP_VERSION']=phpversion(); $sVar['imagecreatefromgif()']=function_exists('imagecreatefromgif'); $sVar['imagecreatefrompng()']=function_exists('imagecreatefrompng'); $sVar['imagecreatefromjpeg()']=function_exists('imagecreatefromjpeg'); $sVar['imagegif()']=function_exists('imagegif'); $sVar['imagepng()']=function_exists('imagepng'); $sVar['imagejpeg()']=function_exists('imagejpeg'); $sVar['imagettftext()']=function_exists('imagettftext'); $sVar['OTHER: IMAGE_TYPES']=function_exists('imagetypes') ? imagetypes() : 0; $sVar['OTHER: memory_limit']=ini_get('memory_limit'); $gE_keys = explode(',','SERVER_PORT,SERVER_SOFTWARE,GATEWAY_INTERFACE,SCRIPT_NAME,PATH_TRANSLATED'); while(list(,$k)=each($gE_keys)) { $sVar['SERVER: '.$k]=$_SERVER[$k]; } $gE_keys = explode(',','image_processing,gdlib,gdlib_png,gdlib_2,im,im_path,im_path_lzw,im_version_5,im_negate_mask,im_imvMaskState,im_combine_filename'); while(list(,$k)=each($gE_keys)) { $sVar['T3CV_GFX: '.$k]=$GLOBALS['TYPO3_CONF_VARS']['GFX'][$k]; } $debugInfo=array(); $debugInfo[]='### DEBUG SYSTEM INFORMATION - START ###'; reset($sVar); while(list($kkk,$vvv)=each($sVar)) { $debugInfo[]=str_pad(substr($kkk,0,20),20).': '.$vvv; } $debugInfo[]='### DEBUG SYSTEM INFORMATION - END ###'; $buf=$this->messageFunc_nl2br; $this->messageFunc_nl2br=0; $this->message($headCode,'DEBUG information','Please copy/paste the information from this text field into an email or bug-report as "Debug System Information" whenever you wish to get support or report problems. This information helps others to check if your system has some obvious misconfiguration and you\'ll get your help faster!<br /> <form action=""><textarea rows="10" '.$this->formWidthText(80,'','off').' wrap="off" class="fixed-font">'.t3lib_div::formatForTextarea(implode(chr(10),$debugInfo)).'</textarea></form>'); $this->messageFunc_nl2br=$buf; $getEnvArray = array(); $gE_keys = explode(',','QUERY_STRING,HTTP_ACCEPT,HTTP_ACCEPT_ENCODING,HTTP_ACCEPT_LANGUAGE,HTTP_CONNECTION,HTTP_COOKIE,HTTP_HOST,HTTP_USER_AGENT,REMOTE_ADDR,REMOTE_HOST,REMOTE_PORT,SERVER_ADDR,SERVER_ADMIN,SERVER_NAME,SERVER_PORT,SERVER_SIGNATURE,SERVER_SOFTWARE,GATEWAY_INTERFACE,SERVER_PROTOCOL,REQUEST_METHOD,SCRIPT_NAME,PATH_TRANSLATED,HTTP_REFERER,PATH_INFO'); while(list(,$k)=each($gE_keys)) { $getEnvArray[$k] = getenv($k); } $this->message($headCode,'t3lib_div::getIndpEnv()',t3lib_div::view_array(t3lib_div::getIndpEnv('_ARRAY'))); $this->message($headCode,'getenv()',t3lib_div::view_array($getEnvArray)); $this->message($headCode,'_ENV',t3lib_div::view_array($_ENV)); $this->message($headCode,'_SERVER',t3lib_div::view_array($_SERVER)); $this->message($headCode,'_COOKIE',t3lib_div::view_array($_COOKIE)); $this->message($headCode,'_GET',t3lib_div::view_array($_GET)); ob_start(); phpinfo(); $contents = explode('<body>',ob_get_contents()); ob_end_clean(); $contents = explode('</body>',$contents[1]); $this->message($headCode,'phpinfo()',$contents[0]);$this->headerStyle = '<style type="text/css"><!--a { text-decoration: none; }a:hover { text-decoration: underline; }h1 { font-family: verdana,arial, helvetica, sans-serif; font-size: 14pt; font-weight: bold;}h2 { font-family: verdana,arial, helvetica, sans-serif; font-size: 12pt; font-weight: bold;}body, td { font-family: verdana,arial, helvetica, sans-serif; font-size: 10pt; }th { font-family: verdana,arial, helvetica, sans-serif; font-size: 10pt; font-weight: bold; }//--></style>'; echo $this->outputWrapper($this->printAll()); } /******************************* * * typo3temp/ manager * *******************************/ /** * Provides a tool for deleting temporary files located in typo3temp/ * * @return string HTML output */ function typo3TempManager() { $headCode = 'typo3temp/ directory'; $this->message($headCode,'What is it?',' TYPO3 uses this directory for temporary files, mainly processed and cached images. The filenames are very cryptic; They are unique representations of the file properties made by md5-hashing a serialized array with information. Anyway this directory may contain many thousand files and a lot of them may be of no use anymore. With this test you can delete the files in this folder. When you do that, you should also clear the cache database tables afterwards. '); if (!$this->config_array['dir_typo3temp']) { $this->message('typo3temp/ directory','typo3temp/ not writable!'," You must make typo3temp/ write enabled before you can proceed with this test. ",2); echo $this->outputWrapper($this->printAll()); return; } // Run through files $fileCounter = 0; $deleteCounter = 0; $criteriaMatch = 0; $tmap=array('day'=>1, 'week'=>7, 'month'=>30); $tt = $this->INSTALL['typo3temp_delete']; $subdir = $this->INSTALL['typo3temp_subdir']; if (strlen($subdir) && !ereg('^[[:alnum:]_]+/$',$subdir)) die('subdir "'.$subdir.'" was not allowed!'); $action = $this->INSTALL['typo3temp_action']; $d = @dir($this->typo3temp_path.$subdir); if (is_object($d)) { while($entry=$d->read()) { $theFile = $this->typo3temp_path.$subdir.$entry; if (@is_file($theFile)) { $ok = 0; $fileCounter++; if ($tt) { if (t3lib_div::testInt($tt)) { if (filesize($theFile) > $tt*1024) $ok=1; } else { if (fileatime($theFile) < time()-(intval($tmap[$tt])*60*60*24)) $ok=1; } } else { $ok = 1; } if ($ok) { $hashPart=substr(basename($theFile),-14,10); if (!ereg('[^a-f0-9]',$hashPart) || substr($theFile,-6)==='.cache' || substr($theFile,-4)==='.tbl' || substr(basename($theFile),0,8)==='install_') { // This is a kind of check that the file being deleted has a 10 char hash in it if ($action && $deleteCounter<$action) { $deleteCounter++; unlink($theFile); } else { $criteriaMatch++; } } } } } $d->close(); } // Find sub-dirs: $subdirRegistry = array(''=>''); $d = @dir($this->typo3temp_path); if (is_object($d)) { while($entry=$d->read()) { $theFile = $entry; if (@is_dir($this->typo3temp_path.$theFile) && $theFile!='..' && $theFile!='.') { $subdirRegistry[$theFile.'/'] = $theFile.'/ (Files: '.count(t3lib_div::getFilesInDir($this->typo3temp_path.$theFile)).')'; } } } $deleteType=array( '0' => 'All', 'day' => 'Last access more than a day ago', 'week' => 'Last access more than a week ago', 'month' => 'Last access more than a month ago', '10' => 'Filesize greater than 10KB', '50' => 'Filesize greater than 50KB', '100' => 'Filesize greater than 100KB' ); $actionType=array( '0' => "Don't delete, just display statistics", '100' => 'Delete 100', '500' => 'Delete 500', '1000' => 'Delete 1000' ); $content='<select name="TYPO3_INSTALL[typo3temp_delete]">'.$this->getSelectorOptions($deleteType,$tt).'</select> <br />Number of files at a time: <select name="TYPO3_INSTALL[typo3temp_action]">'.$this->getSelectorOptions($actionType).'</select>From sub-directory: <select name="TYPO3_INSTALL[typo3temp_subdir]">'.$this->getSelectorOptions($subdirRegistry, $this->INSTALL['typo3temp_subdir']).'</select> '; $form = '<form action="'.$this->action.'" method="post">'.$content.' <input type="submit" value="Execute"> </form> This tool will delete files only if the last 10 characters before the extension (3 chars+\'.\') are hexadecimal valid ciphers, which are lowercase a-f and 0-9.'; $this->message($headCode,'Statistics',' Number of temporary files: <strong>'.($fileCounter-$deleteCounter)."</strong> Number matching '".htmlspecialchars($deleteType[$tt])."': <strong>".$criteriaMatch.'</strong> Number deleted: <strong>'.$deleteCounter.'</strong> <br /> '.$form,1); echo $this->outputWrapper($this->printAll()); } /** * [Describe function...] * * @param [type] $deleteType: ... * @param [type] $tt: ... * @return [type] ... */ function getSelectorOptions($deleteType,$tt='') { $out=''; if (is_array($deleteType)) { reset($deleteType); while(list($v,$l)=each($deleteType)) { $out.='<option value="'.htmlspecialchars($v).'"'.(!strcmp($v,$tt)?' selected="selected"':'').'>'.htmlspecialchars($l).'</option>'; } } return $out; } /******************************* * * cleanup manager * *******************************/ /** * Provides a tool cleaning up various tables in the database * * @return string HTML output * @author Robert Lemke <rl@robertlemke.de> * @todo Add more functionality ... */ function cleanupManager() { $headCode = 'Clean up database'; $this->message($headCode,'What is it?',' This function will become a general clean up manager for various tables used by TYPO3. By now you can only empty the cache which is used for storing image sizes of all pictures used in TYPO3. <strong>Clear cached image sizes</strong> Clears the cache used for memorizing sizes of all images used in your website. This information is cached in order to gain performance and will be stored each time a new image is being displayed in the frontend. You should <em>Clear All Cache</em> in the backend after clearing this cache. '); $tables = $this->getListOfTables(); $action = $this->INSTALL['cleanup_type']; if (($action == 'cache_imagesizes' || $action == 'all') && isset ($tables['cache_imagesizes'])) { $GLOBALS['TYPO3_DB']->exec_DELETEquery ('cache_imagesizes',''); } $cleanupType = array ( 'all' => 'Clean up everything', );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -