Boost logo

Boost-Commit :

From: grafikrobot_at_[hidden]
Date: 2007-08-04 16:38:15


Author: grafik
Date: 2007-08-04 16:38:01 EDT (Sat, 04 Aug 2007)
New Revision: 38446
URL: http://svn.boost.org/trac/boost/changeset/38446

Log:
Minor clean up of source code to move some duplicate code to common location.
Added:
   website/public_html/beta/common/code/boost.php (contents, props changed)
   website/public_html/beta/common/code/boost_utility.php (contents, props changed)
Text files modified:
   website/public_html/beta/common/code/archive_file.php | 46 +--------------------------------------
   website/public_html/beta/common/code/boost_config.php | 21 ++++++++++++++---
   website/public_html/beta/common/code/boost_irc_stats.php | 31 --------------------------
   website/public_html/beta/common/code/boost_version.php | 2
   website/public_html/beta/common/code/boost_wiki.php | 30 -------------------------
   website/public_html/beta/common/code/feed.php | 2
   website/public_html/beta/common/code/libraries.php | 2
   7 files changed, 24 insertions(+), 110 deletions(-)

Modified: website/public_html/beta/common/code/archive_file.php
==============================================================================
--- website/public_html/beta/common/code/archive_file.php (original)
+++ website/public_html/beta/common/code/archive_file.php 2007-08-04 16:38:01 EDT (Sat, 04 Aug 2007)
@@ -1,52 +1,10 @@
 <?php
 /*
- Copyright 2005 Redshift Software, Inc.
+ Copyright 2005-2007 Redshift Software, Inc.
   Distributed under the Boost Software License, Version 1.0.
   (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 */
