[pLog-svn] r4292 - in plog/trunk: class/action/admin locale templates/admin

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sun Nov 12 13:34:18 GMT 2006


Author: oscar
Date: 2006-11-12 13:34:17 +0000 (Sun, 12 Nov 2006)
New Revision: 4292

Modified:
   plog/trunk/class/action/admin/admincleanupaction.class.php
   plog/trunk/locale/locale_en_UK.php
   plog/trunk/templates/admin/cleanup.template
Log:
added an extra function to the "clean up" page, so that users can now clean up the contents of the tmp/ folder from the admin interface (therefore causing a reset of the data cache and the template cache)


Modified: plog/trunk/class/action/admin/admincleanupaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admincleanupaction.class.php	2006-11-12 13:21:42 UTC (rev 4291)
+++ plog/trunk/class/action/admin/admincleanupaction.class.php	2006-11-12 13:34:17 UTC (rev 4292)
@@ -30,7 +30,9 @@
 			elseif( $this->_request->getValue( "purgeUsers" ))
 				$this->_op = "cleanupUsers";
 			elseif( $this->_request->getValue( "purgeBlogs" ))
-				$this->_op = "cleanupBlogs";				
+				$this->_op = "cleanupBlogs";
+			elseif( $this->_request->getValue( "purgeTemp" ))
+				$this->_op = "cleanupTemp";
 
 			$this->_message = "";
 			
@@ -91,6 +93,18 @@
 
 			return true;
 		}
+		
+		function cleanupTemp()
+		{
+			include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
+			$config =& Config::getConfig();
+			$tmpFolder = $config->getValue( "temp_folder", TEMP_FOLDER );
+			File::deleteDir( $tmpFolder, true, true );
+			
+			$this->_message = $this->_locale->tr( "temp_folder_reset_ok" );
+			
+			return true ;
+		}
 
 		function perform()
 		{
@@ -113,6 +127,9 @@
 				$result = $this->cleanupBlogs();
 				CacheControl::resetSummaryCache();
 			}
+			elseif( $this->_op == "cleanupTemp" ) {
+				$result = $this->cleanupTemp();
+			}
 
 			// create the view and see if there was a success message
 			$this->_view = new AdminTemplatedView( $this->_blogInfo, "cleanup" );

Modified: plog/trunk/locale/locale_en_UK.php
===================================================================
--- plog/trunk/locale/locale_en_UK.php	2006-11-12 13:21:42 UTC (rev 4291)
+++ plog/trunk/locale/locale_en_UK.php	2006-11-12 13:34:17 UTC (rev 4292)
@@ -1174,4 +1174,8 @@
 
 $messages['error_global_category_has_articles'] = 'The global article category cannot be deleted because it still has articles';
 $messages['error_adding_global_article_category'] = 'There was an error adding the global article category';
+
+$messages['temp_folder_reset_ok'] = 'The temporary folder was successfully cleaned up';
+$messages['cleanup_temp_help'] = 'This will trigger a clean up of the temporary folder, forcing the data cache and the template cache to be reset for all blogs.';
+$messages['cleanup_temp'] = 'Purge temporary folder';
 ?>
\ No newline at end of file

Modified: plog/trunk/templates/admin/cleanup.template
===================================================================
--- plog/trunk/templates/admin/cleanup.template	2006-11-12 13:21:42 UTC (rev 4291)
+++ plog/trunk/templates/admin/cleanup.template	2006-11-12 13:34:17 UTC (rev 4292)
@@ -10,8 +10,7 @@
    <span class="required"></span>
    <div class="formHelp">{$locale->tr("cleanup_posts_help")}</div>
    <input type="submit" class="button" name="purgePosts" value="{$locale->tr("purge")}" />
-  </div>
-  
+  </div>  
   <div class="field">
    <label for="purgeSpam">{$locale->tr("cleanup_spam")}</label>
    <span class="required"></span>
@@ -30,6 +29,12 @@
    <div class="formHelp">{$locale->tr("cleanup_blogs_help")}</div>
    <input type="submit" class="button" name="purgeBlogs" value="{$locale->tr("purge")}" />
   </div>
+  <div class="field">
+   <label for="purgeTemp">{$locale->tr("cleanup_temp")}</label>
+   <span class="required"></span>
+   <div class="formHelp">{$locale->tr("cleanup_temp_help")}</div>
+   <input type="submit" class="button" name="purgeTemp" value="{$locale->tr("purge")}" />
+  </div>
   <input type="hidden" name="op" value="doCleanUp" />
  </fieldset>
 </form>



More information about the pLog-svn mailing list