Skip to content

Commit

Permalink
Use Horde_Registry#appInit() in horde-translation
Browse files Browse the repository at this point in the history
Otherwise, this fails when retrieving version information for
applications that use $injector or $registry in their _bootstrap()
methods (i.e. IMP 6.2).

I'm assuming the only reason we haven't updated to using appInit() is
because it simply wasn't needed before now - the application just worked.
(AFAICT, horde-translation previouslt required a working version of Horde
installed, so this doesn't change anything).
  • Loading branch information
slusarz authored and mrubinsk committed Nov 15, 2013
1 parent d2cc39d commit 1176b4e
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions horde/bin/horde-translation
Expand Up @@ -416,6 +416,8 @@ class Horde_Translation_Script
*/
public function xtract($options)
{
global $registry;

foreach ($options as $option) {
switch ($option[0]) {
case 'h':
Expand Down Expand Up @@ -458,10 +460,7 @@ class Horde_Translation_Script
* an invalid charset being used in this file. */
$tmp_file = $file . '.tmp.pot';

include_once $this->dirs[$i] . '/lib/Application.php';
$className = $this->apps[$i] . '_Application';
$appOb = new $className;
$version = $appOb->version;
$version = $registry->getVersion($this->apps[$i]);

$sh = $this->xgettext
. ' --language=PHP'
Expand Down Expand Up @@ -1577,12 +1576,12 @@ if (file_exists($baseFile)) {
require_once PEAR_Config::singleton()
->get('horde_dir', null, 'pear.horde.org') . '/lib/Application.php';
}
Horde_Registry::appInit('horde', array(
'cli' => true,
'session_control' => 'none'
));

$c = new Horde_Cli();
if (!$c->runningFromCLI()) {
$c->fatal('This script must be run from the command line.');
}
$c->init();
$c = $cli;

$c->writeln($c->bold('---------------------------'));
$c->writeln($c->bold('Horde translation generator'));
Expand All @@ -1591,8 +1590,6 @@ $c->writeln($c->bold('---------------------------'));
/* Instantiate main object. */
$script = new Horde_Translation_Script();
$script->cli = $c;
$registry = new Horde_Support_Stub();
$injector = new Horde_Support_Stub();

/* Sanity checks */
if (!extension_loaded('gettext')) {
Expand Down

0 comments on commit 1176b4e

Please sign in to comment.