Select the types of activity you want to include in your feed.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
···11+<?php
22+33+/*
44+ * Copyright 2011 Facebook, Inc.
55+ *
66+ * Licensed under the Apache License, Version 2.0 (the "License");
77+ * you may not use this file except in compliance with the License.
88+ * You may obtain a copy of the License at
99+ *
1010+ * http://www.apache.org/licenses/LICENSE-2.0
1111+ *
1212+ * Unless required by applicable law or agreed to in writing, software
1313+ * distributed under the License is distributed on an "AS IS" BASIS,
1414+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515+ * See the License for the specific language governing permissions and
1616+ * limitations under the License.
1717+ */
1818+1919+class DiffusionLastModifiedController extends DiffusionController {
2020+2121+ public function processRequest() {
2222+ $drequest = $this->getDiffusionRequest();
2323+ $request = $this->getRequest();
2424+2525+ $modified_query = DiffusionLastModifiedQuery::newFromDiffusionRequest(
2626+ $drequest);
2727+ list($commit, $commit_data) = $modified_query->loadLastModification();
2828+2929+ $output = DiffusionBrowseTableView::renderLastModifiedColumns(
3030+ $drequest->getRepository(),
3131+ $commit,
3232+ $commit_data);
3333+3434+ return id(new AphrontAjaxResponse())
3535+ ->setContent($output);
3636+ }
3737+}
···11+<?php
22+33+/*
44+ * Copyright 2011 Facebook, Inc.
55+ *
66+ * Licensed under the Apache License, Version 2.0 (the "License");
77+ * you may not use this file except in compliance with the License.
88+ * You may obtain a copy of the License at
99+ *
1010+ * http://www.apache.org/licenses/LICENSE-2.0
1111+ *
1212+ * Unless required by applicable law or agreed to in writing, software
1313+ * distributed under the License is distributed on an "AS IS" BASIS,
1414+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515+ * See the License for the specific language governing permissions and
1616+ * limitations under the License.
1717+ */
1818+1919+abstract class DiffusionLastModifiedQuery {
2020+2121+ private $request;
2222+2323+ final private function __construct() {
2424+ // <private>
2525+ }
2626+2727+ final public static function newFromDiffusionRequest(
2828+ DiffusionRequest $request) {
2929+3030+ $repository = $request->getRepository();
3131+3232+ switch ($repository->getVersionControlSystem()) {
3333+ case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
3434+ $class = 'DiffusionGitLastModifiedQuery';
3535+ break;
3636+ case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
3737+ $class = 'DiffusionSvnLastModifiedQuery';
3838+ break;
3939+ default:
4040+ throw new Exception("Unsupported VCS!");
4141+ }
4242+4343+ PhutilSymbolLoader::loadClass($class);
4444+ $query = new $class();
4545+4646+ $query->request = $request;
4747+4848+ return $query;
4949+ }
5050+5151+ final protected function getRequest() {
5252+ return $this->request;
5353+ }
5454+5555+ final public function loadLastModification() {
5656+ return $this->executeQuery();
5757+ }
5858+5959+ abstract protected function executeQuery();
6060+6161+}
···11+<?php
22+/**
33+ * This file is automatically generated. Lint this module to rebuild it.
44+ * @generated
55+ */
66+77+88+99+phutil_require_module('phabricator', 'applications/repository/constants/repositorytype');
1010+1111+phutil_require_module('phutil', 'symbols');
1212+1313+1414+phutil_require_source('DiffusionLastModifiedQuery.php');
···11+<?php
22+33+/*
44+ * Copyright 2011 Facebook, Inc.
55+ *
66+ * Licensed under the Apache License, Version 2.0 (the "License");
77+ * you may not use this file except in compliance with the License.
88+ * You may obtain a copy of the License at
99+ *
1010+ * http://www.apache.org/licenses/LICENSE-2.0
1111+ *
1212+ * Unless required by applicable law or agreed to in writing, software
1313+ * distributed under the License is distributed on an "AS IS" BASIS,
1414+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515+ * See the License for the specific language governing permissions and
1616+ * limitations under the License.
1717+ */
1818+1919+final class DiffusionGitLastModifiedQuery extends DiffusionLastModifiedQuery {
2020+2121+ protected function executeQuery() {
2222+ $drequest = $this->getRequest();
2323+ $repository = $drequest->getRepository();
2424+2525+ list($hash) = execx(
2626+ "(cd %s && git log -n1 --format=%%H %s -- %s)",
2727+ $repository->getDetail('local-path'),
2828+ $drequest->getCommit(),
2929+ $drequest->getPath());
3030+ $hash = trim($hash);
3131+3232+ $commit_data = null;
3333+3434+ $commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
3535+ 'repositoryID = %d AND commitIdentifier = %s',
3636+ $repository->getID(),
3737+ $hash);
3838+ if ($commit) {
3939+ $commit_data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
4040+ 'commitID = %d',
4141+ $commit->getID());
4242+ }
4343+4444+ return array($commit, $commit_data);
4545+ }
4646+4747+}
···11+<?php
22+33+/*
44+ * Copyright 2011 Facebook, Inc.
55+ *
66+ * Licensed under the Apache License, Version 2.0 (the "License");
77+ * you may not use this file except in compliance with the License.
88+ * You may obtain a copy of the License at
99+ *
1010+ * http://www.apache.org/licenses/LICENSE-2.0
1111+ *
1212+ * Unless required by applicable law or agreed to in writing, software
1313+ * distributed under the License is distributed on an "AS IS" BASIS,
1414+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515+ * See the License for the specific language governing permissions and
1616+ * limitations under the License.
1717+ */
1818+1919+final class DiffusionSvnLastModifiedQuery extends DiffusionLastModifiedQuery {
2020+2121+ protected function executeQuery() {
2222+ $drequest = $this->getRequest();
2323+ $repository = $drequest->getRepository();
2424+2525+ $path = $drequest->getPath();
2626+2727+ $history_query = DiffusionHistoryQuery::newFromDiffusionRequest(
2828+ $drequest);
2929+ $history_query->setLimit(1);
3030+ $history_array = $history_query->loadHistory();
3131+ $history = reset($history_array);
3232+3333+ return array($history->getCommit(), $history->getCommitData());
3434+ }
3535+3636+}
···11+<?php
22+/**
33+ * This file is automatically generated. Lint this module to rebuild it.
44+ * @generated
55+ */
66+77+88+99+phutil_require_module('phabricator', 'applications/diffusion/query/history/base');
1010+phutil_require_module('phabricator', 'applications/diffusion/query/lastmodified/base');
1111+1212+1313+phutil_require_source('DiffusionSvnLastModifiedQuery.php');