Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18501446
D18475.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D18475.diff
View Options
diff --git a/resources/sql/autopatches/20170825.phame.01.post.views.sql b/resources/sql/autopatches/20170825.phame.01.post.views.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20170825.phame.01.post.views.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_phame.phame_post
+ DROP COLUMN views;
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -4421,7 +4421,6 @@
'PhamePostTransactionQuery' => 'applications/phame/query/PhamePostTransactionQuery.php',
'PhamePostTransactionType' => 'applications/phame/xaction/PhamePostTransactionType.php',
'PhamePostViewController' => 'applications/phame/controller/post/PhamePostViewController.php',
- 'PhamePostViewsTransaction' => 'applications/phame/xaction/PhamePostViewsTransaction.php',
'PhamePostVisibilityTransaction' => 'applications/phame/xaction/PhamePostVisibilityTransaction.php',
'PhameSchemaSpec' => 'applications/phame/storage/PhameSchemaSpec.php',
'PhameSite' => 'applications/phame/site/PhameSite.php',
@@ -10054,7 +10053,6 @@
'PhamePostTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhamePostTransactionType' => 'PhabricatorModularTransactionType',
'PhamePostViewController' => 'PhameLiveController',
- 'PhamePostViewsTransaction' => 'PhamePostTransactionType',
'PhamePostVisibilityTransaction' => 'PhamePostTransactionType',
'PhameSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhameSite' => 'PhabricatorSite',
diff --git a/src/applications/phame/controller/post/PhamePostViewController.php b/src/applications/phame/controller/post/PhamePostViewController.php
--- a/src/applications/phame/controller/post/PhamePostViewController.php
+++ b/src/applications/phame/controller/post/PhamePostViewController.php
@@ -18,25 +18,6 @@
$is_live = $this->getIsLive();
$is_external = $this->getIsExternal();
- // Register a blog "view" count
- //
- if (!$post->isDraft() && !$post->isArchived()) {
- $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
- $xactions = array();
- $xactions[] = id(new PhamePostTransaction())
- ->setTransactionType(PhamePostViewsTransaction::TRANSACTIONTYPE)
- ->setNewValue(null);
-
- $editor = id(new PhamePostEditor())
- ->setActor($viewer)
- ->setContentSourceFromRequest($request)
- ->setContinueOnMissingFields(true)
- ->setContinueOnNoEffect(true);
-
- $editor->applyTransactions($post, $xactions);
- unset($unguarded);
- }
-
$header = id(new PHUIHeaderView())
->addClass('phame-header-bar')
->setUser($viewer);
@@ -170,11 +151,6 @@
->setUser($viewer)
->setObject($post);
- $views = id(new PhutilNumber($post->getViews()));
- $properties->addProperty(
- pht('Views'),
- pht('%s', $views));
-
$is_live = $this->getIsLive();
$is_external = $this->getIsExternal();
$next_view = new PhameNextPostView();
diff --git a/src/applications/phame/editor/PhamePostEditor.php b/src/applications/phame/editor/PhamePostEditor.php
--- a/src/applications/phame/editor/PhamePostEditor.php
+++ b/src/applications/phame/editor/PhamePostEditor.php
@@ -32,12 +32,6 @@
if ($object->isDraft() || ($object->isArchived())) {
return false;
}
- foreach ($xactions as $xaction) {
- switch ($xaction->getTransactionType()) {
- case PhamePostViewsTransaction::TRANSACTIONTYPE:
- return false;
- }
- }
return true;
}
@@ -47,12 +41,6 @@
if ($object->isDraft() || $object->isArchived()) {
return false;
}
- foreach ($xactions as $xaction) {
- switch ($xaction->getTransactionType()) {
- case PhamePostViewsTransaction::TRANSACTIONTYPE:
- return false;
- }
- }
return true;
}
diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php
--- a/src/applications/phame/storage/PhamePost.php
+++ b/src/applications/phame/storage/PhamePost.php
@@ -22,7 +22,6 @@
protected $phameTitle;
protected $body;
protected $visibility;
- protected $views;
protected $configData;
protected $datePublished;
protected $blogPHID;
@@ -41,8 +40,7 @@
->setBlogPHID($blog->getPHID())
->attachBlog($blog)
->setDatePublished(PhabricatorTime::getNow())
- ->setVisibility(PhameConstants::VISIBILITY_PUBLISHED)
- ->setViews(0);
+ ->setVisibility(PhameConstants::VISIBILITY_PUBLISHED);
return $post;
}
@@ -130,7 +128,6 @@
'subtitle' => 'text64',
'phameTitle' => 'sort64?',
'visibility' => 'uint32',
- 'views' => 'uint32',
'mailKey' => 'bytes20',
'headerImagePHID' => 'phid?',
diff --git a/src/applications/phame/xaction/PhamePostViewsTransaction.php b/src/applications/phame/xaction/PhamePostViewsTransaction.php
deleted file mode 100644
--- a/src/applications/phame/xaction/PhamePostViewsTransaction.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-final class PhamePostViewsTransaction
- extends PhamePostTransactionType {
-
- const TRANSACTIONTYPE = 'phame.post.views';
-
- public function generateOldValue($object) {
- return $object->getViews();
- }
-
- public function applyInternalEffects($object, $value) {
- $views = $object->getViews();
- $views++;
- $object->setViews($views);
- }
-
-}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Sep 5, 9:45 PM (5 d, 16 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8503617
Default Alt Text
D18475.diff (5 KB)
Attached To
Mode
D18475: Fix fatal on logged out Phame Post
Attached
Detach File
Event Timeline
Log In to Comment