diff --git a/.appveyor.yml b/.appveyor.yml index e067ca7090..ca6ceb7d89 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,6 +7,7 @@ environment: matrix: - php_ver_target: 7.0 - php_ver_target: 7.1 + - php_ver_target: 7.2 init: - SET PATH=C:\Program Files\OpenSSL;C:\tools\php;%PATH% diff --git a/.drone.yml b/.drone.yml index 8839a3216c..3b07485be5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -33,6 +33,32 @@ pipeline: commands: - ./libraries/vendor/bin/phpunit --configuration ./libraries/vendor/joomla/test-unit/phpunit.xml.dist + javascript: + image: joomlaprojects/docker-systemtests:latest + commands: + - apt-get install nodejs npm + - ln -s /usr/bin/nodejs /usr/bin/node + - export DISPLAY=:0 + - Xvfb -screen 0 1024x768x24 -ac +extension GLX +render -noreset > /dev/null 2>&1 & + - sleep 3 + - mv -f drone-package.json package.json + - fluxbox > /dev/null 2>&1 & + - npm install + - node_modules/karma/bin/karma start node_modules/joomla-javascript-tests/src/karma.conf.js --single-run + + system-tests: + image: joomlaprojects/docker-systemtests:latest + commands: + - date + - apache2ctl -D FOREGROUND & + - google-chrome --version + - apt-get update > /dev/null 2>&1 + - composer update > /dev/null 2>&1 + - chmod 755 libraries/vendor/joomla-projects/selenium-server-standalone/bin/webdrivers/chrome/linux/chromedriver + - mv libraries/vendor/joomla/test-system/src/acceptance.suite.dist.yml libraries/vendor/joomla/test-system/src/acceptance.suite.yml + - libraries/vendor/bin/robo run:tests + - date + services: mysql: image: mysql:5.7 diff --git a/RoboFile.dist.ini b/RoboFile.dist.ini deleted file mode 100644 index a4f60e68ee..0000000000 --- a/RoboFile.dist.ini +++ /dev/null @@ -1,6 +0,0 @@ -; If you want to setup your test website (document root) in a different folder, you can do that here. -; You can also set an absolute path, i.e. /path/to/my/cms/folder -cmsPath = test-install - -; (Linux / Mac only) If you want to set a different owner for the CMS root folder, you can set it here. -localUser = diff --git a/RoboFile.php b/RoboFile.php index 4f65c925f3..bd920884da 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -57,28 +57,12 @@ class RoboFile extends \Robo\Tasks */ private $testsPath = 'libraries/vendor/joomla/test-system/src/'; - /** - * Local configuration parameters - * - * @var array - * @since 3.7.3 - */ - private $configuration = array(); - /** * @var array | null * @since 3.7.3 */ private $suiteConfig; - /** - * Path to the local CMS test folder - * - * @var string - * @since 3.7.3 - */ - protected $cmsPath = null; - /** * RoboFile constructor. * @@ -86,67 +70,11 @@ class RoboFile extends \Robo\Tasks */ public function __construct() { - $this->configuration = $this->getConfiguration(); - $this->cmsPath = $this->getTestingPath(); // Set default timezone (so no warnings are generated if it is not set) date_default_timezone_set('UTC'); } - /** - * Get (optional) configuration from an external file - * - * @since 3.7.3 - * - * @return \stdClass|null - */ - public function getConfiguration() - { - $configurationFile = __DIR__ . '/RoboFile.ini'; - - if (!file_exists($configurationFile)) - { - $this->say('No local configuration file'); - - return null; - } - - $configuration = parse_ini_file($configurationFile); - - if ($configuration === false) - { - $this->say('Local configuration file is empty or wrong (check is it in correct .ini format'); - - return null; - } - - return json_decode(json_encode($configuration)); - } - - /** - * Get the correct CMS root path - * - * @since 3.7.3 - * - * @return string - */ - private function getTestingPath() - { - if (empty($this->configuration->cmsPath)) - { - return 'test-install'; - } - - if (!file_exists(dirname($this->configuration->cmsPath))) - { - $this->say('CMS path written in local configuration does not exists or is not readable'); - - return 'test-install'; - } - - return $this->configuration->cmsPath; - } - /** * Creates a testing Joomla site for running the tests (use it before run:test) * @@ -158,48 +86,80 @@ private function getTestingPath() */ public function createTestingSite($useHtaccess = false) { + $cmsPath = $this->getSuiteConfig()['modules']['config']['Helper\\Acceptance']['cmsPath']; + $localUser = $this->getSuiteConfig()['modules']['config']['Helper\\Acceptance']['localUser']; + // Clean old testing site - if (is_dir($this->cmsPath)) + if (is_dir($cmsPath)) { try { - $this->taskDeleteDir($this->cmsPath)->run(); + $this->taskDeleteDir($cmsPath)->run(); } catch (Exception $e) { // Sorry, we tried :( - $this->say('Sorry, you will have to delete ' . $this->cmsPath . ' manually.'); + $this->say('Sorry, you will have to delete ' . $cmsPath . ' manually.'); exit(1); } } $exclude = [ - 'tests', - 'tests-phpunit', - '.run', + '.drone', '.github', '.git', + '.run', + '.idea', + 'build', + 'dev', + 'node_modules', + 'tests', 'test-install', - 'libraries/vendor/codeception', - 'libraries/vendor/behat', - 'libraries/vendor/joomla-projects', - 'libraries/vendor/consolidation' + '.appveyor.yml', + '.babelrc', + '.drone.yml', + '.eslintignore', + '.eslintrc', + '.gitignore', + '.hound.yml', + '.php_cs', + '.travis.yml', + 'appveyor-phpunit.xml', + 'build.js', + 'build.xml', + 'codeception.yml', + 'composer.json', + 'composer.lock', + 'configuration.php', + 'drone-package.json', + 'Gemfile', + 'htaccess.txt', + 'karma.conf.js', + 'package.json', + 'package-lock.json', + 'phpunit.xml.dist', + 'RoboFile.dist.ini', + 'RoboFile.php', + 'robots.txt.dist', + 'scss-lint.yml', + 'selenium.log', + 'travisci-phpunit.xml', ]; - $this->copyJoomla($this->cmsPath, $exclude); + $this->copyJoomla($cmsPath, $exclude); // Optionally change owner to fix permissions issues - if (!empty($this->configuration->localUser)) + if (!empty($localUser)) { - $this->_exec('chown -R ' . $this->configuration->localUser . ' ' . $this->cmsPath); + $this->_exec('chown -R ' . $localUser . ' ' . $cmsPath); } // Optionally uses Joomla default htaccess file. Used by TravisCI if ($useHtaccess == true) { $this->say('Renaming htaccess.txt to .htaccess'); - $this->_copy('./htaccess.txt', $this->cmsPath . '/.htaccess'); + $this->_copy('./htaccess.txt', $cmsPath . '/.htaccess'); $this->_exec('sed -e "s,# RewriteBase /,RewriteBase /test-install/joomla-cms,g" -in-place test-install/joomla-cms/.htaccess'); } } @@ -290,23 +250,21 @@ public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop']) $pathToCodeception = $this->vendorPath . 'bin/codecept'; } - $this->taskCodecept($pathToCodeception) - ->arg('--steps') - ->arg('--debug') - ->arg('--fail-fast') - ->env($opts['env']) - ->arg($this->testsPath . 'acceptance/install/') - ->run() - ->stopOnFail(); + $suites = [ + 'acceptance/install/', + 'acceptance/administrator/components/com_users', + 'acceptance/administrator/components/com_content', + 'acceptance/administrator/components/com_menu', + ]; - $this->taskCodecept() - ->arg('--steps') - ->arg('--debug') - ->arg('--fail-fast') - ->env($opts['env']) - ->arg($this->testsPath . '/acceptance/administrator/components/com_users') - ->run() - ->stopOnFail(); + foreach ($suites as $suite) { + $this->taskCodecept($pathToCodeception) + ->arg('--fail-fast') + ->env($opts['env']) + ->arg($this->testsPath . $suite) + ->run() + ->stopOnFail(); + } } /** diff --git a/administrator/components/com_menus/tmpl/item/edit_modules.php b/administrator/components/com_menus/tmpl/item/edit_modules.php index 34c27a8570..9b26308914 100644 --- a/administrator/components/com_menus/tmpl/item/edit_modules.php +++ b/administrator/components/com_menus/tmpl/item/edit_modules.php @@ -18,8 +18,33 @@ JFactory::getDocument()->addScriptOptions('menus-edit-modules', ['viewLevels' => $allLevels, 'itemId' => $this->item->id]); JHtml::_('stylesheet', 'com_menus/admin-item-edit_modules.css', array('version' => 'auto', 'relative' => true)); + +// TODO: Re-remove the jQuery dependency in the admin-item-edit_modules.js file: +JHtml::_('jquery.framework'); JHtml::_('script', 'com_menus/admin-item-edit_modules.min.js', array('version' => 'auto', 'relative' => true)); +// Set up the bootstrap modal that will be used for all module editors +echo JHtml::_( + 'bootstrap.renderModal', + 'moduleEditModal', + array( + 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'), + 'backdrop' => 'static', + 'keyboard' => false, + 'closeButton' => false, + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'footer' => '' + . '' + . '', + ) +); + +?> +fields = array('toggle_modules_assigned','toggle_modules_published'); @@ -63,8 +88,12 @@ - id . '&tmpl=component&view=module&layout=modal'; ?> - + escape($module->title); ?> @@ -109,30 +138,6 @@ - id . 'Modal', - array( - 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'), - 'backdrop' => 'static', - 'keyboard' => false, - 'closeButton' => false, - 'url' => $link, - 'height' => '400px', - 'width' => '800px', - 'bodyHeight' => 70, - 'modalWidth' => 80, - 'footer' => '' - . '' - . '', - ) - ); ?> diff --git a/administrator/language/en-GB/en-GB.plg_authentication_gmail.ini b/administrator/language/en-GB/en-GB.plg_authentication_gmail.ini deleted file mode 100644 index 2bfaf314a8..0000000000 --- a/administrator/language/en-GB/en-GB.plg_authentication_gmail.ini +++ /dev/null @@ -1,18 +0,0 @@ -; Joomla! Project -; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved. -; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php -; Note : All ini files need to be saved as UTF-8 - -PLG_AUTHENTICATION_GMAIL="Authentication - Gmail" -PLG_GMAIL_ERROR_LOCAL_USERNAME_CONFLICT="A local username conflicts with your Gmail username." -PLG_GMAIL_FIELD_APPLYSUFFIX_LABEL="Apply Username Suffix" -PLG_GMAIL_FIELD_BACKEND_LOGIN_LABEL="Backend Login" -PLG_GMAIL_FIELD_SUFFIX_DESC="A suffix to use for the username, typically gmail.com (or googlemail.com) is the suffix but you may wish to use a Google Apps for Your Domain suffix, this doesn't include the @ symbol." -PLG_GMAIL_FIELD_SUFFIX_LABEL="Username Suffix" -PLG_GMAIL_FIELD_USER_BLACKLIST_DESC="The usernames should be separated by a comma." -PLG_GMAIL_FIELD_USER_BLACKLIST_LABEL="Username Blacklist" -PLG_GMAIL_FIELD_VALUE_APPLYSUFFIXALWAYS="Always use suffix" -PLG_GMAIL_FIELD_VALUE_APPLYSUFFIXMISSING="Apply suffix if missing" -PLG_GMAIL_FIELD_VALUE_NOAPPLYSUFFIX="Don't Apply Suffix" -PLG_GMAIL_FIELD_VERIFYPEER_LABEL="Verify Peer" -PLG_GMAIL_XML_DESCRIPTION="Handles User Authentication with a Gmail or Googlemail account (Requires cURL).
Users may need to enable Access for less secure apps at https://www.google.com/settings/security/lesssecureapps to be able to log in using this method.
Warning! You must have at least one authentication plugin enabled or you will lose all access to your site." diff --git a/administrator/language/en-GB/en-GB.plg_authentication_gmail.sys.ini b/administrator/language/en-GB/en-GB.plg_authentication_gmail.sys.ini deleted file mode 100644 index b9c9e63266..0000000000 --- a/administrator/language/en-GB/en-GB.plg_authentication_gmail.sys.ini +++ /dev/null @@ -1,7 +0,0 @@ -; Joomla! Project -; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved. -; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php -; Note : All ini files need to be saved as UTF-8 - -PLG_AUTHENTICATION_GMAIL="Authentication - Gmail" -PLG_GMAIL_XML_DESCRIPTION="Handles User Authentication with a Gmail or Googlemail account (Requires cURL).
Users may need to enable Access for less secure apps at https://www.google.com/settings/security/lesssecureapps to be able to log in using this method.
Warning! You must have at least one authentication plugin enabled or you will lose all access to your site." diff --git a/administrator/modules/mod_multilangstatus/Helper/MultilangstatusAdminHelper.php b/administrator/modules/mod_multilangstatus/Helper/MultilangstatusAdminHelper.php new file mode 100644 index 0000000000..c7d19c21f4 --- /dev/null +++ b/administrator/modules/mod_multilangstatus/Helper/MultilangstatusAdminHelper.php @@ -0,0 +1,140 @@ +getQuery(true) + ->select($db->quoteName('enabled')) + ->from($db->quoteName('#__extensions')) + ->where($db->quoteName('type') . ' = ' . $db->quote('module')) + ->where($db->quoteName('element') . ' = ' . $db->quote('mod_multilangstatus')); + $db->setQuery($query); + + try + { + $result = (int) $db->loadResult(); + } + catch (\RuntimeException $e) + { + $app->enqueueMessage($e->getMessage(), 'error'); + } + + return $result; + } + + /** + * Method to check the state of the module + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public static function getState() + { + $app = Factory::getApplication(); + $db = Factory::getDbo(); + + $query = $db->getQuery(true) + ->select($db->quoteName('published')) + ->from($db->quoteName('#__modules')) + ->where($db->quoteName('module') . ' = ' . $db->quote('mod_multilangstatus')); + $db->setQuery($query); + + try + { + $result = (int) $db->loadResult(); + } + catch (\RuntimeException $e) + { + $app->enqueueMessage($e->getMessage(), 'error'); + } + + return $result; + } + + /** + * Method to publish/unpublish the module depending on the languagefilter state + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public static function publish() + { + $app = Factory::getApplication(); + $db = Factory::getDbo(); + + // If the module is trashed do not change its status + if (self::getState() != -2) + { + // Publish the module when the languagefilter is enabled + if (Multilanguage::isEnabled()) + { + $query = $db->getQuery(true) + ->update($db->quoteName('#__modules')) + ->set($db->quoteName('published') . ' = ' . (int) 1) + ->where($db->quoteName('module') . ' = ' . $db->quote('mod_multilangstatus')); + + try + { + $db->setQuery($query)->execute(); + } + catch (\RuntimeException $e) + { + $app->enqueueMessage($e->getMessage(), 'error'); + + return; + } + } + else + { + // Unpublish the module when the languagefilter is disabled + $query = $db->getQuery(true) + ->update($db->quoteName('#__modules')) + ->set($db->quoteName('published') . ' = ' . (int) 0) + ->where($db->quoteName('module') . ' = ' . $db->quote('mod_multilangstatus')); + + try + { + $db->setQuery($query)->execute(); + } + catch (Exception $e) + { + $app->enqueueMessage($e->getMessage(), 'error'); + + return; + } + } + } + } +} diff --git a/administrator/modules/mod_status/tmpl/default.php b/administrator/modules/mod_status/tmpl/default.php index 57c7e5c5ef..d8f0c7f4a8 100644 --- a/administrator/modules/mod_status/tmpl/default.php +++ b/administrator/modules/mod_status/tmpl/default.php @@ -17,16 +17,30 @@ use Joomla\CMS\Router\Route; use Joomla\CMS\Session\Session; use Joomla\CMS\Helper\ModuleHelper; +use Joomla\Module\Multilangstatus\Administrator\Helper\MultilangstatusAdminHelper; $hideLinks = $app->input->getBool('hidemainmenu'); +// Check if the multilangstatus module is present in the site +if (class_exists(MultilangstatusAdminHelper::class)) +{ + // Check if the module is present and enabled in the extensions table + if (MultilangstatusAdminHelper::isEnabled()) + { + // Publish/Unpublish the module if it exists in the modules table + // depending on the status of the languagefilter + MultilangstatusAdminHelper::publish(); + } +} ?>