Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct the links in the README.txt #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The design of MongoDB
makes it very easy to "just add another server"
with almost no downtime.

More info here: http://www.lampcms.com/features/
More info here: http://www.lampcms.com/features.htm



Expand All @@ -67,13 +67,13 @@ MongoDB database

MySQL database (yes, MySQL too, but only for one table)

More on requirements here: More info here: http://www.lampcms.com/requirements/
More on requirements here: More info here: http://www.lampcms.com/documentation.htm#requirements


INSTALLATION
==============

Installation instructions are here: http://www.lampcms.com/installation/
Installation instructions are here: http://www.lampcms.com/documentation.htm#installation


LICENSE
Expand Down
13 changes: 7 additions & 6 deletions lib/Lampcms/FollowManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@

namespace Lampcms;

use Lampcms\Mongo\Schema\Question as Schema;

class FollowManager extends LampcmsObject
{
/**
Expand Down Expand Up @@ -116,7 +118,7 @@ public function followQuestion(User $User, $Question)
{
d('cp');
$coll = $this->Registry->Mongo->QUESTIONS;
$coll->ensureIndex(array('a_flwrs' => 1), array('safe' => true));
$coll->ensureIndex(array(Schema::FOLLOWERS => 1));

if (!is_int($Question) && (!is_object($Question) || !($Question instanceof Question))) {
throw new DevException('$Question can only be instance of Question class or an integer representing question id');
Expand All @@ -141,8 +143,7 @@ public function followQuestion(User $User, $Question)
* using $addToSet Mongo operator, it
* ensures that if will NOT add duplicate value
*/
$coll->ensureIndex(array('a_flwrs', 1));
$coll->update(array('_id' => $qid), array('$addToSet' => array('a_flwrs' => $uid)));
$coll->update(array('_id' => $qid), array('$addToSet' => array(Schema::FOLLOWERS => $uid), '$set' => array(Schema::ETAG => time()) ) );
}

$this->Registry->Dispatcher->post($User, 'onQuestionFollow', array('qid' => $qid));
Expand Down Expand Up @@ -170,7 +171,7 @@ public function followQuestion(User $User, $Question)
public function unfollowQuestion(User $User, $Question)
{
$coll = $this->Registry->Mongo->QUESTIONS;
$coll->ensureIndex(array('a_flwrs' => 1));
$coll->ensureIndex(array(Schema::FOLLOWERS => 1));

if (!is_int($Question) && (!is_object($Question) || !($Question instanceof Question))) {
throw new DevException('$Question can only be instance of Question class or an integer representing question id');
Expand All @@ -194,7 +195,7 @@ public function unfollowQuestion(User $User, $Question)
* using $addToSet Mongo operator, it
* ensures that if will NOT add duplicate value
*/
$coll->update(array('_id' => $qid), array('$pull' => array('a_flwrs' => $uid)));
$coll->update(array('_id' => $qid), array('$pull' => array(Schema::FOLLOWERS => $uid), '$set' => array(Schema::ETAG => time()) ));
}

$this->Registry->Dispatcher->post($User, 'onQuestionUnfollow', array('qid' => $qid));
Expand All @@ -217,7 +218,7 @@ public function unfollowQuestion(User $User, $Question)
protected function checkQuestionExists($qid)
{

$a = $this->Registry->Mongo->QUESTIONS->findOne(array('_id' => (int)$qid), array('_id'));
$a = $this->Registry->Mongo->QUESTIONS->findOne(array(Schema::PRIMARY => (int)$qid), array('_id'));
if (empty($a)) {
throw new Exception('Question with id ' . $qid . ' not found');
}
Expand Down
16 changes: 16 additions & 0 deletions lib/Lampcms/Question.php
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,14 @@ public function addFollower($User)
if (!in_array($uid, $aFollowers)) {
$aFollowers[] = $uid;
$this->offsetSet(Schema::FOLLOWERS, $aFollowers);
/**
* Call touch() in order to reset value of etag
* the reason for this is that when user clicks 'follow' and refreshes
* the page (reload in browser) we need to show a new version and not
* the cached version in order to show the updated follow button
*
*/
$this->touch(true);
$this->save();
}

Expand Down Expand Up @@ -1006,6 +1014,14 @@ public function removeFollower($User)
d('cp unsetting key: ' . $key);
array_splice($aFollowers, $key, 1);
$this->offsetSet(Schema::FOLLOWERS, $aFollowers);
/**
* Call touch() in order to reset value of etag
* the reason for this is that when user clicks 'follow' and refreshes
* the page (reload in browser) we need to show a new version and not
* the cached version in order to show the updated follow button
*
*/
$this->touch(true);
$this->save();
}

Expand Down
4 changes: 2 additions & 2 deletions www/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@
/**
* Now replace translation strings
* identified as
* @
*
* @somestring@@
*
* @@somestring@@
*
*/
$output = $translator($output);
Expand Down