29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-08-24 03:59:49 +00:00

Use namespaced classes in build scripts

This commit is contained in:
Michael Babker 2017-07-29 10:29:56 -05:00
parent 0d322d9a0b
commit e789975639
3 changed files with 23 additions and 12 deletions

View File

@ -9,6 +9,9 @@
// Set flag that this is a parent file.
const _JEXEC = 1;
// Import namespaced classes
use Joomla\CMS\Application\CliApplication;
// Set fixed precision value to avoid round related issues
ini_set('precision', 14);
@ -33,7 +36,7 @@ require_once JPATH_LIBRARIES . '/cms.php';
*
* @since 3.0
*/
class GenerateCss extends JApplicationCli
class GenerateCss extends CliApplication
{
/**
* Entry point for the script
@ -75,4 +78,4 @@ class GenerateCss extends JApplicationCli
}
}
JApplicationCli::getInstance('GenerateCss')->execute();
CliApplication::getInstance('GenerateCss')->execute();

View File

@ -9,6 +9,12 @@
// Set flag that this is a parent file.
const _JEXEC = 1;
// Import namespaced classes
use Joomla\CMS\Application\CliApplication;
use Joomla\CMS\Factory;
use Joomla\CMS\Version;
use Joomla\Registry\Registry;
// Load system defines
if (file_exists(dirname(__DIR__) . '/defines.php'))
{
@ -32,14 +38,14 @@ error_reporting(E_ALL);
ini_set('display_errors', 1);
// Load the admin en-GB.ini language file to get the JHELP language keys
JFactory::getLanguage()->load('joomla', JPATH_ADMINISTRATOR, null, false, false);
Factory::getLanguage()->load('joomla', JPATH_ADMINISTRATOR, null, false, false);
/**
* Utility CLI to retrieve the list of help screens from the docs wiki and create an index for the admin help view.
*
* @since 3.0
*/
class MediawikiCli extends JApplicationCli
class MediawikiCli extends CliApplication
{
/**
* Entry point for CLI script
@ -51,19 +57,18 @@ class MediawikiCli extends JApplicationCli
public function doExecute()
{
// Get the version data for the script
$version = new JVersion;
$helpVersion = str_replace('.', '', $version::RELEASE);
$helpVersion = str_replace('.', '', Version::RELEASE);
$namespace = 'Help' . $helpVersion . ':';
// Set up options for JMediawiki
$options = new Joomla\Registry\Registry;
$options = new Registry;
$options->set('api.url', 'https://docs.joomla.org');
$mediawiki = new JMediawiki($options);
// Get the category members (local hack)
$this->out('Fetching data from docs wiki', true);
$categoryMembers = $mediawiki->categories->getCategoryMembers('Category:Help_screen_' . $version::RELEASE, null, 'max');
$categoryMembers = $mediawiki->categories->getCategoryMembers('Category:Help_screen_' . Version::RELEASE, null, 'max');
$members = array();
@ -77,7 +82,7 @@ class MediawikiCli extends JApplicationCli
}
// Get the language object
$language = JFactory::getLanguage();
$language = Factory::getLanguage();
// Get the language strings via Reflection as the property is protected
$refl = new ReflectionClass($language);
@ -201,4 +206,4 @@ class MediawikiCli extends JApplicationCli
}
// Instantiate the application and execute it
JApplicationCli::getInstance('MediawikiCli')->execute();
CliApplication::getInstance('MediawikiCli')->execute();

View File

@ -9,6 +9,9 @@
// Set flag that this is a parent file.
const _JEXEC = 1;
// Import namespaced classes
use Joomla\CMS\Application\CliApplication;
// Load system defines
if (file_exists(dirname(__DIR__) . '/defines.php'))
{
@ -46,7 +49,7 @@ ini_set('display_errors', 1);
*
* @since 3.0
*/
class StubGenerator extends JApplicationCli
class StubGenerator extends CliApplication
{
/**
* Entry point for CLI script
@ -84,4 +87,4 @@ class StubGenerator extends JApplicationCli
}
// Instantiate the application and execute it
JApplicationCli::getInstance('StubGenerator')->execute();
CliApplication::getInstance('StubGenerator')->execute();