[pLog-svn] r5010 - plog/branches/lifetype-1.2/class/dao
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Tue Mar 6 13:15:09 EST 2007
Author: jondaley
Date: 2007-03-06 13:15:09 -0500 (Tue, 06 Mar 2007)
New Revision: 5010
Modified:
plog/branches/lifetype-1.2/class/dao/purgedata.class.php
Log:
general cleanup and user purging now works, missing parameter. http://forums.lifetype.net/viewtopic.php?p=33595
Modified: plog/branches/lifetype-1.2/class/dao/purgedata.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/purgedata.class.php 2007-03-06 18:00:55 UTC (rev 5009)
+++ plog/branches/lifetype-1.2/class/dao/purgedata.class.php 2007-03-06 18:15:09 UTC (rev 5010)
@@ -1,6 +1,6 @@
<?php
- include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
define( "DEFAULT_PURGE_AMOUNT", 5 );
@@ -16,50 +16,48 @@
*/
function deleteBlogData( $blogId )
{
+ // delete the article categories
lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
-
- // delete the article categories
- include_once( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
$cats = new ArticleCategories();
$cats->deleteBlogCategories( $blogId );
// article notifications
- include_once( PLOG_CLASS_PATH."class/dao/articlenotifications.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/articlenotifications.class.php" );
$notifications = new ArticleNotifications();
$notifications->deleteBlogNotifications( $blogId );
// comments
- include_once( PLOG_CLASS_PATH."class/dao/commentscommon.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/commentscommon.class.php" );
$comments = new CommentsCommon();
$comments->deleteBlogComments( $blogId );
// links
- include_once( PLOG_CLASS_PATH."class/dao/mylinks.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/mylinks.class.php" );
$links = new MyLinks();
$links->deleteBlogMyLinks( $blogId );
// link categories
- include_once( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" );
$links = new MyLinksCategories();
$links->deleteBlogMyLinksCategories( $blogId );
// referers
- include_once( PLOG_CLASS_PATH."class/dao/referers.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/referers.class.php" );
$referers = new Referers();
$referers->deleteBlogReferers( $blogId );
// permissions
- include_once( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
$perms = new UserPermissions();
$perms->revokeBlogPermissions( $blogId );
// resources
- include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );
$albums = new GalleryResources();
$albums->deleteUserResources( $blogId );
// albums
- include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
$albums = new GalleryAlbums();
$albums->deleteUserAlbums( $blogId );
// articles
- include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
$articles = new Articles();
$articles->deleteBlogPosts( $blogId );
// the blog itself
- include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
$blogs = new Blogs();
$blogs->deleteBlog( $blogId );
@@ -81,8 +79,6 @@
$this->deleteBlogData( $blogId );
}
- // return how many we purged, and when this method returns '0', it means that there is nothing else
- // left to be purged
return( count( $disabledBlogs ));
}
@@ -90,8 +86,8 @@
* Purge spam comments
*
* @param amount
- * @return Returns how many we purged, and when this method returns '0', it means that there is nothing else
- * left to be purged
+ * @return Returns false on error, or else number of comments purged,
+ * if 0, there is nothing left to purge
*/
function purgeSpamComments( $amount = DEFAULT_PURGE_AMOUNT )
{
@@ -118,6 +114,9 @@
/**
* Purge articles that have been marked as deleted
+ *
+ * @return Returns false on error, or else number of posts purged,
+ * if 0, there is nothing left to purge
*
* @param amount
*/
@@ -133,11 +132,11 @@
return false;
$deleted = 0;
- $comments = new Articles();
+ $posts = new Articles();
while( $row = $result->FetchRow()) {
// calling the method in the Articles class will take care of everything else
- $comments->deleteArticle( $row["id"], $row["user_id"], $row["blog_id"], true );
+ $posts->deleteArticle( $row["id"], $row["user_id"], $row["blog_id"], true );
$deleted++;
}
@@ -145,19 +144,22 @@
}
/**
- * Purge users that have been marked as disabled. If these users own a blog, then the blog will also be removed
+ * Purge users that have been marked as disabled. If these users own a
+ * blog, then the blog will also be removed
*
+ * @return Returns number of users purged,
+ * if 0, there is nothing left to purge
+ *
* @param amount
*/
function purgeUsers( $amount = DEFAULT_PURGE_AMOUNT )
{
lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" );
-
+
$users = new Users();
$deleted = 0;
// get $amount more users...
- $disabledUsers = $users->getAllUsers( USER_STATUS_DISABLED, "", 1, $amount );
-
+ $disabledUsers = $users->getAllUsers( USER_STATUS_DISABLED, "", "", 1, $amount );
// and process them
foreach( $disabledUsers as $user ) {
foreach( $user->getOwnBlogs() as $userBlog ) {
More information about the pLog-svn
mailing list