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 index 0000000000..5cb5c9c7b6 --- /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 index f0c9271634..4575908ef8 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -4421,7 +4421,6 @@ phutil_register_library_map(array( '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 @@ phutil_register_library_map(array( '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 index 7dbaddc17a..63adedb7ae 100644 --- a/src/applications/phame/controller/post/PhamePostViewController.php +++ b/src/applications/phame/controller/post/PhamePostViewController.php @@ -18,25 +18,6 @@ final class PhamePostViewController $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 @@ final class PhamePostViewController ->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 index 9dea9692bf..488d7a4938 100644 --- a/src/applications/phame/editor/PhamePostEditor.php +++ b/src/applications/phame/editor/PhamePostEditor.php @@ -32,12 +32,6 @@ final class PhamePostEditor 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 @@ final class PhamePostEditor 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 index c3ec4d4608..a9525e0be7 100644 --- a/src/applications/phame/storage/PhamePost.php +++ b/src/applications/phame/storage/PhamePost.php @@ -22,7 +22,6 @@ final class PhamePost extends PhameDAO protected $phameTitle; protected $body; protected $visibility; - protected $views; protected $configData; protected $datePublished; protected $blogPHID; @@ -41,8 +40,7 @@ final class PhamePost extends PhameDAO ->setBlogPHID($blog->getPHID()) ->attachBlog($blog) ->setDatePublished(PhabricatorTime::getNow()) - ->setVisibility(PhameConstants::VISIBILITY_PUBLISHED) - ->setViews(0); + ->setVisibility(PhameConstants::VISIBILITY_PUBLISHED); return $post; } @@ -130,7 +128,6 @@ final class PhamePost extends PhameDAO '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 index 2260a1d752..0000000000 --- a/src/applications/phame/xaction/PhamePostViewsTransaction.php +++ /dev/null @@ -1,18 +0,0 @@ -getViews(); - } - - public function applyInternalEffects($object, $value) { - $views = $object->getViews(); - $views++; - $object->setViews($views); - } - -}