Horde_Registry_Application fixes in horde/framework
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 20 Jan 2010 08:03:25 +0000 (01:03 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 20 Jan 2010 16:33:01 +0000 (09:33 -0700)
21 files changed:
framework/Image/tests/runtest.php
framework/Memcache/scripts/Horde/Memcache/stats.php
framework/Model/www/test.php
framework/Prefs/test/Horde/Prefs/bug_2838.phpt
framework/Rampage/scripts/Horde/Rampage/rampage.php
framework/Release/lib/Horde/Release.php
framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php
framework/SyncML/tests/testsync.php
framework/VFS/lib/VFS/horde.php
framework/admintools/horde-base.php
framework/admintools/horde-create-sequence.php
framework/admintools/horde-remove-pref.php
framework/admintools/horde-sql-shell.php
horde/rpc.php
horde/services/cache.php
horde/services/download/index.php
horde/services/images/pixel.php
horde/services/imple.php
horde/services/prefs/index.php
horde/util/barcode.php
horde/util/icon_browser.php

index ba45cca..401b5b1 100644 (file)
@@ -2,8 +2,9 @@
 /**
  * Test harness for generating the test images for Horde_Image tests
  */
+
 define('HORDE_BASE', '/var/www/html/horde');
-require_once HORDE_BASE . '/lib/core.php';
+require_once HORDE_BASE . '/lib/Application.php';
 
 $allTests = array(
     'testInitialState' => 'Test initial state. Solid blue square',
@@ -43,4 +44,4 @@ foreach ($allTests as $name => $description) {
         . '<td text-align="top">' . Horde::img('im.php?test=' . $name . '&driver=Imagick', '', '', '') . '</td>';
 }
 echo '</table>';
-?></body></html>
\ No newline at end of file
+?></body></html>
index 101765e..57cdb79 100755 (executable)
  * @package Horde_Memcache
  */
 
-// Find the base file path of Horde.
-@define('HORDE_BASE', dirname(__FILE__) . '/..');
+// The base file path of horde.
+$horde_base = '/path/to/horde';
 
-// Do CLI checks and environment setup first.
-require_once HORDE_BASE . '/lib/core.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
-    exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
-$cli = &Horde_Cli::singleton();
-$cli->init();
-
-// No auth.
-$horde_authentication = 'none';
-require_once HORDE_BASE . '/lib/base.php';
+require_once $horde_base . '/lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
+$cli = Horde_Cli::singleton();
 
 /* Make sure there's no compression. */
 @ob_end_clean();
index 1644283..8255f61 100644 (file)
@@ -6,12 +6,12 @@
  * 2005.
  */
 
-@define('HORDE_BASE', dirname(__FILE__) . '/../..');
-@define('INCUBATOR_BASE', dirname(__FILE__));
+$horde_base = '/path/to/horde';
 
-require_once HORDE_BASE . '/lib/core.php';
+require_once $horde_base . '/lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none'));
 Horde_Autoloader::addClassPath(dirname(__FILE__));
-$registry = Horde_Registry::singleton();
+
 $vars = Horde_Variables::getDefaultVariables();
 
 $vars->set('example_bar', 'text with a beginning and an end');
index b434a16..a8899fa 100644 (file)
@@ -3,10 +3,9 @@ Test for Bug #2838, overwriting of preferences when multiple scopes are retrieve
 --FILE--
 <?php
 
-define('HORDE_BASE', dirname(dirname(dirname(dirname(__FILE__)))));
-require_once HORDE_BASE . '/lib/core.php';
-
-$registry = Horde_Registry::singleton();
+$horde_base = '/path/to/horde';
+require_once HORDE_BASE . '/lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none'));
 
 $prefs = Horde_Prefs::factory('session', 'horde', 'testuser', 'testpw');
 $prefs->retrieve('imp');
index 7bcb62f..e616324 100644 (file)
@@ -15,9 +15,8 @@
 
 @define('ZOMBIE_BASE', dirname(__FILE__) . '/..');
 
