b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (0.9.x) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Source for file _class_blogcache.php

Documentation is available at _class_blogcache.php

  1. <?php
  2. /**
  3.  * Blog Cache Class
  4.  *
  5.  * b2evolution - {@link http://b2evolution.net/}
  6.  * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
  7.  * @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
  8.  *
  9.  * @package evocore
  10.  */
  11. if!defined('DB_USER') ) die'Please, do not access this page directly.' );
  12.  
  13. /**
  14.  * Includes:
  15.  */
  16. require_once dirname(__FILE__).'/_class_dataobjectcache.php';
  17.  
  18. /**
  19.  * Blog Cache Class
  20.  *
  21.  * @package evocore
  22.  */
  23. class BlogCache extends DataObjectCache
  24. {
  25.     /**
  26.      * Constructor
  27.      *
  28.      * {@internal BlogCache::BlogCache(-) }}
  29.      */
  30.     function BlogCache()
  31.     {
  32.         global $tableblogs;
  33.         
  34.         parent::DataObjectCache'Blog'false$tableblogs'blog_''blog_ID' );
  35.     }
  36.  
  37.     /**
  38.      * Get an object from cache by its stub
  39.      *
  40.      * Load the cache if necessary
  41.      *
  42.      * {@internal BlogCache::get_by_stub(-) }}
  43.      *
  44.      * @param string stub of object to load
  45.      * @param boolean false if you want to return false on error
  46.      */
  47.     function get_by_stub$req_stub$halt_on_error true )
  48.     {
  49.         global $DB;
  50.  
  51.         // Load just the requested object:
  52.         debug_log"Loading <strong>$this->objtype($req_stub)</strong> into cache);
  53.         $sql "SELECT * 
  54.                         FROM $this->dbtablename 
  55.                         WHERE blog_stub = ".$DB->quote($req_stub);
  56.         $row $DB->get_row$sql );
  57.         ifempty$row ) )
  58.         {    // Requested object does not exist
  59.             if$halt_on_error die"Requested $this->objtype does not exist!);
  60.             return false;
  61.         }
  62.         
  63.         $dbIDname $this->dbIDname;
  64.         $objtype $this->objtype;
  65.         $this->cache$row->$dbIDname new $objtype$row )// COPY!
  66.  
  67.         return $this->cache$row->$dbIDname ];
  68.     }
  69. }
  70. ?>

Documentation generated on Tue, 20 May 2008 01:52:31 +0200 by phpDocumentor 1.4.2