[pLog-svn] r4656 - in plog/branches/lifetype-1.2/class: action/admin file net
reto at devel.lifetype.net
reto at devel.lifetype.net
Thu Feb 1 16:31:41 EST 2007
Author: reto
Date: 2007-02-01 16:31:41 -0500 (Thu, 01 Feb 2007)
New Revision: 4656
Modified:
plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php
plog/branches/lifetype-1.2/class/file/file.class.php
plog/branches/lifetype-1.2/class/net/rawrequestgenerator.class.php
Log:
Purge temporary folder doesn't delete the .htaccess anymore. the file::deleteDir method now accepts an array of filenames (case sensitive!) which must not be deleted during the (recursive) operation.
Additionally I merged oscars pager bugfix from r4641.
Modified: plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php 2007-02-01 20:27:32 UTC (rev 4655)
+++ plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php 2007-02-01 21:31:41 UTC (rev 4656)
@@ -135,7 +135,8 @@
include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
$config =& Config::getConfig();
$tmpFolder = $config->getValue( "temp_folder" );
- File::deleteDir( $tmpFolder, true, true );
+ $excludes = array('.htaccess');
+ File::deleteDir( $tmpFolder, true, true, $excludes );
$this->_message = $this->_locale->tr( "temp_folder_reset_ok" );
@@ -179,4 +180,4 @@
return true;
}
}
-?>
\ No newline at end of file
+?>
Modified: plog/branches/lifetype-1.2/class/file/file.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/file/file.class.php 2007-02-01 20:27:32 UTC (rev 4655)
+++ plog/branches/lifetype-1.2/class/file/file.class.php 2007-02-01 21:31:41 UTC (rev 4656)
@@ -240,17 +240,19 @@
* @param onlyFiles If the recursive mode is enabled, setting this to 'true' will
* force the method to only remove files but not folders. The directory will not be
* removed but all the files included it in (and all subdirectories) will be.
+ * @param excludedFiles If some files should not be removed (like .htaccess) they can be added
+ * to this array. This operation is case sensitive!
* @return True if successful or false otherwise
* @static
*/
- function deleteDir( $dirName, $recursive = false, $onlyFiles = false )
+ function deleteDir( $dirName, $recursive = false, $onlyFiles = false, $excludedFiles = array('') )
{
// if the directory can't be read, then quit with an error
if( !File::isReadable( $dirName ) || !File::exists( $dirName )) {
return false;
}
- // if it's not a file, let's get out of here and transfer flow
+ // if it's not a directory, let's get out of here and transfer flow
// to the right place...
if( !File::isDir( $dirName )) {
return File::delete( $dirName );
@@ -261,21 +263,29 @@
// will automatically ignore things like "." and ".." for us,
// making it much easier!
$files = Glob::myGlob( $dirName, "*" );
- foreach( $files as $file ) {
+ foreach( $files as $file )
+ {
if( File::isDir( $file )) {
// perform a recursive call if we were allowed to do so
- if( $recursive )
+ if( $recursive ) {
File::deleteDir( $file, $recursive, $onlyFiles );
+ }
}
-
- // File::delete can remove empty folders as well as files
- if( File::isReadable( $file ))
- File::delete( $file ); }
+
+ // check if the filename is in the list of files we must not delete
+ if(array_search(basename( $file ), $excludedFiles) === false) {
+ // File::delete can remove empty folders as well as files
+ if( File::isReadable( $file )) {
+ File::delete( $file );
+ }
+ }
+ }
// finally, remove the top-level folder but only in case we
// are supposed to!
- if( !$onlyFiles )
+ if( !$onlyFiles ) {
File::delete( $dirName );
+ }
return true;
}
Modified: plog/branches/lifetype-1.2/class/net/rawrequestgenerator.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/net/rawrequestgenerator.class.php 2007-02-01 20:27:32 UTC (rev 4655)
+++ plog/branches/lifetype-1.2/class/net/rawrequestgenerator.class.php 2007-02-01 21:31:41 UTC (rev 4656)
@@ -427,7 +427,7 @@
else
$amp = "&";
- $url = $this->getIndexUrl()."?op=Default&";
+ $url = $this->getIndexUrl()."?op=Default{$amp}blogId=".$this->_blogInfo->getId()."{$amp}";
$params = "";
if( $category )
More information about the pLog-svn
mailing list