public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $dashboard = PhabricatorDashboardInstall::getDashboard($viewer, $viewer->getPHID(), get_class($this->getCurrentApplication()));
     if (!$dashboard) {
         $dashboard = PhabricatorDashboardInstall::getDashboard($viewer, PhabricatorHomeApplication::DASHBOARD_DEFAULT, get_class($this->getCurrentApplication()));
     }
     if ($dashboard) {
         $content = id(new PhabricatorDashboardRenderingEngine())->setViewer($viewer)->setDashboard($dashboard)->renderDashboard();
     } else {
         $content = $this->buildMainResponse();
     }
     if (!$request->getURIData('only')) {
         $nav = $this->buildNav();
         $nav->appendChild(array($content, id(new PhabricatorGlobalUploadTargetView())->setUser($viewer)));
         $content = $nav;
     }
     return $this->newPage()->setTitle('Phabricator')->addClass('phabricator-home')->appendChild($content);
 }
 public function processRequest()
 {
     $user = $this->getRequest()->getUser();
     $dashboard = PhabricatorDashboardInstall::getDashboard($user, $user->getPHID(), get_class($this->getCurrentApplication()));
     if (!$dashboard) {
         $dashboard = PhabricatorDashboardInstall::getDashboard($user, PhabricatorHomeApplication::DASHBOARD_DEFAULT, get_class($this->getCurrentApplication()));
     }
     if ($dashboard) {
         $content = id(new PhabricatorDashboardRenderingEngine())->setViewer($user)->setDashboard($dashboard)->renderDashboard();
     } else {
         $project_query = new PhabricatorProjectQuery();
         $project_query->setViewer($user);
         $project_query->withMemberPHIDs(array($user->getPHID()));
         $projects = $project_query->execute();
         $content = $this->buildMainResponse($projects);
     }
     if (!$this->only) {
         $nav = $this->buildNav();
         $nav->appendChild(array($content, id(new PhabricatorGlobalUploadTargetView())->setUser($user)));
         $content = $nav;
     }
     return $this->buildApplicationPage($content, array('title' => 'Phabricator'));
 }
 public function buildWelcomeScreen(AphrontRequest $request)
 {
     $viewer = $request->getUser();
     $this->requireResource('config-welcome-css');
     $content = pht("**Welcome to Phabricator!**\n\n" . "You have successfully installed Phabricator. This screen will guide " . "you through configuration and orientation.\n\n" . "These steps are optional, and you can go through them in any order.\n\n" . "If you want to get back to this screen later on, you can find it in " . "the **Config** application under **Welcome Screen**.");
     $setup = array();
     $setup[] = $this->newItem($request, pht('Install Phabricator'), true, $content);
     $issues_resolved = !PhabricatorSetupCheck::getOpenSetupIssueCount();
     $setup_href = PhabricatorEnv::getURI('/config/issue/');
     if ($issues_resolved) {
         $content = pht("You've resolved (or ignored) all outstanding setup issues.\n\n" . "You can review issues in the **Config** application, under " . "**[[ %s | Setup Issues ]]**.", $setup_href);
     } else {
         $content = pht("You have some unresolved setup issues to take care of. Click " . "the link in the yellow banner at the top of the screen to see " . "them, or find them in the **Config** application under " . "**[[ %s | Setup Issues ]]**.\n\n" . "Although most setup issues should be resolved, sometimes an issue " . "is not applicable to an install.\n\n" . "If you don't intend to fix a setup issue (or don't want to fix " . "it for now), you can use the \"Ignore\" action to mark it as " . "something you don't plan to deal with.", $setup_href);
     }
     $setup[] = $this->newItem($request, pht('Resolve Setup Issues'), $issues_resolved, $content);
     $configs = id(new PhabricatorAuthProviderConfigQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->execute();
     $auth_href = PhabricatorEnv::getURI('/auth/');
     $have_auth = (bool) $configs;
     if ($have_auth) {
         $content = pht("You've configured at least one authentication provider, so users " . "can register or log in.\n\n" . "To configure more providers or adjust settings, use the " . "**[[ %s | Auth Application ]]**.", $auth_href);
     } else {
         $content = pht("You haven't configured any authentication providers yet.\n\n" . "Authentication providers allow users to register accounts and " . "log in to Phabricator. You can configure Phabricator to accept " . "credentials like username and password, LDAP, or Google OAuth.\n\n" . "You can configure authentication using the " . "**[[ %s | Auth Application ]]**.", $auth_href);
     }
     $setup[] = $this->newItem($request, pht('Login and Registration'), $have_auth, $content);
     $config_href = PhabricatorEnv::getURI('/config/');
     // Just load any config value at all; if one exists the install has figured
     // out how to configure things.
     $have_config = (bool) id(new PhabricatorConfigEntry())->loadAllWhere('1 = 1 LIMIT 1');
     if ($have_config) {
         $content = pht("You've configured at least one setting from the web interface.\n\n" . "To configure more settings later, use the " . "**[[ %s | Config Application ]]**.", $config_href);
     } else {
         $content = pht('Many aspects of Phabricator are configurable. To explore and ' . 'adjust settings, use the **[[ %s | Config Application ]]**.', $config_href);
     }
     $setup[] = $this->newItem($request, pht('Configure Phabricator Settings'), $have_config, $content);
     $settings_href = PhabricatorEnv::getURI('/settings/');
     $prefs = $viewer->loadPreferences()->getPreferences();
     $have_settings = !empty($prefs);
     if ($have_settings) {
         $content = pht("You've adjusted at least one setting on your account.\n\n" . "To make more adjustments, visit the " . "**[[ %s | Settings Application ]]**.", $settings_href);
     } else {
         $content = pht('You can configure settings for your account by clicking the ' . 'wrench icon in the main menu bar, or visiting the ' . '**[[ %s | Settings Application ]]** directly.', $settings_href);
     }
     $setup[] = $this->newItem($request, pht('Adjust Account Settings'), $have_settings, $content);
     $dashboard_href = PhabricatorEnv::getURI('/dashboard/');
     $have_dashboard = (bool) PhabricatorDashboardInstall::getDashboard($viewer, PhabricatorHomeApplication::DASHBOARD_DEFAULT, 'PhabricatorHomeApplication');
     if ($have_dashboard) {
         $content = pht("You've installed a default dashboard to replace this welcome screen " . "on the home page.\n\n" . "You can still visit the welcome screen here at any time if you " . "have steps you want to complete later, or if you feel lonely.\n\n" . "If you've changed your mind about the dashboard you installed, " . "you can install a different default dashboard with the " . "**[[ %s | Dashboards Application ]]**.", $dashboard_href);
     } else {
         $content = pht("When you're done setting things up, you can create a custom " . "dashboard and install it. Your dashboard will replace this " . "welcome screen on the Phabricator home page.\n\n" . "Dashboards can show users the information that's most important to " . "your organization. You can configure them to display things like: " . "a custom welcome message, a feed of recent activity, or a list of " . "open tasks, waiting reviews, recent commits, and so on.\n\n" . "After you install a default dashboard, it will replace this page. " . "You can find this page later by visiting the **Config** " . "application, under **Welcome Page**.\n\n" . "To get started building a dashboard, use the " . "**[[ %s | Dashboards Application ]]**.\n\n", $dashboard_href);
     }
     $setup[] = $this->newItem($request, pht('Customize Home Page'), $have_dashboard, $content);
     $apps_href = PhabricatorEnv::getURI('/applications/');
     $content = pht("Phabricator is a large suite of applications that work together to " . "help you develop software, manage tasks, and communicate. A few of " . "the most commonly used applications are pinned to the left navigation " . "bar by default.\n\n" . "To explore all of the Phabricator applications, adjust settings, or " . "uninstall applications you don't plan to use, visit the " . "**[[ %s | Applications Application ]]**. You can also click the " . "**Applications** button in the left navigation menu, or search for an " . "application by name in the main menu bar.\n\n", $apps_href);
     $explore = array();
     $explore[] = $this->newItem($request, pht('Explore Applications'), null, $content);
     $support_href = PhabricatorEnv::getDoclink('Give Feedback! Get Support!');
     $content = pht('Having trouble getting something set up? See ' . '**[[ %s | Give Feedback! Get Support! ]]** for ways to get in touch ' . 'to get answers to questions, report bugs, and request features.', $support_href);
     $explore[] = $this->newItem($request, pht('Need Help with Setup?'), null, $content);
     $differential_uri = PhabricatorEnv::getURI('/differential/');
     $differential_create_uri = PhabricatorEnv::getURI('/differential/diff/create/');
     $differential_all_uri = PhabricatorEnv::getURI('/differential/query/all/');
     $differential_user_guide = PhabricatorEnv::getDoclink('Differential User Guide');
     $differential_vs_uri = PhabricatorEnv::getDoclink('User Guide: Review vs Audit');
     $quick = array();
     $quick[] = $this->newItem($request, pht('Quick Start: Code Review'), null, pht("Review code with **[[ %s | Differential ]]**.\n\n" . "Engineers can use Differential to share, review, and approve " . "changes to source code.\n\n" . "To get started with code review:\n\n" . "  - **[[ %s | Create a Revision ]]** //(Copy and paste a diff from " . "    the command line into the web UI to quickly get a feel for " . "    review.)//\n" . "  - **[[ %s | View All Revisions ]]**\n\n" . "For more information, see these articles in the documentation:\n\n" . "  - **[[ %s | Differential User Guide ]]**, for a general overview " . "    of Differential.\n" . "  - **[[ %s | User Guide: Review vs Audit ]]**, for a discussion " . "    of different code review workflows.", $differential_uri, $differential_create_uri, $differential_all_uri, $differential_user_guide, $differential_vs_uri));
     $maniphest_uri = PhabricatorEnv::getURI('/maniphest/');
     $maniphest_create_uri = PhabricatorEnv::getURI('/maniphest/task/create/');
     $maniphest_all_uri = PhabricatorEnv::getURI('/maniphest/query/all/');
     $quick[] = $this->newItem($request, pht('Quick Start: Bugs and Tasks'), null, pht("Track bugs and tasks in Phabricator with " . "**[[ %s | Maniphest ]]**.\n\n" . "Users in all roles can use Maniphest to manage current and " . "planned work and to track bugs and issues.\n\n" . "To get started with bugs and tasks:\n\n" . "  - **[[ %s | Create a Task ]]**\n" . "  - **[[ %s | View All Tasks ]]**\n", $maniphest_uri, $maniphest_create_uri, $maniphest_all_uri));
     $pholio_uri = PhabricatorEnv::getURI('/pholio/');
     $pholio_create_uri = PhabricatorEnv::getURI('/pholio/new/');
     $pholio_all_uri = PhabricatorEnv::getURI('/pholio/query/all/');
     $quick[] = $this->newItem($request, pht('Quick Start: Design Review'), null, pht("Review proposed designs with **[[ %s | Pholio ]]**.\n\n" . "Designers can use Pholio to share images of what they're working on " . "and show off things they've made.\n\n" . "To get started with design review:\n\n" . "  - **[[ %s | Create a Mock ]]**\n" . "  - **[[ %s | View All Mocks ]]**", $pholio_uri, $pholio_create_uri, $pholio_all_uri));
     $diffusion_uri = PhabricatorEnv::getURI('/diffusion/');
     $diffusion_create_uri = PhabricatorEnv::getURI('/diffusion/create/');
     $diffusion_all_uri = PhabricatorEnv::getURI('/diffusion/query/all/');
     $diffusion_user_guide = PhabricatorEnv::getDoclink('Diffusion User Guide');
     $diffusion_setup_guide = PhabricatorEnv::getDoclink('Diffusion User Guide: Repository Hosting');
     $quick[] = $this->newItem($request, pht('Quick Start: Repositories'), null, pht("Manage and browse source code repositories with " . "**[[ %s | Diffusion ]]**.\n\n" . "Engineers can use Diffusion to browse and audit source code.\n\n" . "You can configure Phabricator to host repositories, or have it " . "track existing repositories hosted elsewhere (like GitHub, " . "Bitbucket, or an internal server).\n\n" . "To get started with repositories:\n\n" . "  - **[[ %s | Create a New Repository ]]**\n" . "  - **[[ %s | View All Repositories ]]**\n\n" . "For more information, see these articles in the documentation:\n\n" . "  - **[[ %s | Diffusion User Guide ]]**, for a general overview of " . "    Diffusion.\n" . "  - **[[ %s | Diffusion User Guide: Repository Hosting ]]**, " . "    for instructions on configuring repository hosting.\n\n" . "Phabricator supports Git, Mercurial and Subversion.", $diffusion_uri, $diffusion_create_uri, $diffusion_all_uri, $diffusion_user_guide, $diffusion_setup_guide));
     return array($this->newColumns(pht('Setup and Configuration'), $setup), $this->newColumns(pht('Explore Phabricator'), $explore), $this->newColumns(pht('Quick Start Guides'), $quick));
 }
Пример #4
0
foreach (new LiskMigrationIterator(new PhabricatorUser()) as $user) {
    $user_preferences = $user->loadPreferences();
    $old_pinned_apps = $user_preferences->getPreference($pref_pinned);
    $new_pinned_apps = array();
    if (!$old_pinned_apps) {
        continue;
    }
    foreach ($old_pinned_apps as $pinned_app) {
        $new_pinned_apps[] = idx($map, $pinned_app, $pinned_app);
    }
    $user_preferences->setPreference($pref_pinned, $new_pinned_apps);
    queryfx($conn_w, 'UPDATE %T SET preferences = %s WHERE id = %d', $user_preferences->getTableName(), json_encode($user_preferences->getPreferences()), $user_preferences->getID());
}
/* -(  Dashboard installs  )------------------------------------------------- */
echo "Migrating dashboard installs...\n";
$table = new PhabricatorDashboardInstall();
$conn_w = $table->establishConnection('w');
foreach (new LiskMigrationIterator($table) as $dashboard_install) {
    $application = $dashboard_install->getApplicationClass();
    queryfx($conn_w, 'UPDATE %T SET applicationClass = %s WHERE id = %d', $table->getTableName(), idx($map, $application, $application), $dashboard_install->getID());
}
/* -(  Phabricator configuration  )------------------------------------------ */
$config_key = 'phabricator.uninstalled-applications';
echo "Migrating `{$config_key}` config...\n";
$config = PhabricatorConfigEntry::loadConfigEntry($config_key);
$old_config = $config->getValue();
$new_config = array();
if ($old_config) {
    foreach ($old_config as $application => $uninstalled) {
        $new_config[idx($map, $application, $application)] = $uninstalled;
    }
 public function renderModuleStatus(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $instance = PhabricatorEnv::getEnvConfig('cluster.instance');
     $guide_items = new PhabricatorGuideListView();
     $title = pht('Create a Repository');
     $repository_check = id(new PhabricatorRepositoryQuery())->setViewer($viewer)->execute();
     $href = PhabricatorEnv::getURI('/diffusion/');
     if ($repository_check) {
         $icon = 'fa-check';
         $icon_bg = 'bg-green';
         $description = pht("You've created at least one repository.");
     } else {
         $icon = 'fa-code';
         $icon_bg = 'bg-sky';
         $description = pht('If you are here for code review, let\'s set up your first ' . 'repository.');
     }
     $item = id(new PhabricatorGuideItemView())->setTitle($title)->setHref($href)->setIcon($icon)->setIconBackground($icon_bg)->setDescription($description);
     $guide_items->addItem($item);
     $title = pht('Create a Project');
     $project_check = id(new PhabricatorProjectQuery())->setViewer($viewer)->execute();
     $href = PhabricatorEnv::getURI('/project/');
     if ($project_check) {
         $icon = 'fa-check';
         $icon_bg = 'bg-green';
         $description = pht("You've created at least one project.");
     } else {
         $icon = 'fa-briefcase';
         $icon_bg = 'bg-sky';
         $description = pht('Project tags define everything. Create them for teams, tags, ' . 'or actual projects.');
     }
     $item = id(new PhabricatorGuideItemView())->setTitle($title)->setHref($href)->setIcon($icon)->setIconBackground($icon_bg)->setDescription($description);
     $guide_items->addItem($item);
     $title = pht('Create a Task');
     $task_check = id(new ManiphestTaskQuery())->setViewer($viewer)->execute();
     $href = PhabricatorEnv::getURI('/maniphest/');
     if ($task_check) {
         $icon = 'fa-check';
         $icon_bg = 'bg-green';
         $description = pht("You've created at least one task.");
     } else {
         $icon = 'fa-anchor';
         $icon_bg = 'bg-sky';
         $description = pht('Create some work for the interns in Maniphest.');
     }
     $item = id(new PhabricatorGuideItemView())->setTitle($title)->setHref($href)->setIcon($icon)->setIconBackground($icon_bg)->setDescription($description);
     $guide_items->addItem($item);
     $title = pht('Build a Dashboard');
     $have_dashboard = (bool) PhabricatorDashboardInstall::getDashboard($viewer, PhabricatorHomeApplication::DASHBOARD_DEFAULT, 'PhabricatorHomeApplication');
     $href = PhabricatorEnv::getURI('/dashboard/');
     if ($have_dashboard) {
         $icon = 'fa-check';
         $icon_bg = 'bg-green';
         $description = pht("You've created at least one dashboard.");
     } else {
         $icon = 'fa-dashboard';
         $icon_bg = 'bg-sky';
         $description = pht('Customize the default homepage layout and items.');
     }
     $item = id(new PhabricatorGuideItemView())->setTitle($title)->setHref($href)->setIcon($icon)->setIconBackground($icon_bg)->setDescription($description);
     $guide_items->addItem($item);
     $title = pht('Personalize your Install');
     $wordmark = PhabricatorEnv::getEnvConfig('ui.logo');
     $href = PhabricatorEnv::getURI('/config/edit/ui.logo/');
     if ($wordmark) {
         $icon = 'fa-check';
         $icon_bg = 'bg-green';
         $description = pht('It looks amazing, good work. Home Sweet Home.');
     } else {
         $icon = 'fa-home';
         $icon_bg = 'bg-sky';
         $description = pht('Change the name and add your company logo, just to give it a ' . 'little extra polish.');
     }
     $item = id(new PhabricatorGuideItemView())->setTitle($title)->setHref($href)->setIcon($icon)->setIconBackground($icon_bg)->setDescription($description);
     $guide_items->addItem($item);
     $title = pht('Explore Applications');
     $href = PhabricatorEnv::getURI('/applications/');
     $icon = 'fa-globe';
     $icon_bg = 'bg-sky';
     $description = pht('See all the applications included in Phabricator.');
     $item = id(new PhabricatorGuideItemView())->setTitle($title)->setHref($href)->setIcon($icon)->setIconBackground($icon_bg)->setDescription($description);
     $guide_items->addItem($item);
     if (!$instance) {
         $title = pht('Invite Collaborators');
         $people_check = id(new PhabricatorPeopleQuery())->setViewer($viewer)->execute();
         $people = count($people_check);
         $href = PhabricatorEnv::getURI('/people/invite/send/');
         if ($people > 1) {
             $icon = 'fa-check';
             $icon_bg = 'bg-green';
             $description = pht('Your invitations have been accepted. You will not be alone on ' . 'this journey.');
         } else {
             $icon = 'fa-group';
             $icon_bg = 'bg-sky';
             $description = pht('Invite the rest of your team to get started on Phabricator.');
         }
     }
     $item = id(new PhabricatorGuideItemView())->setTitle($title)->setHref($href)->setIcon($icon)->setIconBackground($icon_bg)->setDescription($description);
     $guide_items->addItem($item);
     $intro = pht('If your new to Phabricator, these optional steps can help you learn ' . 'the basics. Conceptually, Phabricator is structured as a graph, and ' . 'repositories, tasks, and projects are all independent from each other. ' . 'Feel free to set up Phabricator for how you work best, and explore ' . 'these features at your own pace.');
     $intro = new PHUIRemarkupView($viewer, $intro);
     $intro = id(new PHUIDocumentViewPro())->appendChild($intro);
     return array($intro, $guide_items);
 }