vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   Managing a development area (https://vborg.vbsupport.ru/showthread.php?t=234617)

Carnage 01-30-2010 10:00 PM

Managing a development area
 
This is a little something I came up with to deal with having somewhere to develop mods and somewhere to test things like install code. It also deals with the password protected requirement for development areas in one nice little package.

Edit config.php, at the bottom of the file above the ?> add:

PHP Code:


if (!isset($_SERVER['PHP_AUTH_USER'])) 
{
    
header('WWW-Authenticate: Basic realm="Vbulletin Development site"');
    
header('HTTP/1.0 401 Unauthorized');
    echo 
'You must login to access this resource';
    exit;

else 
{
    if(
$_SERVER['PHP_AUTH_PW'] == $config['SpecialUsers']['htaccess'][$_SERVER['PHP_AUTH_USER']]['password'])
    {
        
$config['Database']['tableprefix'] = $config['SpecialUsers']['htaccess'][$_SERVER['PHP_AUTH_USER']]['prefix'];
        
$config['Misc']['debug'] = $config['SpecialUsers']['htaccess'][$_SERVER['PHP_AUTH_USER']]['debug'];
        if(
$config['SpecialUsers']['htaccess'][$_SERVER['PHP_AUTH_USER']]['demo'])
        {
            
define('DEMO_MODE',true);
        }
    }


Anyone who is sufficiently astute will realise that that is performing http authentification AND setting debug mode and table prefix based on the username. All you need now is an array of settings for the users that are allowed to visit your dev area.

PHP Code:

$config['SpecialUsers']['htaccess']['carnage_test1'] = array('password'=>'mypassword','prefix'=>'test1','debug'=>true,'demo'=>false);
$config['SpecialUsers']['htaccess']['carnage_test2'] = array('password'=>'mypassword','prefix'=>'test2','debug'=>true,'demo'=>false); 

Placing that array above the code from the top of this post defines two users, each of the users accesses a different database. You can then make two installs of vbulletin, sharing the same codebase. Once you've written a product, export it. Switch user (generally closing your browser is required; some browsers offer a htaccess logout button/method).

It gets better. Say you are working for two clients; developing a mod for one and a skin for another. During develoment you have two isntalls, one for each project with the prefixes above. If you want to show your client the work in progress and get some feedback you can set them up a login like this:

PHP Code:

$config['SpecialUsers']['htaccess']['clientx'] = array('password'=>'theirpassword','prefix'=>'test1','debug'=>false,'demo'=>true);
$config['SpecialUsers']['htaccess']['clienty'] = array('password'=>'theirpassword','prefix'=>'test2','debug'=>false,'demo'=>true); 

neither will be able to access the other install and the demo mode setting will prevent them from messing around with sensitive admincp controls. You should set them their own admin account up as well and don't give it any permissions such as the ability to run sql queries.

Disclaimer:
This dosn't provide 100% security as it relies upon an unsupported, undocumented feature of vb: demo mode. You should make your own tests to ensure that its secure enough for your needs.

Some uses of the information contained above may require multiple vbulletin liscenses. It is your responsibility to ensure you have enough liscenses to cover your dev installs.


All times are GMT. The time now is 02:58 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01102 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete