Skip to content

Commit

Permalink
Version 1.15.0 (2020-05-12)
Browse files Browse the repository at this point in the history
  * Added ElasticSearch check
  * Improved DevDoc URLs
  * Magento2 Coding Standard
  • Loading branch information
Jeroen Vermeulen - MageHost committed May 12, 2020
1 parent 9048c94 commit 4f19eac
Show file tree
Hide file tree
Showing 18 changed files with 94 additions and 74 deletions.
17 changes: 11 additions & 6 deletions Block/Backend/Dashboard/Grid/Column/Renderer/Buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,30 @@ private function _getButtonHtml($button)
}
$result = '';
$magentoVersionArray = explode(
'.', $this->_productMetadata->getVersion()
'.',
$this->_productMetadata->getVersion()
);
$button['url'] = str_replace(
'[devdocs-guides]',
sprintf(
'http://devdocs.magento.com/guides/v%d.%d',
$magentoVersionArray[0], $magentoVersionArray[1]
$magentoVersionArray[0],
$magentoVersionArray[1]
),
$button['url']
);
$button['url'] = str_replace(
'[user-guides]',
sprintf(
'https://docs.magento.com/%s/%s/user_guide',
'm2', 'ce'
'm2',
'ce'
),
$button['url']
);
if (preg_match('#^https?://#', $button['url'])) {
$target = empty($button['target']) ? '_blank' : $button['target'];
if (empty($button['label'])
if (empty($button['label'])
&& false !== strpos($button['url'], '//devdocs.magento.com/')
) {
$button['label'] = 'DevDocs';
Expand All @@ -122,7 +125,8 @@ private function _getButtonHtml($button)
$routeParams = empty($button['url_params']) ?
null : $button['url_params'];
$button['url'] = $this->_urlBuilder->getUrl(
$button['url'], $routeParams
$button['url'],
$routeParams
);
$target = empty($button['target']) ? '_top' : $button['target'];
}
Expand All @@ -131,7 +135,8 @@ private function _getButtonHtml($button)
// To show button:
// <button style="padding: 0.2rem 0.5em; font-size: 1.3rem">%s</button>
$result .= sprintf(
'%s', str_replace(' ', '&nbsp;', $label)
'%s',
str_replace(' ', '&nbsp;', $label)
);
$result .= '</a>';
return $result;
Expand Down
2 changes: 1 addition & 1 deletion Block/Backend/Dashboard/Grid/Column/Statuses.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function getFrameCallback()
/**
* Decorate status column values
*
* @noinspection PhpUnused
* @noinspection PhpUnused
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @param string $value - Column value
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 1.15.0 (2020-05-12)

* Added ElasticSearch check
* Improved DevDoc URLs
* Magento2 Coding Standard

### 1.14.2 (2018-07-16)

* Fixed config link on HTTP/2 check for HTTPS requirement
Expand Down
4 changes: 2 additions & 2 deletions Controller/Adminhtml/Dashboard/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ class Index extends Action
{
/**
* Controller for the overview page of the Performance Dashboard
*
*
* @var PageFactory
*/
private $_resultPageFactory;

/**
* Constructor
*
* @param Context $context -
* @param Context $context -
* @param PageFactory $resultPageFactory -
*/
public function __construct(
Expand Down
10 changes: 8 additions & 2 deletions Logger/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ public function __construct(
) {
$this->_directoryList = $directoryList;
parent::__construct(
$filename, $maxFiles, $level, $bubble, $filePermission, $useLocking
$filename,
$maxFiles,
$level,
$bubble,
$filePermission,
$useLocking
);
}

Expand All @@ -82,7 +87,8 @@ protected function getTimedFilename()
if ('/' != substr($this->filename, 0, 1)) {
// Prepend Magento log dir
$this->filename = sprintf(
"%s/%s", $this->_directoryList->getPath('log'),
"%s/%s",
$this->_directoryList->getPath('log'),
$this->filename
);
}
Expand Down
4 changes: 2 additions & 2 deletions Model/DashboardRow/AppStateMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class AppStateMode extends DashboardRow implements DashboardRowInterface
{
/**
* Application state flags.
*
*
* @var State
*/
private $_appState;
Expand All @@ -43,7 +43,7 @@ class AppStateMode extends DashboardRow implements DashboardRowInterface
* Constructor.
*
* @param State $appState - Application state flags
* @param array $data - Data for object
* @param array $data - Data for object
*/
public function __construct(
State $appState,
Expand Down
6 changes: 4 additions & 2 deletions Model/DashboardRow/AsyncIndexes.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class AsyncIndexes extends DashboardRow implements DashboardRowInterface
{
/**
* Collection of indexers
*
*
* @var Collection
*/
private $_indexerCollection;
Expand Down Expand Up @@ -85,7 +85,9 @@ public function load()
$this->setTitle(__("Asynchronous Indexing"));

if (version_compare(
$this->_productMetadata->getVersion(), '2.2.0.dev', '<'
$this->_productMetadata->getVersion(),
'2.2.0.dev',
'<'
)
) {
if (!$this->_scopeConfig->getValue('dev/grid/async_indexing')) {
Expand Down
8 changes: 5 additions & 3 deletions Model/DashboardRow/CacheEnabled.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CacheEnabled extends DashboardRow implements DashboardRowInterface
* Constructor.
*
* @param TypeListInterface $cacheTypeList -
* @param array $data -
* @param array $data -
*/
public function __construct(
TypeListInterface $cacheTypeList,
Expand Down Expand Up @@ -74,10 +74,12 @@ public function load()
foreach ($this->_cacheTypeList->getTypes() as $type) {
if (! $type->getStatus()) {
$this->problems .= sprintf(
__('Cache is disabled: %s')."\n", $type->getCacheType()
__('Cache is disabled: %s')."\n",
$type->getCacheType()
);
$this->actions .= sprintf(
__("Enable %s cache")."\n", $type->getCacheType()
__("Enable %s cache")."\n",
$type->getCacheType()
);
}
}
Expand Down
9 changes: 5 additions & 4 deletions Model/DashboardRow/CacheStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CacheStorage extends DashboardRow implements DashboardRowInterface
{
/**
* In-memory readonly pool of all cache front-end instances known to the system
*
*
* @var Pool
*/
private $_cacheFrontendPool;
Expand All @@ -44,8 +44,8 @@ class CacheStorage extends DashboardRow implements DashboardRowInterface
*
* Expects $data keys 'identifier' and 'name' to be set.
*
* @param Pool $cacheFrontendPool -
* @param array $data -
* @param Pool $cacheFrontendPool -
* @param array $data -
*/
public function __construct(
Pool $cacheFrontendPool,
Expand Down Expand Up @@ -91,7 +91,8 @@ public function load()
$this->setStatus(self::STATUS_UNKNOWN);
$this->setInfo(
sprintf(
__("Unknown cache storage: '%s'"), get_class($currentBackend)
__("Unknown cache storage: '%s'"),
get_class($currentBackend)
)
);
}
Expand Down
19 changes: 5 additions & 14 deletions Model/DashboardRow/ComposerAutoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@
*/
class ComposerAutoloader extends DashboardRow implements DashboardRowInterface
{
/**
* Constructor.
*
* @param array $data - Data for object
*/
public function __construct(
array $data = []
) {
parent::__construct($data);
}

/**
* Load Row, is called by DashboardRowFactory
*
Expand All @@ -65,7 +54,7 @@ public function load()
$classLoader = null;
foreach (spl_autoload_functions() as $function) {

if (is_array($function)
if (is_array($function)
&& $function[0] instanceof ClassLoader
) {
$classLoader = $function[0];
Expand All @@ -79,8 +68,10 @@ public function load()
return;
}

if (array_key_exists('Magento\Config\Model\Config',
$classLoader->getClassMap())) {
if (array_key_exists(
\Magento\Config\Model\Config::class,
$classLoader->getClassMap()
)) {
$this->setStatus(self::STATUS_OK);
$this->setInfo(__("Composer's autoloader is optimized"));
} else {
Expand Down
4 changes: 3 additions & 1 deletion Model/DashboardRow/HttpVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function __construct(

/**
* Load Row, is called by DashboardRowFactory
*
* @throws NoSuchEntityException
*/
public function load()
Expand Down Expand Up @@ -160,7 +161,8 @@ public function getHttpVersionUsingRequest()
// magento-coding-standard discourages use of Curl but it is the best way to check for HTTP/2.
$curl = curl_init();
curl_setopt_array(
$curl, [
$curl,
[
CURLOPT_URL => $frontUrl,
CURLOPT_NOBODY => true,
CURLOPT_HEADER => true,
Expand Down
8 changes: 4 additions & 4 deletions Model/DashboardRow/NonCacheableLayouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ class NonCacheableLayouts extends DashboardRow implements DashboardRowInterface
/**
* Constructor.
*
* @param DirectoryList $directoryList
* @param Handler $logHandler
* @param ReadFactory $readFactory
* @param array $data
* @param DirectoryList $directoryList
* @param Handler $logHandler
* @param ReadFactory $readFactory
* @param array $data
*/
public function __construct(
DirectoryList $directoryList,
Expand Down
35 changes: 18 additions & 17 deletions Model/DashboardRow/SessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SessionStorage extends DashboardRow implements DashboardRowInterface
* Constructor
*
* @param DeploymentConfig $deploymentConfig
* @param array $data
* @param array $data
*/
public function __construct(
DeploymentConfig $deploymentConfig,
Expand All @@ -67,25 +67,26 @@ public function load()
$defaultSaveHandler = ini_get('session.save_handler') ?:
SaveHandlerInterface::DEFAULT_HANDLER;
$saveHandler = $this->deploymentConfig->get(
Config::PARAM_SESSION_SAVE_METHOD, $defaultSaveHandler
Config::PARAM_SESSION_SAVE_METHOD,
$defaultSaveHandler
);

switch ($saveHandler) {
case 'redis':
case 'memcache':
case 'memcached':
$this->setStatus(self::STATUS_OK);
$this->setInfo(sprintf(__('Sessions are saved in %s'), ucfirst($saveHandler)));
break;
case 'files':
case 'db':
$this->setStatus(self::STATUS_PROBLEM);
$this->setInfo(sprintf(__('Sessions are saved in %s'), ucfirst($saveHandler)));
$this->setAction('Save sessions in Redis or Memcached');
break;
default:
$this->setInfo(sprintf(__('Unknown session save handler: %s'), $saveHandler));
$this->setStatus(self::STATUS_UNKNOWN);
case 'redis':
case 'memcache':
case 'memcached':
$this->setStatus(self::STATUS_OK);
$this->setInfo(sprintf(__('Sessions are saved in %s'), ucfirst($saveHandler)));
break;
case 'files':
case 'db':
$this->setStatus(self::STATUS_PROBLEM);
$this->setInfo(sprintf(__('Sessions are saved in %s'), ucfirst($saveHandler)));
$this->setAction('Save sessions in Redis or Memcached');
break;
default:
$this->setInfo(sprintf(__('Unknown session save handler: %s'), $saveHandler));
$this->setStatus(self::STATUS_UNKNOWN);
}
}
}
2 changes: 2 additions & 0 deletions Model/DashboardRowFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
class DashboardRowFactory
{
/**
* We need the ObjectManager because this is a factory class
*
* @var ObjectManagerInterface
*/
private $objectManager;
Expand Down
12 changes: 6 additions & 6 deletions Model/Layout/LayoutPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class LayoutPlugin
private $logger;

/**
* @var array
* @var array
*/
private $cacheableModules = ['cms','catalog'];

Expand All @@ -63,10 +63,10 @@ class LayoutPlugin
/**
* Constructor.
*
* @param Config $config
* @param RequestInterface $request
* @param DirectoryList $directoryList
* @param Logger $logger
* @param Config $config
* @param RequestInterface $request
* @param DirectoryList $directoryList
* @param Logger $logger
*/
public function __construct(
Config $config,
Expand All @@ -82,7 +82,7 @@ public function __construct(

/**
* @param Layout $subject
* @param mixed $result
* @param mixed $result
* @return mixed
*/
public function afterGenerateXml(Layout $subject, $result)
Expand Down
Loading

0 comments on commit 4f19eac

Please sign in to comment.