Jump to content


Photo

Publish future entries task


When the publish future entries task runs automatically.. The blog stats cache is not updated, so the board index hook will not show..

I think I nailed this down.. Wow.. Ok.. So, when the task runs.. Well, this doesn't quite add up, so track on your own. When the task runs and there's an entry to be approved, I've been getting a 404 error through Firebug on the task..

That seems to track back to blogPost.php in the end..

	    	if ( ! $this->blog['blog_id'] )
	    	{
	    		$this->registry->output->showError( 'incorrect_use', 106186, null, null, 404 );
	    	}

When the task is run automatically, that is 0.. because, above that.. we have

			/* If we don't have a blog id, load one (@note	See todo for this method) */
			if ( empty( $this->request['blogid'] ) )
			{
				$blogs = $this->fetchPostableBlogs();
				
				if ( is_array( $blogs ) AND count( $blogs ) )
				{
					$_blog = array_shift( $blogs );
					
					$this->request['blogid'] = intval( $_blog['blog_id'] );
					$this->blogFunctions->setActiveBlog( intval( $this->request['blogid'] ) );
					
					$this->_needsBlogDropDown = true;
				}
			}
			
			$this->blog    = $this->blogFunctions->getActiveBlog();
			$this->blog_id = intval( $this->blog['blog_id'] );

So.. fetchPostableBlogs returns nothing, because, guests own no blogs. So, $this->request['blogid'] is empty.. When then, when we get into getActiveBlog, we have

	public function getActiveBlog()
	{
		if( empty($this->blog) && !empty($this->request['blogid']) )
		{
			$this->setActiveBlog($this->request['blogid']);
		}
		
		return $this->blog;
	}

$this->blog and $this->request['blogid'] are both empty. 0 is returned.

So, the problem actually is deeper than I originally thought.. Not only will it not rebuild the stats.. The REASON it won't rebuild the stats is because it can't send notification on the blog.

The original starting point of this..

			/* Fetch post class */
		
			$classToLoad  = IPSLib::loadLibrary( IPSLib::getAppDir('blog') . '/sources/classes/post/blogPost.php', 'blogPost', 'blog' );
			$post = new $classToLoad($this->registry);
			
			/* Send out like notifications */
			$__blogs = $this->loadBlog($blogIds);
			
			if( isset( $__blogs['blog_id'] ) )
			{
				$__blogs = array( $__blogs['blog_id'] => $__blogs );
			}
			
			foreach( $entries as $id => $entry )
			{
				$this->sendBlogLikeNotifications($__blogs[$entry['blog_id']], $entry);
			}

in blogFunctions.php.. If you have a blog set to be approved, when the task runs, it approves it, however, it fails out attempting to load the blog to send the notifications. I have no notifications on my blog, so.. Maybe that's part of it, too.

Status: Fixed
Version: 2.5.1
Fixed In: 2.5.2


1 Comments

Oh well, apparently I fixed this while fixing another bug report.