-
-if ($_SERVER['HTTP_HOST'] === 'boost.org' ||
- $_SERVER['HTTP_HOST'] === 'beta.boost.org') {
- @define('ARCHIVE_PREFIX', '/home/grafik/www.boost.org/boost_');
- @define('UNZIP', '/usr/bin/unzip');
-}
-else if ($_SERVER['HTTP_HOST'] === 'boost.borg.redshift-software.com') {
- @define('ARCHIVE_PREFIX', 'C:/DevRoots/Boost/boost_');
- @define('UNZIP', 'unzip');
-}
-else if ($_SERVER['HTTP_HOST'] === 'boost.redshift-software.com') {
- @define('ARCHIVE_PREFIX', '/export/website/boost/archives/boost_');
- @define('UNZIP', '/usr/local/bin/unzip');
-}
-_at_define('ARCHIVE_FILE_PREFIX', 'boost_');
-
-function _preg_replace_bounds($front_regex,$back_regex,$front_replace,$back_replace,$text)
-{
- $offset = 0;
- $result = '';
- while (TRUE)
- {
- $subject = substr($text,$offset);
- if (preg_match($front_regex,$subject,$begin,PREG_OFFSET_CAPTURE) == 0 ||
- preg_match($back_regex,$subject,$end,PREG_OFFSET_CAPTURE,
- $begin[0][1]+strlen($begin[0][0])) == 0
- )
- { break; }
- else
- {
- $result .= substr($subject,0,$begin[0][1]);
- $result .= preg_replace($front_regex,$front_replace,$begin[0][0]);
- $result .= substr(
- $subject,
- $begin[0][1]+strlen($begin[0][0]),
- $end[0][1]-($begin[0][1]+strlen($begin[0][0])) );
- $result .= preg_replace($back_regex,$back_replace,$end[0][0]);
- $offset += $end[0][1]+strlen($end[0][0]);
- }
- }
- if ($result === '') { return $text; }
- else { return $result . substr($text,$offset); }
-}
+require_once(dirname(__FILE__) . '/boost.php');
 
 class archive_file
 {

Added: website/public_html/beta/common/code/boost.php
==============================================================================
--- (empty file)
+++ website/public_html/beta/common/code/boost.php 2007-08-04 16:38:01 EDT (Sat, 04 Aug 2007)
@@ -0,0 +1,9 @@
+<?php
+/*
+ Copyright 2007 Redshift Software, Inc.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+*/
+require_once(dirname(__FILE__) . '/boost_config.php');
+require_once(dirname(__FILE__) . '/boost_utility.php');
+?>
\ No newline at end of file

Modified: website/public_html/beta/common/code/boost_config.php
==============================================================================
--- website/public_html/beta/common/code/boost_config.php (original)
+++ website/public_html/beta/common/code/boost_config.php 2007-08-04 16:38:01 EDT (Sat, 04 Aug 2007)
@@ -5,6 +5,23 @@
   (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 */
 
+/*
+BOOST_CONFIG_FILE
+ Path to local configuration, as a PHP source file.
+
+BOOST_RSS_DIR
+ Path to directory with RSS feeds from Gmane.
+
+ARCHIVE_PREFIX
+ Partial path for Boost release archives, the ZIP versions.
+
+UNZIP
+ Unzip program to use to extract files from ZIPs.
+
+ARCHIVE_FILE_PREFIX
+ Prefix for the root directory in the Boost ZIP archives.
+*/
+
 switch ($_SERVER['HTTP_HOST'])
 {
   case 'boost.org':
@@ -12,8 +29,6 @@
   case 'beta.boost.org':
   {
     define('BOOST_CONFIG_FILE','/home/grafik/www.boost.org/config.php');
- define('ARCHIVE_PREFIX', '/home/grafik/www.boost.org/boost_');
- define('UNZIP', '/usr/bin/unzip');
   }
   break;
   
@@ -21,8 +36,6 @@
   case 'boost.borg.redshift-software.com':
   {
     define('BOOST_CONFIG_FILE','/DevRoots/Boost/website/workplace/config.php');
- define('ARCHIVE_PREFIX', '/DevRoots/Boost/boost_');
- define('UNZIP', 'unzip');
   }
   break;
 }

Modified: website/public_html/beta/common/code/boost_irc_stats.php
==============================================================================
--- website/public_html/beta/common/code/boost_irc_stats.php (original)
+++ website/public_html/beta/common/code/boost_irc_stats.php 2007-08-04 16:38:01 EDT (Sat, 04 Aug 2007)
@@ -4,36 +4,7 @@
   Distributed under the Boost Software License, Version 1.0.
   (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 */
-require_once(dirname(__FILE__) . '/boost_config.php');
-
-
-function _preg_replace_bounds($front_regex,$back_regex,$front_replace,$back_replace,$text)
-{
- $offset = 0;
- $result = '';
- while (TRUE)
- {
- $subject = substr($text,$offset);
- if (preg_match($front_regex,$subject,$begin,PREG_OFFSET_CAPTURE) == 0 ||
- preg_match($back_regex,$subject,$end,PREG_OFFSET_CAPTURE,
- $begin[0][1]+strlen($begin[0][0])) == 0
- )
- { break; }
- else
- {
- $result .= substr($subject,0,$begin[0][1]);
- $result .= preg_replace($front_regex,$front_replace,$begin[0][0]);
- $result .= substr(
- $subject,
- $begin[0][1]+strlen($begin[0][0]),
- $end[0][1]-($begin[0][1]+strlen($begin[0][0])) );
- $result .= preg_replace($back_regex,$back_replace,$end[0][0]);
- $offset += $end[0][1]+strlen($end[0][0]);
- }
- }
- if ($result === '') { return $text; }
- else { return $result . substr($text,$offset); }
-}
+require_once(dirname(__FILE__) . '/boost.php');
 
 class boost_irc_stats
 {

Added: website/public_html/beta/common/code/boost_utility.php
==============================================================================
--- (empty file)
+++ website/public_html/beta/common/code/boost_utility.php 2007-08-04 16:38:01 EDT (Sat, 04 Aug 2007)
@@ -0,0 +1,37 @@
+<?php
+/*
+ Copyright 2007 Redshift Software, Inc.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+*/
+require_once(dirname(__FILE__) . '/boost.php');
+
+
+function _preg_replace_bounds($front_regex,$back_regex,$front_replace,$back_replace,$text)
+{
+ $offset = 0;
+ $result = '';
+ while (TRUE)
+ {
+ $subject = substr($text,$offset);
+ if (preg_match($front_regex,$subject,$begin,PREG_OFFSET_CAPTURE) == 0 ||
+ preg_match($back_regex,$subject,$end,PREG_OFFSET_CAPTURE,
+ $begin[0][1]+strlen($begin[0][0])) == 0
+ )
+ { break; }
+ else
+ {
+ $result .= substr($subject,0,$begin[0][1]);
+ $result .= preg_replace($front_regex,$front_replace,$begin[0][0]);
+ $result .= substr(
+ $subject,
+ $begin[0][1]+strlen($begin[0][0]),
+ $end[0][1]-($begin[0][1]+strlen($begin[0][0])) );
+ $result .= preg_replace($back_regex,$back_replace,$end[0][0]);
+ $offset += $end[0][1]+strlen($end[0][0]);
+ }
+ }
+ if ($result === '') { return $text; }
+ else { return $result . substr($text,$offset); }
+}
+?>
\ No newline at end of file

Modified: website/public_html/beta/common/code/boost_version.php
==============================================================================
--- website/public_html/beta/common/code/boost_version.php (original)
+++ website/public_html/beta/common/code/boost_version.php 2007-08-04 16:38:01 EDT (Sat, 04 Aug 2007)
@@ -4,7 +4,7 @@
   Distributed under the Boost Software License, Version 1.0.
   (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 */
-require_once(dirname(__FILE__) . '/boost_config.php');
+require_once(dirname(__FILE__) . '/boost.php');
 
 
 function boost_version($v,$r,$p)

Modified: website/public_html/beta/common/code/boost_wiki.php
==============================================================================
--- website/public_html/beta/common/code/boost_wiki.php (original)
+++ website/public_html/beta/common/code/boost_wiki.php 2007-08-04 16:38:01 EDT (Sat, 04 Aug 2007)
@@ -4,37 +4,9 @@
   Distributed under the Boost Software License, Version 1.0.
   (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 */
-require_once(dirname(__FILE__) . '/boost_config.php');
+require_once(dirname(__FILE__) . '/boost.php');
 
 
-function _preg_replace_bounds($front_regex,$back_regex,$front_replace,$back_replace,$text)
-{
- $offset = 0;
- $result = '';
- while (TRUE)
- {
- $subject = substr($text,$offset);
- if (preg_match($front_regex,$subject,$begin,PREG_OFFSET_CAPTURE) == 0 ||
- preg_match($back_regex,$subject,$end,PREG_OFFSET_CAPTURE,
- $begin[0][1]+strlen($begin[0][0])) == 0
- )
- { break; }
- else
- {
- $result .= substr($subject,0,$begin[0][1]);
- $result .= preg_replace($front_regex,$front_replace,$begin[0][0]);
- $result .= substr(
- $subject,
- $begin[0][1]+strlen($begin[0][0]),
- $end[0][1]-($begin[0][1]+strlen($begin[0][0])) );
- $result .= preg_replace($back_regex,$back_replace,$end[0][0]);
- $offset += $end[0][1]+strlen($end[0][0]);
- }
- }
- if ($result === '') { return $text; }
- else { return $result . substr($text,$offset); }
-}
-
 class boost_wiki
 {
     var $head_content_ = NULL;

Modified: website/public_html/beta/common/code/feed.php
==============================================================================
--- website/public_html/beta/common/code/feed.php (original)
+++ website/public_html/beta/common/code/feed.php 2007-08-04 16:38:01 EDT (Sat, 04 Aug 2007)
@@ -4,7 +4,7 @@
   Distributed under the Boost Software License, Version 1.0.
   (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 */
-require_once(dirname(__FILE__) . '/boost_config.php');
+require_once(dirname(__FILE__) . '/boost.php');
 
 
 function _field_cmp_key_($a,$b)

Modified: website/public_html/beta/common/code/libraries.php
==============================================================================
--- website/public_html/beta/common/code/libraries.php (original)
+++ website/public_html/beta/common/code/libraries.php 2007-08-04 16:38:01 EDT (Sat, 04 Aug 2007)
@@ -4,7 +4,7 @@
   Distributed under the Boost Software License, Version 1.0.
   (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 */
-require_once(dirname(__FILE__) . '/boost_config.php');
+require_once(dirname(__FILE__) . '/boost.php');
 
 
 function _field_cmp_key_($a,$b)


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk