Example #1
0
 /**
  * Fetches the contents of the datastore from a Memcache Server
  *
  * @param	array	Array of items to fetch from the datastore
  *
  * @return	void
  */
 public function fetch($items)
 {
     if (!sizeof($items = $this->prepare_itemarray($items))) {
         return;
     }
     $this->fastDSFetch($items);
     if (empty($items)) {
         return true;
     }
     $check = $this->memcache->connect();
     if ($check == 3) {
         // Connection failed
         return parent::fetch($items);
     }
     $this->memcache_set = false;
     $unfetched_items = $this->do_fetch($items);
     $this->store_result = true;
     // some of the items we are looking for were not found, lets get them in one go
     if (!empty($unfetched_items)) {
         if (!($result = $this->do_db_fetch($this->prepare_itemlist($unfetched_items)))) {
             $this->memcache_set = true;
             return false;
         }
     }
     $this->memcache_set = true;
     $this->store_result = false;
     $this->check_options();
     $this->memcache->close();
     return true;
 }
Example #2
0
 /**
  * Fetches the contents of the datastore from cache files
  *
  * @param	array	Array of items to fetch from the datastore
  *
  * @return	void
  */
 public function fetch($items)
 {
     $include_return = @(include_once $this->datastoreLocation . '/datastore_cache.php');
     if ($include_return === false) {
         if (defined('VB_AREA') and VB_AREA == 'AdminCP') {
             trigger_error('Datastore cache file does not exist. Please reupload includes/datastore/datastore_cache.php from the original download.', E_USER_ERROR);
         } else {
             parent::fetch($items);
             return;
         }
     }
     $this->fastDSFetch($items);
     if (empty($items)) {
         return true;
     }
     // Ensure $this->cacheableitems are always fetched
     $unfetched_items = array();
     foreach ($this->cacheableitems as $item) {
         if (!array_key_exists($item, $this->registered)) {
             if (empty(${$item}) or !isset(${$item})) {
                 if (defined('VB_AREA') and VB_AREA == 'AdminCP') {
                     ${$item} = $this->fetch_build($item);
                 } else {
                     $unfetched_items[] = $item;
                     continue;
                 }
             }
             if ($this->register($item, ${$item}) === false) {
                 trigger_error('Unable to register some datastore items', E_USER_ERROR);
             }
         }
     }
     // fetch anything remaining
     $items = $items ? array_merge($items, $unfetched_items) : $unfetched_items;
     if ($items = $this->prepare_itemlist($items, true)) {
         if (!($result = $this->do_db_fetch($items))) {
             return false;
         }
     }
     $this->store_result = false;
     $this->check_options();
     return true;
 }
Example #3
0
 /**
  * Fetches the contents of the datastore from cache files
  *
  * @param	array	Array of items to fetch from the datastore
  *
  * @return	void
  */
 function fetch($itemarray)
 {
     $include_return = @(include_once DATASTORE . '/datastore_cache.php');
     if ($include_return === false) {
         if (VB_AREA == 'AdminCP') {
             trigger_error('Datastore cache file does not exist. Please reupload includes/datastore/datastore_cache.php from the original download.', E_USER_ERROR);
         } else {
             parent::fetch($itemarray);
             return;
         }
     }
     $itemlist = array();
     foreach ($this->cacheableitems as $item) {
         if (${$item} === '' or !isset(${$item})) {
             if (VB_AREA == 'AdminCP') {
                 ${$item} = $this->fetch_build($item);
             } else {
                 $itemlist[] = "'" . $this->dbobject->escape_string($item) . "'";
                 continue;
             }
         }
         if ($this->register($item, ${$item}) === false) {
             trigger_error('Unable to register some datastore items', E_USER_ERROR);
         }
         unset(${$item});
     }
     foreach ($this->defaultitems as $item) {
         if (!in_array($item, $this->cacheableitems)) {
             $itemlist[] = "'" . $this->dbobject->escape_string($item) . "'";
         }
     }
     if (is_array($itemarray)) {
         foreach ($itemarray as $item) {
             $itemlist[] = "'" . $this->dbobject->escape_string($item) . "'";
         }
     }
     if (!empty($itemlist)) {
         $this->do_db_fetch(implode(',', $itemlist));
     }
     $this->check_options();
     // set the version number variable
     $this->registry->versionnumber =& $this->registry->options['templateversion'];
 }
Example #4
0
	/**
	* Fetches the contents of the datastore from cache files
	*
	* @param	array	Array of items to fetch from the datastore
	*
	* @return	void
	*/
	function fetch($items)
	{
		$include_return = @include_once(DATASTORE . '/datastore_cache.php');
		if ($include_return === false)
		{
			if (VB_AREA == 'AdminCP')
			{
				trigger_error('Datastore cache file does not exist. Please reupload includes/datastore/datastore_cache.php from the original download.', E_USER_ERROR);
			}
			else
			{
				parent::fetch($items);
				return;
			}
		}

		// Ensure $this->cacheableitems are always fetched
		$unfetched_items = array();
		foreach ($this->cacheableitems AS $item)
		{
			if (!vB_DataStore::$registered[$item])
			{
				if ($$item === '' OR !isset($$item))
				{
					if (VB_AREA == 'AdminCP')
					{
						$$item = $this->fetch_build($item);
					}
					else
					{
						$unfetched_items[] = $item;
						continue;
					}
				}

				if ($this->register($item, $$item) === false)
				{
					trigger_error('Unable to register some datastore items', E_USER_ERROR);
				}

				unset($$item);
			}
		}

		// fetch anything remaining
		$items = $items ? array_merge($items, $unfetched_items) : $unfetched_items;
		if ($items = $this->prepare_itemlist($items, true))
		{
			if (!($result = $this->do_db_fetch($items)))
			{
				return false;
			}
		}

		$this->check_options();
		return true;
	}