Version 3.3.4
This commit is contained in:
1 parent
78706903a2
commit
fb6b5baabc
2206 files changed
+409828
-382984
No files matched your search
@@ -3,12 +3,12 @@
|
||||
* @file composite.php Provides classes to manage the like system
|
||||
*~TERABYTE_DOC_READY~
|
||||
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
|
||||
* $License: This is NULLED!
|
||||
* $Author: bfarber $
|
||||
* $License: http://www.invisionpower.com/company/standards.php#license$
|
||||
* $Author: ips_terabyte $
|
||||
* @since 11th October 2010
|
||||
* $LastChangedDate: 2011-10-05 21:08:45 -0400 (Wed, 05 Oct 2011) $
|
||||
* @version v3.2.3
|
||||
* $Revision: 9586 $
|
||||
* $LastChangedDate: 2012-06-18 11:11:25 -0400 (Mon, 18 Jun 2012) $
|
||||
* @version v3.3.4
|
||||
* $Revision: 10937 $
|
||||
*
|
||||
* <b>Example Usage:</b>
|
||||
* @code
|
||||
@@ -16,7 +16,6 @@
|
||||
* $area = 'images';
|
||||
* $like = classes_like::bootstrap( $app, $area );
|
||||
* print $like->isLiked( $relId );
|
||||
|
||||
* $html = $like->render( 'summary', $relId );
|
||||
* print $html;
|
||||
*
|
||||
@@ -309,8 +308,12 @@ class classes_like
|
||||
}
|
||||
|
||||
/* Pointless comment! */
|
||||
$_file = IPSLib::getAppDir( $app ) . '/extensions/like/' . $area . '.php';
|
||||
$_class = 'like_' . $app . '_' . $area . '_composite';
|
||||
if( $area != 'default' )
|
||||
{
|
||||
$_file = IPSLib::getAppDir( $app ) . '/extensions/like/' . $area . '.php';
|
||||
$_class = 'like_' . $app . '_' . $area . '_composite';
|
||||
}
|
||||
|
||||
$_key = md5( $app . $area );
|
||||
|
||||
/* Get from cache if already cached */
|
||||
@@ -475,7 +478,7 @@ abstract class classes_like_composite
|
||||
}
|
||||
|
||||
/* first check to ensure we've not already like'd this item */
|
||||
if ( $this->isLiked($relId, $memberId) )
|
||||
if ( $this->isLiked( $relId, $memberId, true ) )
|
||||
{
|
||||
/* if any one cares to check, then we're all good */
|
||||
return false;
|
||||
@@ -532,12 +535,15 @@ abstract class classes_like_composite
|
||||
*
|
||||
* @param integer $relId Relationship ID
|
||||
* @param array $type Types of notifications to send (Possible: immediate, offline, daily, weekly)
|
||||
* @param array $notificationOpts Notification options [Keys: notification_key, notification_url, email_template, email_subject, build_message_array, from (optional)]
|
||||
* @param array $notificationOpts Notification options [Keys: notification_key, notification_url, email_template, email_subject, email_lang_file, email_lang_app, build_message_array, from (optional), ignore_data( type => ids )]
|
||||
* @param array $sentToIds Pass a value by reference to get the ID numbers of members that were sent a notification
|
||||
* @return @e boolean
|
||||
* @see allowedFrequencies()
|
||||
*/
|
||||
public function sendNotifications( $relId, $type, $notificationOpts=array() )
|
||||
public function sendNotifications( $relId, $type, $notificationOpts=array(), &$sentToIds=array() )
|
||||
{
|
||||
$sentToIds = array();
|
||||
|
||||
if ( empty( $relId ) )
|
||||
{
|
||||
trigger_error( "Data missing in " . __CLASS__ . '::' . __FUNCTION__, E_USER_WARNING );
|
||||
@@ -554,10 +560,10 @@ abstract class classes_like_composite
|
||||
}
|
||||
|
||||
$expire = IPS_UNIX_TIME_NOW - $_limit;
|
||||
|
||||
|
||||
/* Fetch data by relID */
|
||||
$data = $this->getDataByRelationshipId( $relId, false );
|
||||
|
||||
$data = $this->getDataByRelationshipId( $relId, false, (array) $notificationOpts['ignore_data'], $type );
|
||||
|
||||
/* Remove ourselves from notifications... */
|
||||
if ( $this->memberData['member_id'] && isset($data[ $this->memberData['member_id'] ]) && $notificationOpts['includeOwner'] !== true )
|
||||
{
|
||||
@@ -597,6 +603,13 @@ abstract class classes_like_composite
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Extra protection in case a ghost record is in the table for a member that doesn't exist
|
||||
@link http://community.invisionpower.com/tracker/issue-36793-error-when-editing-some-marketplace-files */
|
||||
if( !$row['like_member_id'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$buildMessage = array();
|
||||
|
||||
@@ -613,11 +626,13 @@ abstract class classes_like_composite
|
||||
}
|
||||
}
|
||||
|
||||
$sentToIds[] = $row['like_member_id'];
|
||||
|
||||
/* Add in unsubscribe link */
|
||||
$key = $row['like_app'] . ';' . $row['like_area'] . ';' . $row['like_rel_id'] . ';' . $row['like_member_id'] . ';' . $row['member_id'] . ';' . $row['email'];
|
||||
$buildMessage['UNSUBCRIBE_URL'] = $this->registry->output->buildSEOUrl( 'app=core&module=global&section=like&do=unsubscribe&key=' . IPSText::base64_encode_urlSafe( $key ), 'public', 'unsubscribe', 'likeunsubscribe' );
|
||||
|
||||
IPSText::getTextClass('email')->setPlainTextTemplate( IPSText::getTextClass('email')->getTemplate( $notificationOpts['email_template'], $row['language'] ) );
|
||||
|
||||
IPSText::getTextClass('email')->setPlainTextTemplate( IPSText::getTextClass('email')->getTemplate( $notificationOpts['email_template'], $row['language'], trim($notificationOpts['email_lang_file']), trim($notificationOpts['email_lang_app']) ) );
|
||||
IPSText::getTextClass('email')->buildMessage( $buildMessage );
|
||||
|
||||
$notifyLibrary->setMember( $row );
|
||||
@@ -625,7 +640,13 @@ abstract class classes_like_composite
|
||||
$notifyLibrary->setNotificationKey( $notificationOpts['notification_key'] );
|
||||
$notifyLibrary->setNotificationUrl( $notificationOpts['notification_url'] );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->getPlainTextContent() );
|
||||
$notifyLibrary->setNotificationTitle( $notificationOpts['email_subject'] );
|
||||
$notifyLibrary->setNotificationTitle( $notificationOpts['email_subject'] ? $notificationOpts['email_subject'] : IPSText::getTextClass('email')->subject );
|
||||
|
||||
if ( ! empty( $notificationOpts['email_only_subject'] ) && $notificationOpts['email_only_subject'] != IPSText::getTextClass('email')->subject )
|
||||
{
|
||||
$notifyLibrary->setEmailSubject( $notificationOpts['email_only_subject'], $row['language'], trim($notificationOpts['email_lang_file']), trim($notificationOpts['email_lang_app']) );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$notifyLibrary->sendNotification();
|
||||
@@ -639,28 +660,48 @@ abstract class classes_like_composite
|
||||
$this->DB->update( 'core_like', array( 'like_notify_sent' => IPS_UNIX_TIME_NOW ), "like_id='" . classes_like_registry::getKey( $row['like_rel_id'], $row['like_member_id'] ) . "'" );
|
||||
}
|
||||
|
||||
return true;
|
||||
return ( is_array( $sentToIds ) ) ? array_unique( $sentToIds ) : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send digest notifications to anyone subscribed to item
|
||||
*
|
||||
* @param string $type Types of notifications to send (Possible: daily, weekly)
|
||||
* @param integer $sendMax Null (use ipsRegistry::$setting or send INT only)
|
||||
* @return @e boolean
|
||||
* @see allowedFrequencies()
|
||||
*/
|
||||
public function sendDigestNotifications( $type )
|
||||
public function sendDigestNotifications( $type, $sendMax=null )
|
||||
{
|
||||
/* Fetch data */
|
||||
$blackhole = mktime( 0, 0 );
|
||||
$blackhole = time(); // mktime( 0, 0 ); - http://community.invisionpower.com/tracker/issue-35320-daily-digests-every-2-days
|
||||
$time = ( $type == 'daily' ) ? $blackhole - ( 86400 ) : $blackhole - ( 86400 * 7 );
|
||||
$data = $this->getDataByAreaAndLastSentOlderThanDate( $time, array( 'daily', 'weekly' ) );
|
||||
$data = $this->getDataByAreaAndLastSentOlderThanDate( $time, array( $type ), false, $sendMax );
|
||||
|
||||
if ( ! count( $data ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Check for outdated notifications and update them as required */
|
||||
$oldestPossDate = 0;
|
||||
|
||||
if ( $type == 'daily' )
|
||||
{
|
||||
/* Grab 4 days to account for timezone differences */
|
||||
$oldestPossDate = $blackhole - ( 86400 * 4 );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Grab 10 days to ensure we don't update rows ready to be sent */
|
||||
$oldestPossDate = $blackhole - ( 86400 * 10 );
|
||||
}
|
||||
|
||||
if ( $oldestPossDate )
|
||||
{
|
||||
$this->DB->update( 'core_like', array( 'like_notify_sent' => IPS_UNIX_TIME_NOW ), 'like_notify_sent < ' . $oldestPossDate );
|
||||
}
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
|
||||
$notifyLibrary = new $classToLoad( $this->registry );
|
||||
|
||||
@@ -669,24 +710,23 @@ abstract class classes_like_composite
|
||||
{
|
||||
foreach( $_rows as $row )
|
||||
{
|
||||
if ( ! $row['like_notify_freq'] OR ! in_array( $row['like_notify_freq'], array( 'daily', 'weekly' ) ) )
|
||||
if ( ! $row['like_notify_freq'] OR $row['like_notify_freq'] != $type )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Make sure we don't send huge digests if this is their first email since subscribing */
|
||||
$row['like_notify_sent'] = $row['like_notify_sent'] ? $row['like_notify_sent'] : $row['like_added'];
|
||||
|
||||
if( $row['like_notify_sent'] < ( time() - 604800 ) )
|
||||
{
|
||||
$row['like_notify_sent'] = time() - 604800;
|
||||
}
|
||||
|
||||
|
||||
/* Want to fetch the data from the plug in files? */
|
||||
$notificationOpts = $this->buildNotificationData( $row, $type );
|
||||
|
||||
if ( ! is_array( $notificationOpts ) OR ! count( $notificationOpts ) )
|
||||
{
|
||||
/* This will get hit if topic hasn't had a post since notification was last sent - to prevent the same row from getting picked up each time this runs
|
||||
we need to update the last sent timestamp for the like */
|
||||
$this->DB->update( 'core_like', array( 'like_notify_sent' => IPS_UNIX_TIME_NOW ), 'like_id=\'' . classes_like_registry::getKey( $row['like_rel_id'], $row['like_member_id'] ) . '\'' );
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -705,7 +745,7 @@ abstract class classes_like_composite
|
||||
}
|
||||
}
|
||||
|
||||
IPSText::getTextClass('email')->getTemplate( $notificationOpts['email_template'], $row['language'] );
|
||||
IPSText::getTextClass('email')->getTemplate( $notificationOpts['email_template'], $row['language'], trim($notificationOpts['email_lang_file']), trim($notificationOpts['email_lang_app']) );
|
||||
IPSText::getTextClass('email')->buildMessage( $buildMessage );
|
||||
|
||||
$notifyLibrary->setMember( $row );
|
||||
@@ -713,7 +753,8 @@ abstract class classes_like_composite
|
||||
$notifyLibrary->setNotificationKey( $notificationOpts['notification_key'] );
|
||||
$notifyLibrary->setNotificationUrl( $notificationOpts['notification_url'] );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
|
||||
$notifyLibrary->setNotificationTitle( $notificationOpts['email_subject'] );
|
||||
$notifyLibrary->setNotificationTitle( $notificationOpts['email_subject'] ? $notificationOpts['email_subject'] : IPSText::getTextClass('email')->subject );
|
||||
|
||||
try
|
||||
{
|
||||
$notifyLibrary->sendNotification();
|
||||
@@ -828,6 +869,72 @@ abstract class classes_like_composite
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a member's ID in the like rows
|
||||
*
|
||||
* @param integer Old Id
|
||||
* @param integer New Id
|
||||
*/
|
||||
public function updateMemberId( $oldId, $newId )
|
||||
{
|
||||
$_likes = array();
|
||||
|
||||
/* We might be merging */
|
||||
$this->DB->build( array( 'select' => 'like_lookup_id', 'from' => 'core_like', 'where' => "like_member_id=" . $newId ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$_likes[] = $r['like_lookup_id'];
|
||||
}
|
||||
/* not done */
|
||||
if ( count( $_likes ) )
|
||||
{
|
||||
$this->DB->update( 'core_like' , array( 'like_member_id' => $newId ), "like_member_id=" . $oldId . " AND like_lookup_id NOT IN('" . implode( "','", array_map( 'addslashes', $_likes ) ) . "')" );
|
||||
$this->DB->delete( 'core_like_cache' , "like_cache_id IN('" . implode( "','", array_map( 'addslashes', $_likes ) ) . "')" );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->update( 'core_like' , array( 'like_member_id' => $newId ), "like_member_id=" . $oldId );
|
||||
}
|
||||
|
||||
/* Now remove duplicates */
|
||||
$dupes = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'like_id, count(*) as cnt',
|
||||
'from' => 'core_like',
|
||||
'where' => 'like_member_id=' . $newId,
|
||||
'group' => 'like_app, like_area, like_member_id, like_rel_id',
|
||||
'order' => 'cnt desc' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
if ( $row['cnt'] < 2 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
$dupes[] = $row['like_id'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Do it? */
|
||||
if ( count( $dupes ) )
|
||||
{
|
||||
$this->DB->delete( 'core_like' , "like_cache IN('" . implode( "','", array_map( 'addslashes', $dupes ) ) . "')" );
|
||||
}
|
||||
|
||||
/* Now re-update so that hashes are correct */
|
||||
$update = "like_id=MD5( CONCAT( like_app, ';', like_area, ';', like_rel_id, ';', like_member_id ) ), " .
|
||||
"like_lookup_area=MD5( CONCAT( like_app, ';', like_area, ';', like_member_id ) )";
|
||||
|
||||
$where = "like_member_id=" . $newId;
|
||||
|
||||
$this->DB->update( 'core_like', $update, $where, false, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of people who 'like' the item
|
||||
*
|
||||
@@ -849,6 +956,7 @@ abstract class classes_like_composite
|
||||
* @param array $opts Options
|
||||
* @param integer $memberId Member ID
|
||||
* @return @e string Formatted HTML
|
||||
* @todo If $cache['count'] is 0, we can probably skip the getDataByMemberIdAndRelationshipId() call as it will be empty
|
||||
*/
|
||||
public function render( $view, $relId, $opts=array(), $memberId=null )
|
||||
{
|
||||
@@ -861,7 +969,7 @@ abstract class classes_like_composite
|
||||
$max = 0;
|
||||
|
||||
/* Fetch data for us? */
|
||||
if ( $this->memberData['member_id'] )
|
||||
if ( $this->memberData['member_id'] && ( $cache['count'] + $cache['count_anon'] ) > 0 )
|
||||
{
|
||||
/* We can't use isLiked or it runs twice the query and adding a cache to the function doesn't work either */
|
||||
$_me = $this->getDataByMemberIdAndRelationshipId( $relId, $this->memberData['member_id'] );
|
||||
@@ -1006,12 +1114,13 @@ abstract class classes_like_composite
|
||||
*
|
||||
* @param mixed $relId Relationship IDs (int|array)
|
||||
* @param integer $memberId Member ID
|
||||
* @param boolean $checkNotVisibleToo return a match even if not visible to the user
|
||||
* @return @e boolean
|
||||
*/
|
||||
public function isLiked( $relId, $memberId )
|
||||
public function isLiked( $relId, $memberId, $checkNotVisibleToo=false )
|
||||
{
|
||||
/* Grab the data */
|
||||
return ( $this->getDataByMemberIdAndRelationshipId( $relId, $memberId ) === null ) ? false : true;
|
||||
return ( $this->getDataByMemberIdAndRelationshipId( $relId, $memberId, $checkNotVisibleToo ) === null ) ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1019,9 +1128,10 @@ abstract class classes_like_composite
|
||||
*
|
||||
* @param mixed $relId Relationship IDs (int|array)
|
||||
* @param integer $memberId Member ID
|
||||
* @param boolean $checkNotVisibleToo return a match even if not visible to the user
|
||||
* @return @e mixed Array of likes data OR null
|
||||
*/
|
||||
public function getDataByMemberIdAndRelationshipId( $relId, $memberId )
|
||||
public function getDataByMemberIdAndRelationshipId( $relId, $memberId, $checkNotVisibleToo=false )
|
||||
{
|
||||
$where = '';
|
||||
$data = null;
|
||||
@@ -1049,7 +1159,10 @@ abstract class classes_like_composite
|
||||
|
||||
}
|
||||
|
||||
$where .= ' AND like_visible=1';
|
||||
if ( $checkNotVisibleToo === false )
|
||||
{
|
||||
$where .= ' AND like_visible=1';
|
||||
}
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'core_like',
|
||||
@@ -1103,24 +1216,34 @@ abstract class classes_like_composite
|
||||
*
|
||||
* @param integer $relId Relationship ID
|
||||
* @param boolean $skipAnon Skip anonymous rows flag
|
||||
* @param array
|
||||
* @param array Type of follow (immediate, none, offline, daily, etc)
|
||||
* @return @e mixed Array of likes data OR null
|
||||
*/
|
||||
public function getDataByRelationshipId( $relId, $skipAnon=true )
|
||||
public function getDataByRelationshipId( $relId, $skipAnon=true, $ignoreData=array(), $followType=array() )
|
||||
{
|
||||
/* Init */
|
||||
$mids = array();
|
||||
$members = array();
|
||||
$rows = array();
|
||||
$_isAnon = $skipAnon ? 'AND like_is_anon=0' : '';
|
||||
$_whereB = $this->memberData['member_id'] ? " OR like_id='" . classes_like_registry::getKey( $relId, $this->memberData['member_id'] ) . "'" : '';
|
||||
$mids = array();
|
||||
$members = array();
|
||||
$rows = array();
|
||||
$followType = is_array( $followType ) ? $followType : array( $followType );
|
||||
$_isAnon = $skipAnon ? 'AND like_is_anon=0' : '';
|
||||
$_whereB = $this->memberData['member_id'] ? " OR like_id='" . classes_like_registry::getKey( $relId, $this->memberData['member_id'] ) . "'" : '';
|
||||
|
||||
/* Fetch data */
|
||||
/* Add in follow type */
|
||||
if ( count( $followType ) )
|
||||
{
|
||||
$_whereB .= " AND like_notify_freq IN ('" . implode( "','", $followType ) ."')";
|
||||
}
|
||||
|
||||
/* Fetch data */
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'core_like',
|
||||
'where' => "((like_lookup_id='" . classes_like_registry::getKey( $relId ) . "' {$_isAnon}) {$_whereB}) AND like_visible=1",
|
||||
'order' => 'like_added DESC',
|
||||
'limit' => array( 0, 250 ) ) );
|
||||
|
||||
'limit' => array( 0, 500 ) ) );
|
||||
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $o ) )
|
||||
@@ -1141,6 +1264,27 @@ abstract class classes_like_composite
|
||||
}
|
||||
}
|
||||
|
||||
/* Are we giving this bloke a good ignoring? */
|
||||
if ( !empty( $ignoreData ) )
|
||||
{
|
||||
$ignoreWhere = array();
|
||||
foreach ( $ignoreData as $type => $ids )
|
||||
{
|
||||
$ignoreWhere[] = "( {$type}=1 AND " . $this->DB->buildWherePermission( $ids, 'ignore_ignore_id', FALSE ) . ')';
|
||||
}
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'ignored_users', 'where' => implode( ' OR ', $ignoreWhere ) ) );
|
||||
$this->DB->execute();
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
if ( isset( $data[ $row['ignore_owner_id'] ] ) )
|
||||
{
|
||||
unset( $data[ $row['ignore_owner_id'] ] );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return is_array($data) ? $data : null;
|
||||
}
|
||||
|
||||
@@ -1150,10 +1294,11 @@ abstract class classes_like_composite
|
||||
* @param integer $date Unix timestamp
|
||||
* @param array $types Array of notification types (optional)
|
||||
* @param array $parseMembers Parse extra data for each member and build display photo (false is default)
|
||||
* @param integer $sendMax Null (use ipsRegistry::$setting or send INT only)
|
||||
* @return @e mixed Array of likes data OR null
|
||||
* @see allowedFrequencies()
|
||||
*/
|
||||
public function getDataByAreaAndLastSentOlderThanDate( $date, $types=array(), $parseMembers=false )
|
||||
public function getDataByAreaAndLastSentOlderThanDate( $date, $types=array(), $parseMembers=false, $sendMax=null )
|
||||
{
|
||||
/* Init */
|
||||
$mids = array();
|
||||
@@ -1161,6 +1306,7 @@ abstract class classes_like_composite
|
||||
$rows = array();
|
||||
$joins = array();
|
||||
$where = ( is_array( $types ) ) ? ' AND l.like_notify_freq IN (\'' . implode( "','", $types ) . '\')' : '';
|
||||
$sendMax = ( $sendMax !== null ) ? $sendMax : ipsRegistry::$settings['like_notifications_limit'];
|
||||
|
||||
/* figure out joins */
|
||||
$joins[] = array( 'select' => 'm.*',
|
||||
@@ -1177,13 +1323,32 @@ abstract class classes_like_composite
|
||||
$joins[] = $join;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Prevent it going back EONS AND EONS */
|
||||
$oldestPossDate = 0;
|
||||
|
||||
if ( in_array( 'weekly', $types ) )
|
||||
{
|
||||
/* Grab 8 days to account for timezone differences */
|
||||
$oldestPossDate = $date - ( 86400 * 8 );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Grab 2 days to account for timezone differences */
|
||||
$oldestPossDate = $date - ( 86400 * 2 );
|
||||
}
|
||||
|
||||
if ( $oldestPossDate )
|
||||
{
|
||||
$where .= ' AND ( CASE WHEN l.like_notify_sent > 0 THEN l.like_notify_sent ELSE l.like_added END ) > ' . intval( $oldestPossDate );
|
||||
}
|
||||
|
||||
/* Fetch data */
|
||||
$this->DB->build( array( 'select' => 'l.*',
|
||||
'from' => array( 'core_like' => 'l' ),
|
||||
'where' => 'l.like_notify_do=1 AND l.like_app=\'' . classes_like_registry::getApp() . '\' AND l.like_area=\'' . classes_like_registry::getArea() . '\' AND l.like_visible=1 AND l.like_notify_sent < ' . intval( $date ) . $where,
|
||||
'where' => 'l.like_notify_do=1 AND l.like_app=\'' . classes_like_registry::getApp() . '\' AND l.like_area=\'' . classes_like_registry::getArea() . '\' AND l.like_visible=1 AND ( CASE WHEN l.like_notify_sent > 0 THEN l.like_notify_sent ELSE l.like_added END ) < ' . intval( $date ) . $where,
|
||||
'order' => 'l.like_notify_sent ASC',
|
||||
'limit' => array( 0, ipsRegistry::$settings['like_notifications_limit'] ),
|
||||
'limit' => array( 0, $sendMax ),
|
||||
'add_join' => $joins ) );
|
||||
|
||||
$o = $this->DB->execute();
|
||||
@@ -1193,9 +1358,19 @@ abstract class classes_like_composite
|
||||
$row['like_member_id'] = intval($row['like_member_id']);
|
||||
$mids[ $row['like_member_id'] ] = $row['like_member_id'];
|
||||
|
||||
/* Need to apply secondary groups and grab g_perm_id if $parseMembers is false (default)
|
||||
@link http://community.invisionpower.com/tracker/issue-34691-digest-notifications-not-going-out/ */
|
||||
$row['mgroup_others'] = ($row['mgroup_others'] != '') ? IPSText::cleanPermString($row['mgroup_others']) : '';
|
||||
$row = array_merge( $row, $this->caches['group_cache'][ $row['member_group_id'] ] );
|
||||
$row = $this->registry->member()->setUpSecondaryGroups( $row );
|
||||
|
||||
if( $row['topic_last_post'] )
|
||||
{
|
||||
$row['last_post'] = $row['topic_last_post'];
|
||||
}
|
||||
|
||||
/* @link http://community.invisionpower.com/tracker/issue-32204-dailyweekly-notifications */
|
||||
$data[ $row['like_member_id'] ][ $row['like_id'] ] = $row;
|
||||
|
||||
}
|
||||
|
||||
/* Just the one? */
|
||||
@@ -1605,7 +1780,7 @@ class classes_like_cache
|
||||
'where' => 'like_cache_id=\'' . classes_like_registry::getKey( $relId ) . '\'' ) );
|
||||
|
||||
if ( !is_array($cache) OR $cache['like_cache_expire'] <= IPS_UNIX_TIME_NOW )
|
||||
{
|
||||
{
|
||||
/* We don't have a valid cache, so create one and return the data */
|
||||
$cache = $this->create( $relId, $memberId );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user