[pLog-svn] r5011 - plog/branches/lifetype-1.2/class/action/admin
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Tue Mar 6 13:16:01 EST 2007
Author: jondaley
Date: 2007-03-06 13:16:01 -0500 (Tue, 06 Mar 2007)
New Revision: 5011
Modified:
plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php
Log:
always set op. set error message on failure. fixed purging of more than the first 5 users at a time.
Modified: plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php 2007-03-06 18:15:09 UTC (rev 5010)
+++ plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php 2007-03-06 18:16:01 UTC (rev 5011)
@@ -35,7 +35,9 @@
$this->_op = "cleanupBlogs";
elseif( $this->_request->getValue( "purgeTemp" ))
$this->_op = "cleanupTemp";
-
+ else
+ $this->_op = "";
+
$this->_message = "";
$this->_continue = false;
@@ -50,7 +52,13 @@
include_once( PLOG_CLASS_PATH."class/dao/purgedata.class.php" );
$purge = new PurgeData();
- if( $purge->purgePosts() > 0 ) {
+ $result = $purge->purgePosts();
+ if($result === false){
+ $this->_continue = false;
+ $this->_message = $this->_locale->tr( "purging_error" );
+ return false;
+ }
+ else if($result > 0 ) {
$this->_message = $this->_locale->tr( "purging_please_wait" );
// flags to indicate that we show refresh the page and continue at the given URL
$this->_continue = true;
@@ -61,7 +69,7 @@
$this->_message = $this->_locale->tr( "posts_purged_ok" );
}
- return( true );
+ return true;
}
/**
@@ -72,11 +80,17 @@
include_once( PLOG_CLASS_PATH."class/dao/purgedata.class.php" );
$purge = new PurgeData();
- if( $purge->purgeUsers() > 0 ) {
+ $result = $purge->purgeUsers();
+ if($result === false){
+ $this->_continue = false;
+ $this->_message = $this->_locale->tr( "purging_error" );
+ return false;
+ }
+ else if($result > 0){
$this->_message = $this->_locale->tr( "purging_please_wait" );
// flags to indicate that we show refresh the page and continue at the given URL
$this->_continue = true;
- $this->_url = "?op=doCleanUp&purgePosts=Purge";
+ $this->_url = "?op=doCleanUp&purgeUsers=Purge";
}
else {
$this->_continue = false;
@@ -94,7 +108,14 @@
include_once( PLOG_CLASS_PATH."class/dao/purgedata.class.php" );
$purge = new PurgeData();
- if( $purge->purgeBlogs() > 0 ) {
+ $result = $purge->purgeBlogs();
+
+ if($result === false){
+ $this->_continue = false;
+ $this->_message = $this->_locale->tr( "purging_error" );
+ return false;
+ }
+ else if($result > 0 ) {
$this->_message = $this->_locale->tr( "purging_please_wait" );
// flags to indicate that we show refresh the page and continue at the given URL
$this->_continue = true;
@@ -109,14 +130,20 @@
}
/**
- * cleans up spam comments. Returns true if successful or false otheriwse
+ * cleans up spam comments. Returns true if successful or false otherwise
*/
function cleanupComments()
{
include_once( PLOG_CLASS_PATH."class/dao/purgedata.class.php" );
$purge = new PurgeData();
- if( $purge->purgeSpamComments() > 0 ) {
+ $result = $purge->purgeSpamComments();
+ if($result === false){
+ $this->_continue = false;
+ $this->_message = $this->_locale->tr( "purging_error" );
+ return false;
+ }
+ else if($result > 0) {
$this->_message = $this->_locale->tr( "purging_please_wait" );
// flags to indicate that we show refresh the page and continue at the given URL
$this->_continue = true;
@@ -130,9 +157,14 @@
return( true );
}
+ /**
+ * cleans up temp directory, excluding .htaccess and the .svn directory
+ *
+ * @return Returns true
+ */
function cleanupTemp()
{
- include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
$config =& Config::getConfig();
$tmpFolder = $config->getValue( "temp_folder" );
$excludes = array('.htaccess', '.svn');
@@ -172,6 +204,8 @@
$this->_view = new AdminTemplatedView( $this->_blogInfo, "cleanup" );
if( $result )
$this->_view->setSuccessMessage( $this->_message );
+ else
+ $this->_view->setErrorMessage( $this->_message );
$this->_view->setValue( "continue", $this->_continue );
$this->_view->setValue( "dest", $this->_url );
More information about the pLog-svn
mailing list