Short links

Short links work with your P4 Code Review installation's current hostname, but you have the option of registering/configuring an even shorter hostname to make shareable file/directory links as short as possible.

If you make a configuration change, P4 Code Review will not use it until the configuration cache has been reloaded, this forces P4 Code Review to use the new configuration. You must be an admin or super user to reload the P4 Code Review config cache. Navigate to the User id dropdown menu, select System Information, click the Cache Info tab, and click the Reload Configuration button.

  1. Register a short domain name, or if you control your own DNS server, a short domain name for your network.
  2. Point the short domain name at your P4 Code Review host.
  3. Edit the SWARM_ROOT/data/config.php file and add the following configuration block:

    <?php
    // this block should be a peer of 'p4'
    'short_links' => array(
    'hostname' => 'myho.st',
    ),

    Replace myho.st with the short domain name you registered/configured.

    If your P4 Code Review is configured to use HTTPS, a custom port, a sub-folder, or any combination of these custom installation options, the short links configuration block should look like:

    <?php
    // this block should be a peer of 'p4'
    'short_links' => array(
    'external_url' => 'https://myho.st:port/sub-folder',
    ),

Replace myho.st with the short domain name you have registered/configured.

If you have not configured P4 Code Review to use HTTPS, replace https:// with http://.

If you have configured P4 Code Review to run on a custom port, replace :port with the correct custom port. Otherwise, remove :port.

If you have configured P4 Code Review to run in a sub-folder, replace /sub-folder with the correct sub-folder name. Otherwise, remove /sub-folder.

The external_url configuration item is only honored if you have also configured the external_url item within the Environment configuration item as well. Otherwise, P4 Code Review could generate short links that cannot correctly link to their corresponding full URLs.

When external_url is configured, the hostname configuration item is ignored.