Difference between revisions of "Beta Features"

From Dreamwidth Notes
Jump to: navigation, search
(Page was deleted over 4 years ago.)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
This page describes how to code and enable beta features on a server from the perspective of a developer, including how to turn on beta features on your Dreamhack. For instructions on doing beta work as a user, see [[Beta Testing]].
+
This page describes how to code and enable beta features on a server from the perspective of a developer, including how to turn on beta features on your Dreamhack.
  
  
Line 36: Line 36:
 
= Configuring your Server to List the New Feature =
 
= Configuring your Server to List the New Feature =
  
To turn on beta features on your Dreamhack, you'll also need to enable them in your configuration. Add this to ext/local/etc/config-local.pl (or look for an existing %LJ::BETA_FEATURES line, and possibly uncomment it)
+
To turn on beta features on your Dreamhack, you'll also need to enable them in your configuration. The config lines for the DW beta features are commented out in etc/config-local.pl.  To enable them, copy those lines to ext/local/etc/config-local.pl (and uncomment if needed).  They will look something like this:
  
 
     %LJ::BETA_FEATURES = (
 
     %LJ::BETA_FEATURES = (
         "featurename" => {
+
         "updatepage" => {
            start_time  => 0,
+
            end_time    => "Inf",
+
        },
+
        "otherfeaturename" => {
+
 
             start_time  => 0,
 
             start_time  => 0,
 
             end_time    => "Inf",
 
             end_time    => "Inf",
Line 49: Line 45:
 
     );
 
     );
  
The actual names of the beta features can be found by going to [http://www.dreamwidth.org/beta?uselang=debug this page] or asking about them at <dwcomm>dw_dev_training</dwcomm>.
+
If you're writing a new feature, you will need to add a line for it here, e.g. by replacing "updatepage" with "featurename".
 +
 
 +
The actual names of the existing beta features can be found by going to [http://www.dreamwidth.org/beta?uselang=debug this page] or asking about them at <dwcomm>dw_dev_training</dwcomm>.
  
 
= Conditionally Enabling Features for Beta Testers =
 
= Conditionally Enabling Features for Beta Testers =

Latest revision as of 17:55, 25 December 2017

This page describes how to code and enable beta features on a server from the perspective of a developer, including how to turn on beta features on your Dreamhack.


Putting a Feature into Beta

Features in active beta are listed on Dreamwidth Beta. To add a feature to that list, you will need to create a new module and configure the server to enable the feature beta.

Here is the bare minimum to get a module to work, to be placed in

   dw-free/cgi-bin/DW/BetaFeatures/featurename.pm
#!/usr/bin/perl
#
# DW::BetaFeatures::featurename - Allow users to beta test featurename
#
# Authors:
#      Afuna <coder.dw@afunamatata.com>
#
# Copyright (c) 2011 by Dreamwidth Studios, LLC.
#
# This program is free software; you may redistribute it and/or modify it under
# the same terms as Perl itself. For a copy of the license, please reference
# 'perldoc perlartistic' or 'perldoc perlgpl'.
 
package DW::BetaFeatures::featurename;
 
use strict;
use base "LJ::BetaFeatures::default";
 
1;


Refer to the base implementation at dw-free/cgi-bin/LJ/BetaFeatures/default.pm for methods that you can override.

Configuring your Server to List the New Feature

To turn on beta features on your Dreamhack, you'll also need to enable them in your configuration. The config lines for the DW beta features are commented out in etc/config-local.pl. To enable them, copy those lines to ext/local/etc/config-local.pl (and uncomment if needed). They will look something like this:

   %LJ::BETA_FEATURES = (
       "updatepage" => {
           start_time  => 0,
           end_time    => "Inf",
       },
   );

If you're writing a new feature, you will need to add a line for it here, e.g. by replacing "updatepage" with "featurename".

The actual names of the existing beta features can be found by going to this page or asking about them at [info]dw_dev_training.

Conditionally Enabling Features for Beta Testers

To determine whether a user has enabled a certain feature, use this in an if-statement:

 LJ::BetaFeatures->user_in_beta( $u => "featurename" );