?
avatar betweenbrain
betweenbrain
2 Oct 2014

With Joomla CMS version 3.3.6, and following http://docs.joomla.org/How_to_create_a_stand-alone_application_using_the_Joomla!_Platform#Example_1:_Hello_World_Command_Line_Interface_.28CLI.29_App to create a simple CLI app, I get PHP Fatal error: Class 'JRegistry' not found in /libraries/joomla/application/cli.php on line 90

avatar betweenbrain betweenbrain - open - 2 Oct 2014
avatar mbabker
mbabker - comment - 2 Oct 2014

The docs need to be updated, applications should import libraries/import.legacy.php and libraries/cms.php to get a proper environment.

https://github.com/joomla/joomla-cms/blob/staging/cli/deletefiles.php shows a good application startup routine.

avatar betweenbrain
betweenbrain - comment - 2 Oct 2014

Thanks!

Looking at the docs compared to deletefiles.php, and a bit of testing, it seems that:

define('JPATH_BASE', dirname(__FILE__));

require '../libraries/import.php';

Ought to be changed to

define('JPATH_BASE', dirname(__DIR__));

// Load system defines
if (file_exists(JPATH_BASE . '/defines.php'))
{
    require_once JPATH_BASE . '/defines.php';
}

if (!defined('_JDEFINES'))
{
    require_once JPATH_BASE . '/includes/defines.php';
}

// Get the framework.
require_once JPATH_LIBRARIES . '/import.legacy.php';

// Bootstrap the CMS libraries.
require_once JPATH_LIBRARIES . '/cms.php';

Do you agree?

avatar betweenbrain
betweenbrain - comment - 2 Oct 2014

I should add that the reason being

PHP Notice:  Use of undefined constant JPATH_LIBRARIES - assumed 'JPATH_LIBRARIES' in /libraries/import.legacy.php on line 95
PHP Notice:  Use of undefined constant JPATH_LIBRARIES - assumed 'JPATH_LIBRARIES' in /libraries/cms.php on line 42
PHP Warning:  include_once(JPATH_LIBRARIES/fof/include.php): failed to open stream: No such file or directory in/libraries/cms.php on line 42
PHP Warning:  include_once(): Failed opening 'JPATH_LIBRARIES/fof/include.php' for inclusion
avatar mbabker
mbabker - comment - 2 Oct 2014

Looks good.

avatar zero-24 zero-24 - close - 2 Oct 2014
avatar betweenbrain
betweenbrain - comment - 2 Oct 2014

Docs updated, thanks!

avatar betweenbrain betweenbrain - close - 2 Oct 2014
avatar zero-24 zero-24 - close - 2 Oct 2014
avatar betweenbrain betweenbrain - change - 2 Oct 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-10-02 14:52:09
avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?

Add a Comment

Login with GitHub to post a comment