From: Michael M Slusarz Date: Wed, 20 Jan 2010 08:03:25 +0000 (-0700) Subject: Horde_Registry_Application fixes in horde/framework X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=61e152c;p=horde.git Horde_Registry_Application fixes in horde/framework --- diff --git a/framework/Image/tests/runtest.php b/framework/Image/tests/runtest.php index ba45cca35..401b5b1b0 100644 --- a/framework/Image/tests/runtest.php +++ b/framework/Image/tests/runtest.php @@ -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) { . '' . Horde::img('im.php?test=' . $name . '&driver=Imagick', '', '', '') . ''; } echo ''; -?> \ No newline at end of file +?> diff --git a/framework/Memcache/scripts/Horde/Memcache/stats.php b/framework/Memcache/scripts/Horde/Memcache/stats.php index 101765e47..57cdb7983 100755 --- a/framework/Memcache/scripts/Horde/Memcache/stats.php +++ b/framework/Memcache/scripts/Horde/Memcache/stats.php @@ -16,25 +16,12 @@ * @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(); diff --git a/framework/Model/www/test.php b/framework/Model/www/test.php index 164428312..8255f6192 100644 --- a/framework/Model/www/test.php +++ b/framework/Model/www/test.php @@ -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'); diff --git a/framework/Prefs/test/Horde/Prefs/bug_2838.phpt b/framework/Prefs/test/Horde/Prefs/bug_2838.phpt index b434a1638..a8899fa14 100644 --- a/framework/Prefs/test/Horde/Prefs/bug_2838.phpt +++ b/framework/Prefs/test/Horde/Prefs/bug_2838.phpt @@ -3,10 +3,9 @@ Test for Bug #2838, overwriting of preferences when multiple scopes are retrieve --FILE-- 'none')); $prefs = Horde_Prefs::factory('session', 'horde', 'testuser', 'testpw'); $prefs->retrieve('imp'); diff --git a/framework/Rampage/scripts/Horde/Rampage/rampage.php b/framework/Rampage/scripts/Horde/Rampage/rampage.php index 7bcb62f1a..e61632485 100644 --- a/framework/Rampage/scripts/Horde/Rampage/rampage.php +++ b/framework/Rampage/scripts/Horde/Rampage/rampage.php @@ -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 diff --git a/framework/Release/lib/Horde/Release.php b/framework/Release/lib/Horde/Release.php index 03b74c3d7..2b88b02fd 100644 --- a/framework/Release/lib/Horde/Release.php +++ b/framework/Release/lib/Horde/Release.php @@ -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"); } } diff --git a/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php b/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php index 01376b1c6..d8adadcbc 100755 --- a/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php +++ b/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php @@ -11,24 +11,11 @@ */ // 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(); diff --git a/framework/SyncML/tests/testsync.php b/framework/SyncML/tests/testsync.php index 5abaee12a..21ec63fa1 100755 --- a/framework/SyncML/tests/testsync.php +++ b/framework/SyncML/tests/testsync.php @@ -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'); } diff --git a/framework/VFS/lib/VFS/horde.php b/framework/VFS/lib/VFS/horde.php index 0b03c8f2b..b7d2c631e 100644 --- a/framework/VFS/lib/VFS/horde.php +++ b/framework/VFS/lib/VFS/horde.php @@ -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(); diff --git a/framework/admintools/horde-base.php b/framework/admintools/horde-base.php index 67a5e8bca..720cfe7ae 100644 --- a/framework/admintools/horde-base.php +++ b/framework/admintools/horde-base.php @@ -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'; diff --git a/framework/admintools/horde-create-sequence.php b/framework/admintools/horde-create-sequence.php index 3f17623f3..4941c42a5 100644 --- a/framework/admintools/horde-create-sequence.php +++ b/framework/admintools/horde-create-sequence.php @@ -10,26 +10,13 @@ * @author Chuck Hagenbuch */ -// 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'])) { diff --git a/framework/admintools/horde-remove-pref.php b/framework/admintools/horde-remove-pref.php index 71f5d2279..73535168d 100755 --- a/framework/admintools/horde-remove-pref.php +++ b/framework/admintools/horde-remove-pref.php @@ -10,28 +10,12 @@ * @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:")); diff --git a/framework/admintools/horde-sql-shell.php b/framework/admintools/horde-sql-shell.php index 991c0b81c..8027e5766 100755 --- a/framework/admintools/horde-sql-shell.php +++ b/framework/admintools/horde-sql-shell.php @@ -10,22 +10,8 @@ * @author Chuck Hagenbuch */ -// 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')) { diff --git a/horde/rpc.php b/horde/rpc.php index cc12b3754..c978bf63f 100644 --- a/horde/rpc.php +++ b/horde/rpc.php @@ -17,7 +17,7 @@ * @author Jan Schneider */ -require_once dirname(__FILE__) . '/lib/core.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; $input = $session_control = null; $nocompress = false; diff --git a/horde/services/cache.php b/horde/services/cache.php index 58efda2be..615cf4075 100644 --- a/horde/services/cache.php +++ b/horde/services/cache.php @@ -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; diff --git a/horde/services/download/index.php b/horde/services/download/index.php index e99275c03..cc3daf8a1 100644 --- a/horde/services/download/index.php +++ b/horde/services/download/index.php @@ -8,9 +8,8 @@ * @author Michael Slusarz */ -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))) { diff --git a/horde/services/images/pixel.php b/horde/services/images/pixel.php index 7ffe5c3d4..63adb3b59 100644 --- a/horde/services/images/pixel.php +++ b/horde/services/images/pixel.php @@ -8,7 +8,7 @@ * @author Chuck Hagenbuch */ -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'); diff --git a/horde/services/imple.php b/horde/services/imple.php index f6412a539..7aaadffd0 100644 --- a/horde/services/imple.php +++ b/horde/services/imple.php @@ -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; diff --git a/horde/services/prefs/index.php b/horde/services/prefs/index.php index 20c7fd25c..ba9fde87e 100644 --- a/horde/services/prefs/index.php +++ b/horde/services/prefs/index.php @@ -8,9 +8,8 @@ * @author Chuck Hagenbuch */ -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'); diff --git a/horde/util/barcode.php b/horde/util/barcode.php index 995165886..4c7d9e36b 100644 --- a/horde/util/barcode.php +++ b/horde/util/barcode.php @@ -8,7 +8,7 @@ * @author Chuck Hagenbuch */ -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) . '*'; diff --git a/horde/util/icon_browser.php b/horde/util/icon_browser.php index b5a4bb4ce..ede635fe2 100644 --- a/horde/util/icon_browser.php +++ b/horde/util/icon_browser.php @@ -8,10 +8,9 @@ * @author Chuck Hagenbuch */ -$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);