Path: blob/master/src/applications/diffusion/management/DiffusionRepositoryLimitsManagementPanel.php
13395 views
<?php12final class DiffusionRepositoryLimitsManagementPanel3extends DiffusionRepositoryManagementPanel {45const PANELKEY = 'limits';67public function getManagementPanelLabel() {8return pht('Limits');9}1011public function getManagementPanelOrder() {12return 700;13}1415public function shouldEnableForRepository(16PhabricatorRepository $repository) {17return $repository->isGit();18}1920public function getManagementPanelIcon() {21$repository = $this->getRepository();2223$any_limit = false;2425if ($repository->getFilesizeLimit()) {26$any_limit = true;27}2829if ($any_limit) {30return 'fa-signal';31} else {32return 'fa-signal grey';33}34}3536protected function getEditEngineFieldKeys() {37return array(38'filesizeLimit',39'copyTimeLimit',40'touchLimit',41);42}4344public function buildManagementPanelCurtain() {45$repository = $this->getRepository();46$viewer = $this->getViewer();47$action_list = $this->newActionList();4849$can_edit = PhabricatorPolicyFilter::hasCapability(50$viewer,51$repository,52PhabricatorPolicyCapability::CAN_EDIT);5354$limits_uri = $this->getEditPageURI();5556$action_list->addAction(57id(new PhabricatorActionView())58->setIcon('fa-pencil')59->setName(pht('Edit Limits'))60->setHref($limits_uri)61->setDisabled(!$can_edit)62->setWorkflow(!$can_edit));6364return $this->newCurtainView()65->setActionList($action_list);66}6768public function buildManagementPanelContent() {69$repository = $this->getRepository();70$viewer = $this->getViewer();7172$view = id(new PHUIPropertyListView())73->setViewer($viewer);7475$byte_limit = $repository->getFilesizeLimit();76if ($byte_limit) {77$filesize_display = pht('%s Bytes', new PhutilNumber($byte_limit));78} else {79$filesize_display = pht('Unlimited');80$filesize_display = phutil_tag('em', array(), $filesize_display);81}8283$view->addProperty(pht('Filesize Limit'), $filesize_display);8485$copy_limit = $repository->getCopyTimeLimit();86if ($copy_limit) {87$copy_display = pht('%s Seconds', new PhutilNumber($copy_limit));88} else {89$copy_default = $repository->getDefaultCopyTimeLimit();90$copy_display = pht(91'Default (%s Seconds)',92new PhutilNumber($copy_default));93$copy_display = phutil_tag('em', array(), $copy_display);94}9596$view->addProperty(pht('Clone/Fetch Timeout'), $copy_display);9798$touch_limit = $repository->getTouchLimit();99if ($touch_limit) {100$touch_display = pht('%s Paths', new PhutilNumber($touch_limit));101} else {102$touch_display = pht('Unlimited');103$touch_display = phutil_tag('em', array(), $touch_display);104}105106$view->addProperty(pht('Touched Paths Limit'), $touch_display);107108return $this->newBox(pht('Limits'), $view);109}110111}112113114