-/* We need horde only to get the sql driver config from conf.php. */
-require_once dirname(__FILE__) . '/lib/core.php';
-require_once HORDE_BASE . '/config/conf.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none'));
 
 /* List of files that are parsed, converted and copied to output
  * directory.  for all these files default zitem->parameter string
index 03b74c3..2b88b02 100644 (file)
@@ -471,18 +471,6 @@ class Horde_Release
             } else {
                 system("horde-fw-symlinks.php --copy --src ./$directory/framework --dest ./$directory/lib");
             }
-
-            print "Setting include path\n";
-            $filename = $directory . '/lib/core.php';
-            $newfilename = $filename . '.new';
-            $oldfp = fopen($filename, 'r');
-            $newfp = fopen($newfilename, 'w');
-            while ($line = fgets($oldfp)) {
-                fwrite($newfp, str_replace('// ini_set(\'include_path\'', 'ini_set(\'include_path\'', $line));
-            }
-            fclose($oldfp);
-            fclose($newfp);
-            system("mv -f $newfilename $filename");
         }
     }
 
index 01376b1..d8adadc 100755 (executable)
  */
 
 // Find the base file path of Horde.
-@define('HORDE_BASE', dirname(__FILE__) . '/..');
+$horde_base = '/path/to/horde';
 
-// Do CLI checks and environment setup first.
-require_once HORDE_BASE . '/lib/core.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
-    exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
+require_once $horde_base . '/lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
 $cli = Horde_Cli::singleton();
-$cli->init();
-
-// No auth.
-$horde_authentication = 'none';
-require_once HORDE_BASE . '/lib/base.php';
 
 /* Make sure there's no compression. */
 @ob_end_clean();
index 5abaee1..21ec63f 100755 (executable)
@@ -86,17 +86,8 @@ require_once 'SyncML/Backend.php';
 
 /* Do Horde includes if test for horde backend: */
 if ($syncml_backend_driver == 'Horde') {
-    /* Syncml does its own session handling. */
-    $horde_authentication = 'none';
-    $horde_session_control = 'none';
-    require_once dirname(__FILE__) . '/../../../lib/core.php';
-
-    // Load the CLI environment - make sure there's no time limit, init
-    // some variables, etc.
-    $cli = Horde_Cli::singleton();
-    $cli->init();
-
-    require_once HORDE_BASE . '/lib/base.php';
+    require_once dirname(__FILE__) . '/../../../lib/Application.php';
+    Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true, 'session_control' => 'none'));
     Horde_String::setDefaultCharset('UTF-8');
     Horde_Nls::setCharset('UTF-8');
 }
index 0b03c8f..b7d2c63 100644 (file)
@@ -39,11 +39,8 @@ class VFS_horde extends VFS {
             return;
         }
 
-        // Define path to Horde.
-        @define('HORDE_BASE', $this->_params['horde_base']);
-
-        // Load the Horde Framework core, and set up inclusion paths.
-        require_once HORDE_BASE . '/lib/core.php';
+        require_once $this->_params['horde_base'] . '/lib/Application.php';
+        Horde_Registry::appInit('horde');
 
         // Create the Registry object.
         $this->_registry = Horde_Registry::singleton();
index 67a5e8b..720cfe7 100644 (file)
@@ -4,8 +4,10 @@ if ((($base = getenv('HORDE_BASE')) ||
      (!empty($_ENV['HORDE_BASE']) && $base = $_ENV['HORDE_BASE'])) &&
     is_dir($base) && is_readable($base)) {
     $horde_base = $base;
-} elseif (is_file(getcwd() . '/lib/core.php')) {
+} elseif (is_file(getcwd() . '/lib/Application.php')) {
     $horde_base = getcwd();
 } else {
     $horde_base = dirname(dirname(dirname(__FILE__)));
 }
+
+require_once $horde_base . '/lib/Application.php';
index 3f17623..4941c42 100644 (file)
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-// Do CLI checks and environment setup first.
 require_once dirname(__FILE__) . '/horde-base.php';
-require_once $horde_base . '/lib/core.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
 
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
-    exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init
-// some variables, etc.
 $cli = Horde_Cli::singleton();
-$cli->init();
-
-// Include needed libraries.
-$horde_authentication = 'none';
-require_once HORDE_BASE . '/lib/base.php';
-
 $db_lib = 'DB';
 $sequence = null;
