[pLog-svn] r2257 - in plog/trunk: class/action/admin
class/controller class/dao locale templates/admin
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Tue Jun 21 06:17:10 GMT 2005
Author: oscar
Date: 2005-06-21 06:17:09 +0000 (Tue, 21 Jun 2005)
New Revision: 2257
Modified:
plog/trunk/class/action/admin/admincleanupaction.class.php
plog/trunk/class/controller/admincontrollermap.properties.php
plog/trunk/class/dao/blogs.class.php
plog/trunk/locale/locale_en_UK.php
plog/trunk/templates/admin/cleanup.template
Log:
added the patch from issue http://bugs.plogworld.net/view.php?id=388
Modified: plog/trunk/class/action/admin/admincleanupaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admincleanupaction.class.php 2005-06-20 21:48:15 UTC (rev 2256)
+++ plog/trunk/class/action/admin/admincleanupaction.class.php 2005-06-21 06:17:09 UTC (rev 2257)
@@ -29,6 +29,8 @@
$this->_op = "cleanupSpam";
elseif( $this->_request->getValue( "purgeUsers" ))
$this->_op = "cleanupUsers";
+ elseif( $this->_request->getValue( "purgeBlogs" ))
+ $this->_op = "cleanupBlogs";
$this->_message = "";
}
@@ -38,7 +40,7 @@
*/
function cleanupPosts()
{
- $articles = new Articles();
+ $articles = new Articles();
$articles->purgePosts();
$this->_message = $this->_locale->tr("posts_purged_ok");
@@ -57,11 +59,24 @@
$this->_message = $this->_locale->tr("users_purged_ok");
return true;
- }
-
+ }
//-- End: Conan 20-05-2005 Add option to remove user permanently -->
+ //-- Start: Conan 25-05-2005 Add option to remove Blog marked as disabled -->
+ /**
+ * cleans up blogs. Returns true if successful or false otherwise
+ */
+
+ function cleanupBlogs()
+ {
+ $blogs = new Blogs();
+ $blogs->purgeBlogs();
+ $this->_message = $this->_locale->tr("blogs_purged_ok");
+
+ return true;
+ }
+
/**
* cleans up spam comments. Returns true if successful or false otheriwse
*/
@@ -87,6 +102,9 @@
elseif( $this->_op == "cleanupUsers" ) {
$result = $this->cleanupUsers();
}
+ elseif( $this->_op == "cleanupBlogs" ) {
+ $result = $this->cleanupBlogs();
+ }
// create the view and see if there was a success message
$this->_view = new AdminTemplatedView( $this->_blogInfo, "cleanup" );
@@ -97,4 +115,5 @@
return true;
}
- }
\ No newline at end of file
+ }
+?>
\ No newline at end of file
Modified: plog/trunk/class/controller/admincontrollermap.properties.php
===================================================================
--- plog/trunk/class/controller/admincontrollermap.properties.php 2005-06-20 21:48:15 UTC (rev 2256)
+++ plog/trunk/class/controller/admincontrollermap.properties.php 2005-06-21 06:17:09 UTC (rev 2257)
@@ -250,4 +250,6 @@
$actions["doCleanUp"] = "AdminCleanupAction";
// removes all users marked as deleted
$actions["purgeUsers"] = "AdminPurgeUsersAction";
+ // removes all blogs marked as deleted
+ $actions["purgeBlogs"] = "AdminPurgeBlogsAction";
?>
Modified: plog/trunk/class/dao/blogs.class.php
===================================================================
--- plog/trunk/class/dao/blogs.class.php 2005-06-20 21:48:15 UTC (rev 2256)
+++ plog/trunk/class/dao/blogs.class.php 2005-06-21 06:17:09 UTC (rev 2257)
@@ -513,6 +513,7 @@
require_once( PLOG_CLASS_PATH . 'class/dao/mylinkscategories.class.php' );
require_once( PLOG_CLASS_PATH . 'class/dao/userpermissions.class.php' );
require_once( PLOG_CLASS_PATH . 'class/database/db.class.php' );
+ require_once( PLOG_CLASS_PATH . 'class/dao/articlecategories.class.php' );
// first of all, delete the posts
$articles = new Articles();
@@ -572,6 +573,29 @@
}
/**
+ * removes all blogs that have 'deleted' status
+ *
+ * @return Returns true if all blogs were deleted or false otherwise.
+ */
+ function purgeBlogs()
+ {
+ // delete blogs marked as disabled leave the username intact.
+ // If the username is disabled, the Purge User featuer will delete them
+
+ $b_query = "SELECT * FROM ".$this->getPrefix()."blogs WHERE status = ".BLOG_STATUS_DISABLED;
+
+ $b_result = $this->Execute( $b_query );
+ if( !$b_result )
+ return false;
+
+ while( $b_row = $b_result->FetchRow()) {
+ $this->deleteBlog( $b_row["id"] );
+ }
+
+ return true;
+ }
+
+ /**
* @private
*/
function _getBlogInfoFromQuery( $query, $extendedInfo = false )
Modified: plog/trunk/locale/locale_en_UK.php
===================================================================
--- plog/trunk/locale/locale_en_UK.php 2005-06-20 21:48:15 UTC (rev 2256)
+++ plog/trunk/locale/locale_en_UK.php 2005-06-21 06:17:09 UTC (rev 2257)
@@ -911,8 +911,10 @@
$messages['trackback_marked_as_nonspam_ok'] = 'The trackback was marked successfully as non-spam';
$messages['upload_here'] = 'Upload here';
$messages['reply_string'] = 'Re: ';
-
$messages['cleanup_users'] = 'Purge Users';
$messages['cleanup_users_help'] = 'This will remove all users that have been deleted by administrator (marked as "Deleted"). It will also remove any blogs that user own including everything in that blog. If user has permission to post in other blog, all posts made by them will be deleted as well. It will not be possible to recover once users have been removed';
$messages['users_purged_ok'] = 'Users purged successfully';
+$messages['cleanup_blogs'] = 'Purge Blogs';
+$messages['cleanup_blogs_help'] = 'This will remove all blogs that have been deleted by administrator (marked as "Deleted"). It will remove everthing in that blog. It will not be possible to recover once users have been removed';
+$messages['blogs_purged_ok'] = 'Blogs purged successfully';
?>
\ No newline at end of file
Modified: plog/trunk/templates/admin/cleanup.template
===================================================================
--- plog/trunk/templates/admin/cleanup.template 2005-06-20 21:48:15 UTC (rev 2256)
+++ plog/trunk/templates/admin/cleanup.template 2005-06-21 06:17:09 UTC (rev 2257)
@@ -18,13 +18,18 @@
<div class="formHelp">{$locale->tr("cleanup_spam_help")}</div>
<input type="submit" class="button" name="purgeSpam" value="{$locale->tr("purge")}" />
</div>
-
<div class="field">
<label for="purgePosts">{$locale->tr("cleanup_users")}</label>
<span class="required"></span>
<div class="formHelp">{$locale->tr("cleanup_users_help")}</div>
<input type="submit" class="button" name="purgeUsers" value="{$locale->tr("purge")}" />
- </div>
+ </div>
+ <div class="field">
+ <label for="purgeBlogs">{$locale->tr("cleanup_blogs")}</label>
+ <span class="required"></span>
+ <div class="formHelp">{$locale->tr("cleanup_blogs_help")}</div>
+ <input type="submit" class="button" name="purgeBlogs" value="{$locale->tr("purge")}" />
+ </div>
<input type="hidden" name="op" value="doCleanUp" />
</fieldset>
</form>
More information about the pLog-svn
mailing list