[pLog-svn] r3096 - in plog/trunk/class: cache config dao
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Wed Mar 22 21:53:56 GMT 2006
Author: oscar
Date: 2006-03-22 21:53:56 +0000 (Wed, 22 Mar 2006)
New Revision: 3096
Modified:
plog/trunk/class/cache/cachemanager.class.php
plog/trunk/class/config/configdbstorage.class.php
plog/trunk/class/dao/articlenotifications.class.php
plog/trunk/class/dao/articles.class.php
plog/trunk/class/dao/users.class.php
Log:
removed some unnecessary code
Modified: plog/trunk/class/cache/cachemanager.class.php
===================================================================
--- plog/trunk/class/cache/cachemanager.class.php 2006-03-22 19:06:47 UTC (rev 3095)
+++ plog/trunk/class/cache/cachemanager.class.php 2006-03-22 21:53:56 UTC (rev 3096)
@@ -12,11 +12,6 @@
{
var $cache;
- function CacheManager()
- {
-
- }
-
function clearCache()
{
$cacheInstance =& CacheManager::getCache();
@@ -32,10 +27,6 @@
require_once( PLOG_CLASS_PATH . "class/cache/cache.class.php" );
require_once( PLOG_CLASS_PATH . "class/config/config.class.php" );
- // damn .. produces a recursion.. need to fix that later on :)
- // $config =& Config::getConfig();
- // $temp_folder = $config->getUncachedValue( 'temp_folder' );
-
// define defaults
$cacheParameter = array(
'cacheDir' => "./tmp/",
Modified: plog/trunk/class/config/configdbstorage.class.php
===================================================================
--- plog/trunk/class/config/configdbstorage.class.php 2006-03-22 19:06:47 UTC (rev 3095)
+++ plog/trunk/class/config/configdbstorage.class.php 2006-03-22 21:53:56 UTC (rev 3096)
@@ -146,21 +146,6 @@
}
}
- function getUncachedValue( $key, $defaultValue = null )
- {
- if($this->_data == array()) {
- $this->_loadAllValuesFromDatabase();
- } else {
- if(array_key_exists($key, $this->_data)) {
- if ($this->_data[$key] == "" || $this->_data[$key] == null) {
- return $defaultValue;
- } else {
- return $this->_data[$key];
- }
- }
- }
- }
-
function setValue( $key, $value )
{
$this->_data[$key] = $value;
Modified: plog/trunk/class/dao/articlenotifications.class.php
===================================================================
--- plog/trunk/class/dao/articlenotifications.class.php 2006-03-22 19:06:47 UTC (rev 3095)
+++ plog/trunk/class/dao/articlenotifications.class.php 2006-03-22 21:53:56 UTC (rev 3096)
@@ -46,7 +46,7 @@
$notifications = Array();
while( $row = $result->FetchRow()) {
- array_push( $notifications, $this->_fillNotificationInformation( $row ));
+ array_push( $notifications, $this->mapRow( $row ));
}
return $notifications;
@@ -55,7 +55,7 @@
/**
* Internal function
*/
- function _fillNotificationInformation( $query_result )
+ function mapRow( $query_result )
{
$notification = new ArticleNotification( $query_result["user_id"],
$query_result["blog_id"],
@@ -118,7 +118,7 @@
return;
$articles = new Articles();
- $article = $articles->getBlogArticle( $postId, $blogId );
+ $article = $articles->getArticle( $postId );
// get the correct character set
$blogLocale =& $blogInfo->getLocale();
@@ -187,9 +187,51 @@
return $result;
}
-
/**
* Sends a weblogsUpdate.ping xmlrpc call to notifiy of changes in this blog
*
* @param blogInfo The BlogInfo object containing information about the blog
* @return Returns true if successful or false otherwise.
*/
function updateNotify( $blogInfo )
{
// source classes
include_once( PLOG_CLASS_PATH."class/net/xmlrpcclient.class.php" );
require_once( PLOG_CLASS_PATH . 'class/config/config.class.php' );
// if this feature is not enabled, we quit
$config =& Config::getConfig();
if( !$config->getValue( "xmlrpc_ping_enabled" ))
return;
// get the array which contains the hosts
$hosts = $config->getValue( "xmlrpc_ping_hosts" );
// if it is not an array, quit
if( !is_array($hosts))
return;
// if no hosts, we can quit too
if( empty($hosts))
return;
// otherwise, we continue
$xmlrpcPingResult = Array();
$rg = $blogInfo->getBlogRequestGenerator();
$blogLink = $rg->blogLink();
foreach( $hosts as $host ) {
$client = new XmlRpcClient( $host );
$result = $client->ping( $blogInfo->getBlog(), $blogLink);
//print("result = ".$result. "is Error = ".$client->isError()." message: ".$client->getErrorMessage()."<br/>");
//$xmlrpcPingResult[$result["host"]
$xmlrpcPingResult=array_merge($xmlrpcPingResult, $result);
}
return $xmlrpcPingResult;
}
/**
+ * Sends a weblogsUpdate.ping xmlrpc call to notifiy of changes in this blog
+ *
+ * @param blogInfo The BlogInfo object containing information about the blog
+ * @return Returns true if successful or false otherwise.
+ */
+ function updateNotify( $blogInfo )
+ {
+ // source classes
+ include_once( PLOG_CLASS_PATH."class/net/xmlrpcclient.class.php" );
+ require_once( PLOG_CLASS_PATH . 'class/config/config.class.php' );
+
+ // if this feature is not enabled, we quit
+ $config =& Config::getConfig();
+ if( !$config->getValue( "xmlrpc_ping_enabled" ))
+ return;
+
+ // get the array which contains the hosts
+ $hosts = $config->getValue( "xmlrpc_ping_hosts" );
+
+ // if it is not an array, quit
+ if( !is_array($hosts))
+ return;
+
+ // if no hosts, we can quit too
+ if( empty($hosts))
+ return;
+
+ // otherwise, we continue
+ $xmlrpcPingResult = Array();
+ $rg = $blogInfo->getBlogRequestGenerator();
+ $blogLink = $rg->blogLink();
+ foreach( $hosts as $host ) {
+ $client = new XmlRpcClient( $host );
+ $result = $client->ping( $blogInfo->getBlog(), $blogLink);
+ //print("result = ".$result. "is Error = ".$client->isError()." message: ".$client->getErrorMessage()."<br/>");
+ //$xmlrpcPingResult[$result["host"]
+ $xmlrpcPingResult=array_merge($xmlrpcPingResult, $result);
+ }
+
+ return $xmlrpcPingResult;
+ }
+
+ /**
* Returns the notifications but only for a particular user, a particular blog and
* a particular blog.
*
@@ -210,7 +252,7 @@
if( $result->RecordCount() == 0 )
return false;
- $notification = $this->_fillNotificationInformation( $result->fetchRow());
+ $notification = $this->mapRow( $result->fetchRow());
return $notification;
}
Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php 2006-03-22 19:06:47 UTC (rev 3095)
+++ plog/trunk/class/dao/articles.class.php 2006-03-22 21:53:56 UTC (rev 3096)
@@ -40,47 +40,9 @@
}
/**
- * Get all articles of a blog from the database and store it in the cache.
- *
- * @param blogId Identifier of the blog which articles we want to fetch
- * @return true
- */
- function getArticles( $blogId, $searchTerms = "", $page = -1, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
- {
- $blogArticles = $this->getMany( "blog_id",
- $blogId,
- null,
- Array( CACHE_ARTICLES => "getId" ),
- Array( "date" => "DESC" ),
- $searchTerms,
- $page,
- $itemsPerPage );
- return( $blogArticles );
- }
-
- /**
* Gets an article from the database, given its id
*
* @param artId Identifier of the article we want to fetch
- * @param userId If set, the article must belong to user identified by
- ** such id.
- * @return Returns an Article object or 'false' otherwise.
- */
- function getUserArticle( $artId, $userId = -1 )
- {
- $article = $this->getArticle( $artId );
- if( !$article )
- return false;
- if( $userId > -1 && $article->getOwnerId() != $userId )
- return false;
-
- return( $article );
- }
-
- /**
- * Gets an article from the database, given its id
- *
- * @param artId Identifier of the article we want to fetch
* @param blogId If set, the article must belong to the given blog
* @return Returns an Article object or 'false' otherwise.
*/
@@ -367,7 +329,14 @@
*
* @private
*/
- function buildWhere( $blogId, $date = -1, $amount = -1, $categoryId = 0, $status = 0, $userId = 0, $maxDate = 0, $searchTerms = "" )
+ function buildWhere( $blogId,
+ $date = -1,
+ $amount = -1,
+ $categoryId = 0,
+ $status = 0,
+ $userId = 0,
+ $maxDate = 0,
+ $searchTerms = "" )
{
$postStatus = $status;
$prefix = $this->getPrefix();
Modified: plog/trunk/class/dao/users.class.php
===================================================================
--- plog/trunk/class/dao/users.class.php 2006-03-22 19:06:47 UTC (rev 3095)
+++ plog/trunk/class/dao/users.class.php 2006-03-22 21:53:56 UTC (rev 3096)
@@ -64,28 +64,6 @@
}
/**
- * Returns all the information associated to the user given
- *
- * @deprecated please use authenticateUser() for auth and getUserInfoFromUsername()
- for userinfo by username
- * @param user Username of the user from who we'd like to get the information
- * @param pass Password of the user we'd like to get the information
- * @return Returns a UserInfo object with the requested information, or false otherwise.
- */
- function getUserInfo( $username, $pass = null )
- {
- if( $pass != null ) {
- if( !$this->authenticateUser($username, $pass) )
- return false;
- }
-
- $userInfo = $this->getUserInfoFromUsername( $username );
-
- return $userInfo;
-
- }
-
- /**
* Retrieves the user information but given only a username
*
* @param username The username of the user
More information about the pLog-svn
mailing list