+
 if (isset($_SERVER['argv']) && count($_SERVER['argv']) >= 2) {
     array_shift($_SERVER['argv']);
     while ($arg = array_shift($_SERVER['argv'])) {
index 71f5d22..7353516 100755 (executable)
  * @package admintools
  */
 
-/**
- ** Set this to true if you want DB modifications done.
- **/
+/* Set this to true if you want DB modifications done.*/
 $live = false;
 
-// Do CLI checks and environment setup first.
 require_once dirname(__FILE__) . '/horde-base.php';
-require_once $horde_base . '/lib/core.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
-    exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init
-// some variables, etc.
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true, 'nocompress' => true));
 $cli = Horde_Cli::singleton();
-$cli->init();
-
-$horde_authentication = 'none';
-$horde_no_compress = true;
-require_once HORDE_BASE . '/lib/base.php';
 
 $scope = $cli->prompt(_("Enter value for pref_scope:"));
 $name = $cli->prompt(_("Enter value for pref_name:"));
index 991c0b8..8027e57 100755 (executable)
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-// Do CLI checks and environment setup first.
 require_once dirname(__FILE__) . '/horde-base.php';
-require_once $horde_base . '/lib/core.php';
-
-// Make sure no one runs this from the web.
-if (!Horde_Cli::runningFromCLI()) {
-    exit("Must be run from the command line\n");
-}
-
-// Load the CLI environment - make sure there's no time limit, init some
-// variables, etc.
-Horde_Cli::init();
-
-// Include needed libraries.
-$horde_authentication = 'none';
-require_once HORDE_BASE . '/lib/base.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
 
 $dbh = DB::connect($conf['sql']);
 if (is_a($dbh, 'PEAR_Error')) {
index cc12b37..c978bf6 100644 (file)
@@ -17,7 +17,7 @@
  * @author Jan Schneider <jan@horde.org>
  */
 
-require_once dirname(__FILE__) . '/lib/core.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
 
 $input = $session_control = null;
 $nocompress = false;
index 58efda2..615cf40 100644 (file)
@@ -18,8 +18,7 @@
  * DEFAULT: 525600 = 1 year */
 $expire_time = 525600;
 
-/* Load core first because we need access to Horde_Util::. */
-require_once dirname(__FILE__) . '/../lib/core.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
 
 if (!($path = Horde_Util::getFormData('cache'))) {
     exit;
index e99275c..cc3daf8 100644 (file)
@@ -8,9 +8,8 @@
  * @author Michael Slusarz <slusarz@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../../lib/core.php';
-
-$registry = Horde_Registry::singleton(Horde_Registry::SESSION_READONLY);
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+Horde_Registry::appInit('horde', array('session_control' => 'readonly'));
 
 if (!($module = Horde_Util::getFormData('module')) ||
     !file_exists($registry->get('fileroot', $module))) {
index 7ffe5c3..63adb3b 100644 (file)
@@ -8,7 +8,7 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../../lib/core.php';
+require_once dirname(__FILE__) . '/../../lib/Application.php';
 
 header('Content-type: image/gif');
 header('Expires: Wed, 21 Aug 1969 11:11:11 GMT');
index f6412a5..7aaadff 100644 (file)
@@ -20,8 +20,7 @@
  * @package Horde
  */
 
-/* Load core first because we need access to Horde_Util::. */
-require_once dirname(__FILE__) . '/../lib/core.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
 
 if (!($path = Horde_Util::getFormData('imple'))) {
     exit;
index 20c7fd2..ba9fde8 100644 (file)
@@ -8,9 +8,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../../lib/core.php';
-
-$registry = Horde_Registry::singleton();
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+Horde_Registry::appInit('horde');
 
 /* Which application. */
 $app = Horde_Util::getFormData('app');
index 9951658..4c7d9e3 100644 (file)
@@ -8,7 +8,7 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../lib/core.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
 
 // Get text, uppercase, add start/stop characters.
 $text = '*' . Horde_String::upper(Horde_Util::getFormData('barcode', 'test'), true) . '*';
index b5a4bb4..ede635f 100644 (file)
@@ -8,10 +8,9 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-$horde_authentication = 'none';
-require_once dirname(__FILE__) . '/../lib/core.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('horde', array('authentication' => 'none'));
 
-$registry = Horde_Registry::singleton();
 $apps = $registry->listApps(array('notoolbar', 'active', 'admin', 'inactive', 'hidden'), true);
 ksort($apps);