diff --git a/.phpstan.dist.baseline.neon b/.phpstan.dist.baseline.neon index 9651551906c..526390adfef 100644 --- a/.phpstan.dist.baseline.neon +++ b/.phpstan.dist.baseline.neon @@ -2586,12 +2586,6 @@ parameters: count: 1 path: app/code/core/Mage/Core/Model/Design/Fallback.php - - - rawMessage: 'Property Mage_Core_Model_Design_Package::$_store (int|Mage_Core_Model_Store|string) on left side of ?? is not nullable.' - identifier: nullCoalesce.property - count: 1 - path: app/code/core/Mage/Core/Model/Design/Package.php - - rawMessage: 'Parameter #1 $policyCode of method Mage_Core_Model_Domainpolicy::_getDomainPolicyByCode() expects string, int given.' identifier: argument.type diff --git a/app/code/core/Mage/Adminhtml/Block/Cache/Additional.php b/app/code/core/Mage/Adminhtml/Block/Cache/Additional.php index 8ca93fa80f2..6baf531087f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cache/Additional.php +++ b/app/code/core/Mage/Adminhtml/Block/Cache/Additional.php @@ -21,9 +21,4 @@ public function getCleanSwatchesUrl() { return $this->getUrl('*/*/cleanSwatches'); } - - public function getCleanMediaUrl() - { - return $this->getUrl('*/*/cleanMedia'); - } } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Baseurl.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Baseurl.php index e99c9e6c1dc..9c07b90bfa3 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Baseurl.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Baseurl.php @@ -47,18 +47,6 @@ protected function _beforeSave() return $this; } - /** - * Clean compiled JS/CSS when updating url configuration settings - */ - protected function _afterSave() - { - if ($this->isValueChanged()) { - Mage::getModel('core/design_package')->cleanMergedJsCss(); - } - - return $this; - } - /** * @inheritDoc */ diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Secure.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Secure.php deleted file mode 100644 index 7aded6a44d0..00000000000 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Secure.php +++ /dev/null @@ -1,26 +0,0 @@ -isValueChanged()) { - Mage::getModel('core/design_package')->cleanMergedJsCss(); - } - - return $this; - } -} diff --git a/app/code/core/Mage/Adminhtml/controllers/CacheController.php b/app/code/core/Mage/Adminhtml/controllers/CacheController.php index b48a19231e1..434eb30cd47 100644 --- a/app/code/core/Mage/Adminhtml/controllers/CacheController.php +++ b/app/code/core/Mage/Adminhtml/controllers/CacheController.php @@ -146,29 +146,6 @@ public function massRefreshAction() $this->_redirect('*/*'); } - /** - * Clean JS/css files cache - */ - public function cleanMediaAction() - { - try { - Mage::getModel('core/design_package')->cleanMergedJsCss(); - Mage::dispatchEvent('clean_media_cache_after'); - $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('The JavaScript/CSS cache has been cleaned.'), - ); - } catch (Mage_Core_Exception $e) { - $this->_getSession()->addError($e->getMessage()); - } catch (Exception $e) { - $this->_getSession()->addException( - $e, - Mage::helper('adminhtml')->__('An error occurred while clearing the JavaScript/CSS cache.'), - ); - } - - $this->_redirect('*/*'); - } - /** * Clean catalog files cache */ diff --git a/app/code/core/Mage/Adminhtml/controllers/System/CacheController.php b/app/code/core/Mage/Adminhtml/controllers/System/CacheController.php index caab4b63aea..dc17ef6e7ed 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/CacheController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/CacheController.php @@ -95,17 +95,6 @@ public function saveAction() Mage::app()->saveUseCache($enable); - // clean javascript/css cache - if ($this->getRequest()->getPost('jscss_action')) { - if (Mage::getDesign()->cleanMergedJsCss()) { - $this->_getSession()->addSuccess( - Mage::helper('adminhtml')->__('The JavaScript/CSS cache has been cleared.'), - ); - } else { - $this->_getSession()->addError(Mage::helper('adminhtml')->__('Failed to clear the JavaScript/CSS cache.')); - } - } - /** * Run catalog actions */ diff --git a/app/code/core/Mage/Core/Helper/Data.php b/app/code/core/Mage/Core/Helper/Data.php index 2f06e59e6cd..a6cf371292f 100644 --- a/app/code/core/Mage/Core/Helper/Data.php +++ b/app/code/core/Mage/Core/Helper/Data.php @@ -97,7 +97,7 @@ public function getEncryptor() * @param float $value * @param bool $format * @param bool $includeContainer - * @return mixed + * @return float|string */ public static function currency($value, $format = true, $includeContainer = true) { @@ -111,7 +111,7 @@ public static function currency($value, $format = true, $includeContainer = true * @param int|Mage_Core_Model_Store $store * @param bool $format * @param bool $includeContainer - * @return mixed + * @return float|string */ public static function currencyByStore($value, $store = null, $format = true, $includeContainer = true) { @@ -121,8 +121,8 @@ public static function currencyByStore($value, $store = null, $format = true, $i } $value = $store->convertPrice($value, $format, $includeContainer); - } catch (Exception $e) { - $value = $e->getMessage(); + } catch (Exception $exception) { + $value = $exception->getMessage(); } return $value; @@ -146,6 +146,7 @@ public function formatCurrency($value, $includeContainer = true) * @param float $price * @param bool $includeContainer * @return string + * @throws Mage_Core_Model_Store_Exception */ public function formatPrice($price, $includeContainer = true) { @@ -275,6 +276,7 @@ public function validateKey($key) * @param int $len * @param string|null $chars * @return string + * @throws Exception */ public function getRandomString($len, $chars = null) { @@ -282,7 +284,7 @@ public function getRandomString($len, $chars = null) $chars = self::CHARS_LOWERS . self::CHARS_UPPERS . self::CHARS_DIGITS; } - for ($i = 0, $str = '', $lc = strlen($chars) - 1; $i < $len; $i++) { + for ($index = 0, $str = '', $lc = strlen($chars) - 1; $index < $len; $index++) { $str .= $chars[random_int(0, $lc)]; } @@ -347,6 +349,7 @@ public function getVersionHash(Mage_Core_Model_Encryption $encryptionModel) * * @param bool|int|Mage_Core_Model_Store|null|string $store * @return int + * @throws Mage_Core_Model_Store_Exception */ public function getStoreId($store = null) { @@ -356,7 +359,7 @@ public function getStoreId($store = null) /** * @param string $string * @param bool $german - * @return false|string + * @return string * * @SuppressWarnings("PHPMD.ErrorControlOperator") */ @@ -397,21 +400,19 @@ public function removeAccents($string, $german = false) } $replacements[$german] = []; - foreach ($subst as $k => $v) { - $replacements[$german][$k < 256 ? chr($k) : '&#' . $k . ';'] = $v; + foreach ($subst as $key => $value) { + $replacements[$german][$key < 256 ? chr($key) : '&#' . $key . ';'] = $value; } } // convert string from default database format (UTF-8) // to encoding which replacement arrays made with (ISO-8859-1) - if ($s = @iconv('UTF-8', 'ISO-8859-1', $string)) { - $string = $s; + if ($encoded = @iconv('UTF-8', 'ISO-8859-1', $string)) { + $string = $encoded; } // Replace - $string = strtr($string, $replacements[$german]); - - return $string; + return strtr($string, $replacements[$german]); } /** @@ -567,19 +568,19 @@ public function decorateArray($array, $prefix = 'decorated_', $forceSetAll = fal $keyIsLast = "{$prefix}is_last"; $count = count($array); // this will force Iterator to load - $i = 0; + $index = 0; $isEven = false; foreach ($array as $key => $element) { if (is_object($element)) { - $this->_decorateArrayObject($element, $keyIsFirst, ($i === 0), $forceSetAll || ($i === 0)); + $this->_decorateArrayObject($element, $keyIsFirst, ($index === 0), $forceSetAll || ($index === 0)); $this->_decorateArrayObject($element, $keyIsOdd, !$isEven, $forceSetAll || !$isEven); $this->_decorateArrayObject($element, $keyIsEven, $isEven, $forceSetAll || $isEven); $isEven = !$isEven; - $i++; - $this->_decorateArrayObject($element, $keyIsLast, ($i === $count), $forceSetAll || ($i === $count)); + $index++; + $this->_decorateArrayObject($element, $keyIsLast, ($index === $count), $forceSetAll || ($index === $count)); } elseif (is_array($element)) { - if ($forceSetAll || ($i === 0)) { - $array[$key][$keyIsFirst] = ($i === 0); + if ($forceSetAll || ($index === 0)) { + $array[$key][$keyIsFirst] = ($index === 0); } if ($forceSetAll || !$isEven) { @@ -591,9 +592,9 @@ public function decorateArray($array, $prefix = 'decorated_', $forceSetAll = fal } $isEven = !$isEven; - $i++; - if ($forceSetAll || ($i === $count)) { - $array[$key][$keyIsLast] = ($i === $count); + $index++; + if ($forceSetAll || ($index === $count)) { + $array[$key][$keyIsLast] = ($index === $count); } } } @@ -695,9 +696,9 @@ public function xmlToAssoc(SimpleXMLElement $xml) $array = []; foreach ($xml as $key => $value) { if (isset($value->$key)) { - $i = 0; + $index = 0; foreach ($value->$key as $v) { - $array[$key][$i++] = (string) $v; + $array[$key][$index++] = (string) $v; } } else { // try to transform it into string value, trimming spaces between elements @@ -778,113 +779,6 @@ public function uniqHash($prefix = '') return $prefix . md5(uniqid(microtime() . mt_rand(), true)); } - /** - * Merge specified files into one - * - * By default will not merge, if there is already merged file exists and it - * was modified after its components - * If target file is specified, will attempt to write merged contents into it, - * otherwise will return merged content - * May apply callback to each file contents. Callback gets parameters: - * (, ) - * May filter files by specified extension(s) - * Returns false on error - * - * @param string|false $targetFile - file path to be written - * @param bool $mustMerge - * @param callable $beforeMergeCallback - * @param array|string $extensionsFilter - * @return bool|string - * @SuppressWarnings("PHPMD.ErrorControlOperator") - */ - public function mergeFiles( - array $srcFiles, - $targetFile = false, - $mustMerge = false, - $beforeMergeCallback = null, - $extensionsFilter = [] - ) { - try { - // check whether merger is required - $shouldMerge = $mustMerge || !$targetFile; - if (!$shouldMerge) { - if (!file_exists($targetFile)) { - $shouldMerge = true; - } else { - $targetMtime = filemtime($targetFile); - foreach ($srcFiles as $file) { - if (!file_exists($file)) { - // no translation intentionally - Mage::logException(new Exception(sprintf('File %s not found.', $file))); - } elseif (@filemtime($file) > $targetMtime) { - $shouldMerge = true; - break; - } - } - } - } - - // merge contents into the file - if ($shouldMerge) { - if ($targetFile && !is_writable(dirname($targetFile))) { - // no translation intentionally - throw new Exception(sprintf('Path %s is not writeable.', dirname($targetFile))); - } - - // filter by extensions - if ($extensionsFilter) { - if (!is_array($extensionsFilter)) { - $extensionsFilter = [$extensionsFilter]; - } - - foreach ($srcFiles as $key => $file) { - $fileExt = strtolower(pathinfo($file, PATHINFO_EXTENSION)); - if (!in_array($fileExt, $extensionsFilter)) { - unset($srcFiles[$key]); - } - } - } - - if (empty($srcFiles)) { - // no translation intentionally - throw new Exception('No files to compile.'); - } - - $data = ''; - foreach ($srcFiles as $file) { - if (!file_exists($file)) { - continue; - } - - $contents = file_get_contents($file) . "\n"; - // phpcs:ignore Ecg.Security.ForbiddenFunction.Found - if ($beforeMergeCallback && is_callable($beforeMergeCallback)) { - $contents = call_user_func($beforeMergeCallback, $file, $contents); - } - - $data .= $contents; - } - - if (!$data) { - // no translation intentionally - throw new Exception(sprintf("No content found in files:\n%s", implode("\n", $srcFiles))); - } - - if ($targetFile) { - file_put_contents($targetFile, $data, LOCK_EX); - } else { - return $data; // no need to write to file, just return data - } - } - - return true; // no need in merger or merged into file successfully - } catch (Exception $e) { - Mage::logException($e); - } - - return false; - } - /** * Return default country code * @@ -1036,7 +930,7 @@ public function unEscapeCSVData($data) foreach ($data as $key => $value) { $value = (string) $value; - if (preg_match("/^ [=\-+]/", $value)) { + if (preg_match('/^ [=\-+]/', $value)) { $data[$key] = ltrim($value); } } diff --git a/app/code/core/Mage/Core/Model/Design/Package.php b/app/code/core/Mage/Core/Model/Design/Package.php index 3e82c9d417c..bb22ea72568 100644 --- a/app/code/core/Mage/Core/Model/Design/Package.php +++ b/app/code/core/Mage/Core/Model/Design/Package.php @@ -34,7 +34,7 @@ class Mage_Core_Model_Design_Package /** * Current Store for generation ofr base_dir and base_url * - * @var string|int|Mage_Core_Model_Store + * @var string|int|Mage_Core_Model_Store|null */ protected $_store = null; @@ -59,20 +59,6 @@ class Mage_Core_Model_Design_Package */ protected $_theme; - /** - * Package root directory - * - * @var string - */ - protected $_rootDir; - - /** - * Directory of the css file - * Using only to transmit additional parameter in callback functions - * @var string - */ - protected $_callbackFileDir; - /** * @var Mage_Core_Model_Design_Config|null */ @@ -123,6 +109,7 @@ public function setStore($store) * Retrieve store * * @return string|int|Mage_Core_Model_Store + * @throws Mage_Core_Model_Store_Exception */ public function getStore() { @@ -161,6 +148,7 @@ public function getArea() * * @param string $name * @return $this + * @throws Mage_Core_Model_Store_Exception */ public function setPackageName($name = '') { @@ -192,6 +180,7 @@ public function setPackageName($name = '') * * @param array $storePackageArea * @return array + * @throws Mage_Core_Model_Store_Exception */ public function setAllGetOld($storePackageArea) { @@ -218,6 +207,7 @@ public function setAllGetOld($storePackageArea) * Retrieve package name * * @return string + * @throws Mage_Core_Model_Store_Exception */ public function getPackageName() { @@ -245,6 +235,7 @@ public function designPackageExists($packageName, $area = self::DEFAULT_AREA) * 2) if 2 parameters, treats 1st as key and 2nd as value * * @return $this + * @throws Mage_Core_Exception */ public function setTheme() { @@ -270,6 +261,7 @@ public function setTheme() /** * @param string $type * @return string + * @throws Mage_Core_Model_Store_Exception */ public function getTheme($type) { @@ -304,6 +296,7 @@ public function getDefaultTheme() /** * @return $this + * @throws Mage_Core_Model_Store_Exception */ public function updateParamDefaults(array &$params) { @@ -332,6 +325,7 @@ public function updateParamDefaults(array &$params) /** * @return string + * @throws Mage_Core_Model_Store_Exception */ public function getBaseDir(array $params) { @@ -342,6 +336,7 @@ public function getBaseDir(array $params) /** * @return string + * @throws Mage_Core_Model_Store_Exception */ public function getSkinBaseDir(array $params = []) { @@ -353,6 +348,7 @@ public function getSkinBaseDir(array $params = []) /** * @return string + * @throws Mage_Core_Model_Store_Exception */ public function getLocaleBaseDir(array $params = []) { @@ -365,6 +361,7 @@ public function getLocaleBaseDir(array $params = []) /** * @return string + * @throws Mage_Core_Model_Store_Exception */ public function getSkinBaseUrl(array $params = []) { @@ -385,9 +382,10 @@ public function getSkinBaseUrl(array $params = []) * - _theme: if not set = default * - _file: path relative to theme root * - * @see Mage_Core_Model_Config::getBaseDir * @param string $file * @return string|false + * @throws Mage_Core_Model_Store_Exception + * @see Mage_Core_Model_Config::getBaseDir */ public function validateFile($file, array $params) { @@ -405,6 +403,7 @@ public function validateFile($file, array $params) * * @param string $file * @return string + * @throws Mage_Core_Model_Store_Exception */ protected function _renderFilename($file, array $params) { @@ -425,6 +424,7 @@ protected function _renderFilename($file, array $params) * * @param string $file * @return string + * @throws Mage_Core_Model_Store_Exception */ protected function _fallback($file, array &$params, array $fallbackScheme = [[]]) { @@ -480,6 +480,7 @@ public function getFilename($file, array $params) /** * @param string $file * @return string + * @throws Exception */ public function getLayoutFilename($file, array $params = []) { @@ -490,6 +491,7 @@ public function getLayoutFilename($file, array $params = []) /** * @param string $file * @return string + * @throws Exception */ public function getTemplateFilename($file, array $params = []) { @@ -500,6 +502,7 @@ public function getTemplateFilename($file, array $params = []) /** * @param string $file * @return string + * @throws Exception */ public function getLocaleFileName($file, array $params = []) { @@ -625,6 +628,7 @@ private function _listDirectories($path, $fullPath = false) * * @SuppressWarnings("PHPMD.CamelCaseVariableName")) * @SuppressWarnings("PHPMD.Superglobals") + * @throws Mage_Core_Model_Store_Exception */ protected function _checkUserAgentAgainstRegexps($regexpsConfigPath) { @@ -644,8 +648,8 @@ protected function _checkUserAgentAgainstRegexps($regexpsConfigPath) try { $regexps = Mage::helper('core/unserializeArray')->unserialize($configValueSerialized); - } catch (Exception $e) { - Mage::logException($e); + } catch (Exception $exception) { + Mage::logException($exception); } if (empty($regexps)) { @@ -687,291 +691,10 @@ public static function getPackageByUserAgent(array $rules, $regexpsConfigPath = return false; } - /** - * Merge specified javascript files and return URL to the merged file on success - * - * @param array $files - * @return string - */ - public function getMergedJsUrl($files) - { - $newestTimestamp = 0; - foreach ($files as $file) { - $filemtime = filemtime($file); - if ($filemtime > $newestTimestamp) { - $newestTimestamp = $filemtime; - } - } - - $targetFilename = md5(implode(',', $files) . "|{$newestTimestamp}") . '.js'; - $targetDir = $this->_initMergerDir('js'); - if (!$targetDir) { - return ''; - } - - if ($this->_mergeFiles($files, $targetDir . DS . $targetFilename, false, null, 'js')) { - return Mage::getBaseUrl('media', Mage::app()->getRequest()->isSecure()) . 'js/' . $targetFilename; - } - - return ''; - } - - /** - * Merge specified css files and return URL to the merged file on success - * - * @param array $files - * @return string - */ - public function getMergedCssUrl($files) - { - // secure or unsecure - $isSecure = Mage::app()->getRequest()->isSecure(); - $mergerDir = $isSecure ? 'css_secure' : 'css'; - $targetDir = $this->_initMergerDir($mergerDir); - if (!$targetDir) { - return ''; - } - - // base hostname & port - $baseMediaUrl = Mage::getBaseUrl('media', $isSecure); - $hostname = parse_url($baseMediaUrl, PHP_URL_HOST); - $port = parse_url($baseMediaUrl, PHP_URL_PORT); - if ($port === false) { - $port = $isSecure ? 443 : 80; - } - - // merge into target file - $newestTimestamp = 0; - foreach ($files as $file) { - $filemtime = filemtime($file); - if ($filemtime > $newestTimestamp) { - $newestTimestamp = $filemtime; - } - } - - $targetFilename = md5(implode(',', $files) . "|{$hostname}|{$port}|{$newestTimestamp}") . '.css'; - $mergeFilesResult = $this->_mergeFiles( - $files, - $targetDir . DS . $targetFilename, - false, - [$this, 'beforeMergeCss'], - 'css', - ); - if ($mergeFilesResult) { - return $baseMediaUrl . $mergerDir . '/' . $targetFilename; - } - - return ''; - } - - /** - * Merges files into one and saves it into DB (if DB file storage is on) - * - * @see Mage_Core_Helper_Data::mergeFiles() - * @param string|bool $targetFile - file path to be written - * @param bool $mustMerge - * @param callable $beforeMergeCallback - * @param array|string $extensionsFilter - * @return bool|string - */ - protected function _mergeFiles( - array $srcFiles, - $targetFile = false, - $mustMerge = false, - $beforeMergeCallback = null, - $extensionsFilter = [] - ) { - if (Mage::helper('core/file_storage_database')->checkDbUsage()) { - if (!file_exists($targetFile)) { - Mage::helper('core/file_storage_database')->saveFileToFilesystem($targetFile); - } - - if (file_exists($targetFile)) { - $filemtime = filemtime($targetFile); - } else { - $filemtime = null; - } - - $result = Mage::helper('core')->mergeFiles( - $srcFiles, - $targetFile, - $mustMerge, - $beforeMergeCallback, - $extensionsFilter, - ); - if ($result && (filemtime($targetFile) > $filemtime)) { - Mage::helper('core/file_storage_database')->saveFile($targetFile); - } - - return $result; - } else { - return Mage::helper('core')->mergeFiles( - $srcFiles, - $targetFile, - $mustMerge, - $beforeMergeCallback, - $extensionsFilter, - ); - } - } - - /** - * Remove all merged js/css files - * - * @return bool - */ - public function cleanMergedJsCss() - { - $result = (bool) $this->_initMergerDir('js', true); - $result = $this->_initMergerDir('css', true) && $result; - return $this->_initMergerDir('css_secure', true) && $result; - } - - /** - * Make sure merger dir exists and writeable - * Also can clean it up - * - * @param string $dirRelativeName - * @param bool $cleanup - * @return bool - */ - protected function _initMergerDir($dirRelativeName, $cleanup = false) - { - try { - $dir = Mage::getBaseDir('media') . DS . $dirRelativeName; - if ($cleanup) { - Varien_Io_File::rmdirRecursive($dir); - Mage::helper('core/file_storage_database')->deleteFolder($dir); - } - - if (!is_dir($dir)) { - mkdir($dir); - } - - return is_writable($dir) ? $dir : false; - } catch (Exception $e) { - Mage::logException($e); - } - - return false; - } - - /** - * Before merge css callback function - * - * @param string $file - * @param string $contents - * @return string - */ - public function beforeMergeCss($file, $contents) - { - $this->_setCallbackFileDir($file); - - $cssImport = '/@import\\s+([\'"])(.*?)[\'"]/'; - $contents = preg_replace_callback($cssImport, [$this, '_cssMergerImportCallback'], $contents); - - $cssUrl = '/url\\(\\s*(?![\\\'\\"]?data:)([^\\)\\s]+)\\s*\\)?/'; - - return preg_replace_callback($cssUrl, [$this, '_cssMergerUrlCallback'], $contents); - } - - /** - * Set file dir for css file - * - * @param string $file - */ - protected function _setCallbackFileDir($file) - { - $file = str_replace(Mage::getBaseDir() . DS, '', $file); - $this->_callbackFileDir = dirname($file); - } - - /** - * Callback function replaces relative links for @import matches in css file - * - * @param array $match - * @return string - */ - protected function _cssMergerImportCallback($match) - { - $quote = $match[1]; - $uri = $this->_prepareUrl($match[2]); - - return "@import {$quote}{$uri}{$quote}"; - } - - /** - * Callback function replaces relative links for url() matches in css file - * - * @param array $match - * @return string - */ - protected function _cssMergerUrlCallback($match) - { - $quote = ($match[1][0] == "'" || $match[1][0] == '"') ? $match[1][0] : ''; - $uri = ($quote == '') ? $match[1] : substr($match[1], 1, -1); - $uri = $this->_prepareUrl($uri); - - return "url({$quote}{$uri}{$quote})"; - } - - /** - * Prepare url for css replacement - * - * @param string $uri - * @return string - */ - protected function _prepareUrl($uri) - { - // check absolute or relative url - if (!preg_match('/^https?:/i', $uri) && !preg_match('/^\//i', $uri)) { - $fileDir = ''; - $pathParts = explode(DS, $uri); - $fileDirParts = explode(DS, $this->_callbackFileDir); - $store = $this->getStore(); - if (is_int($store)) { - $store = Mage::app()->getStore($store); - } - - if ($store->isAdmin()) { - $secure = $store->isAdminUrlSecure(); - } else { - $secure = $store->isFrontUrlSecure() && Mage::app()->getRequest()->isSecure(); - } - - if ($fileDirParts[0] == 'skin') { - $baseUrl = Mage::getBaseUrl('skin', $secure); - $fileDirParts = array_slice($fileDirParts, 1); - } elseif ($fileDirParts[0] == 'media') { - $baseUrl = Mage::getBaseUrl('media', $secure); - $fileDirParts = array_slice($fileDirParts, 1); - } else { - $baseUrl = Mage::getBaseUrl('web', $secure); - } - - foreach ($pathParts as $key => $part) { - if ($part == '.' || $part == '..') { - unset($pathParts[$key]); - } - - if ($part == '..' && count($fileDirParts)) { - $fileDirParts = array_slice($fileDirParts, 0, count($fileDirParts) - 1); - } - } - - if ($fileDirParts !== []) { - $fileDir = implode('/', $fileDirParts) . '/'; - } - - $uri = $baseUrl . $fileDir . implode('/', $pathParts); - } - - return $uri; - } - /** * Default theme getter * @return string + * @throws Mage_Core_Model_Store_Exception * @deprecated since 1.8.2.0 */ public function getFallbackTheme() diff --git a/app/code/core/Mage/Core/etc/config.xml b/app/code/core/Mage/Core/etc/config.xml index 54ff426df00..727feda7f32 100644 --- a/app/code/core/Mage/Core/etc/config.xml +++ b/app/code/core/Mage/Core/etc/config.xml @@ -300,9 +300,6 @@ system.log exception.log - - 0 - 0 diff --git a/app/code/core/Mage/Core/etc/system.xml b/app/code/core/Mage/Core/etc/system.xml index 7cc047b1c12..b3585f82747 100644 --- a/app/code/core/Mage/Core/etc/system.xml +++ b/app/code/core/Mage/Core/etc/system.xml @@ -682,42 +682,6 @@ - - - 100 - 1 - 1 - 1 - - - - select - adminhtml/system_config_source_yesno - 10 - 1 - 1 - 1 - - - - - - 110 - 1 - 1 - 1 - - - - select - adminhtml/system_config_source_yesno - 10 - 1 - 1 - 1 - - - 120 diff --git a/app/code/core/Mage/Page/Block/Html/Head.php b/app/code/core/Mage/Page/Block/Html/Head.php index cc4a7cc742a..684b545596a 100644 --- a/app/code/core/Mage/Page/Block/Html/Head.php +++ b/app/code/core/Mage/Page/Block/Html/Head.php @@ -201,8 +201,6 @@ public function getCssJsHtml() } // prepare HTML - $shouldMergeJs = Mage::getStoreConfigFlag('dev/js/merge_files'); - $shouldMergeCss = Mage::getStoreConfigFlag('dev/css/merge_css_files'); $html = ''; foreach ($lines as $if => $items) { if (empty($items)) { @@ -219,7 +217,6 @@ public function getCssJsHtml() '' . PHP_EOL, empty($items['js_css']) ? [] : $items['js_css'], empty($items['skin_css']) ? [] : $items['skin_css'], - $shouldMergeCss ? [Mage::getDesign(), 'getMergedCssUrl'] : null, ); // static and skin javascripts @@ -227,7 +224,6 @@ public function getCssJsHtml() '' . PHP_EOL, empty($items['js']) ? [] : $items['js'], empty($items['skin_js']) ? [] : $items['skin_js'], - $shouldMergeJs ? [Mage::getDesign(), 'getMergedJsUrl'] : null, ); // other stuff @@ -249,50 +245,37 @@ public function getCssJsHtml() * @param string $format - HTML element format for sprintf('', $src, $params) * @param array $staticItems - array of relative names of static items to be grabbed from js/ folder * @param array $skinItems - array of relative names of skin items to be found in skins according to design config - * @param callable $mergeCallback + * @param callable $mergeCallback - deprecated callback to perform merging of files * @return string + * @throws Exception */ protected function &_prepareStaticAndSkinElements($format, array $staticItems, array $skinItems, $mergeCallback = null) { $designPackage = Mage::getDesign(); $baseJsUrl = Mage::getBaseUrl('js'); $items = []; - if ($mergeCallback && !is_callable($mergeCallback)) { - $mergeCallback = null; - } // get static files from the js folder, no need in lookups foreach ($staticItems as $params => $rows) { foreach ($rows as $name) { - $items[$params][] = $mergeCallback ? Mage::getBaseDir() . DS . 'js' . DS . $name : $baseJsUrl . $name; + $items[$params][] = $baseJsUrl . $name; } } // lookup each file basing on current theme configuration foreach ($skinItems as $params => $rows) { foreach ($rows as $name) { - $items[$params][] = $mergeCallback ? $designPackage->getFilename($name, ['_type' => 'skin']) - : $designPackage->getSkinUrl($name, []); + $items[$params][] = $designPackage->getSkinUrl($name, []); } } $html = ''; foreach ($items as $params => $rows) { - // attempt to merge - $mergedUrl = false; - if ($mergeCallback) { - $mergedUrl = call_user_func($mergeCallback, $rows); - } - // render elements $params = trim($params); $params = $params ? ' ' . $params : ''; - if ($mergedUrl) { - $html .= sprintf($format, $mergedUrl, $params); - } else { - foreach ($rows as $src) { - $html .= sprintf($format, $src, $params); - } + foreach ($rows as $src) { + $html .= sprintf($format, $src, $params); } } diff --git a/app/design/adminhtml/default/default/template/system/cache/additional.phtml b/app/design/adminhtml/default/default/template/system/cache/additional.phtml index 69695c1eb65..cd4a6eb250d 100644 --- a/app/design/adminhtml/default/default/template/system/cache/additional.phtml +++ b/app/design/adminhtml/default/default/template/system/cache/additional.phtml @@ -34,13 +34,5 @@ __('Pregenerated configurable swatches image files.')?> - - - - - - __('Themes JavaScript and CSS files combined to one file.')?> - - getChildHtml(); ?> diff --git a/app/locale/en_US/Mage_Adminhtml.csv b/app/locale/en_US/Mage_Adminhtml.csv index 0262cbb17b8..a213efff968 100644 --- a/app/locale/en_US/Mage_Adminhtml.csv +++ b/app/locale/en_US/Mage_Adminhtml.csv @@ -106,7 +106,6 @@ "Amounts","Amounts" "An error has occured while syncronizing media storages.","An error has occurred while syncronizing media storages." "An error occurred while adding condition.","An error occurred while adding condition." -"An error occurred while clearing the JavaScript/CSS cache.","An error occurred while clearing the JavaScript/CSS cache." "An error occurred while clearing the configurable swatches image cache.","An error occurred while clearing the configurable swatches image cache." "An error occurred while clearing the image cache.","An error occurred while clearing the image cache." "An error occurred while deleting URL Rewrite.","An error occurred while deleting URL Rewrite." @@ -423,7 +422,6 @@ "First Name:","First Name:" "Fixed","Fixed" "Flush Catalog Images Cache","Flush Catalog Images Cache" -"Flush JavaScript/CSS Cache","Flush JavaScript/CSS Cache" "Flush Swatch Images Cache","Flush Swatch Images Cache" "For category","For category" "For latest version visit: %s","For latest version visit: %s" @@ -1035,8 +1033,6 @@ "The Comment Text field cannot be empty.","The Comment Text field cannot be empty." "The Flat Catalog Product was rebuilt","The Flat Catalog Product was rebuilt" "The following role resource(s) are not orphaned: %s","The following role resource(s) are not orphaned: %s" -"The JavaScript/CSS cache has been cleaned.","The JavaScript/CSS cache has been cleaned." -"The JavaScript/CSS cache has been cleared.","The JavaScript/CSS cache has been cleared." "The Layered Navigation indexing has been queued.","The Layered Navigation indexing has been queued." "The Layered Navigation indexing queue has been canceled.","The Layered Navigation indexing queue has been canceled." "The Layered Navigation indices were refreshed.","The Layered Navigation indices were refreshed." @@ -1112,7 +1108,6 @@ "The user has been deleted.","The user has been deleted." "The user has been saved.","The user has been saved." "The variable has been saved.","The variable has been saved." -"Themes JavaScript and CSS files combined to one file.","Themes JavaScript and CSS files combined to one file." "There is an error in one of the option rows.","There is an error in one of the option rows." "This Account is","This Account is" "This Email template no longer exists.","This Email template no longer exists." diff --git a/app/locale/en_US/Mage_Core.csv b/app/locale/en_US/Mage_Core.csv index 9385e8702d1..d16b6ea9d79 100644 --- a/app/locale/en_US/Mage_Core.csv +++ b/app/locale/en_US/Mage_Core.csv @@ -51,7 +51,6 @@ "Block with name ""%s"" already exists","Block with name ""%s"" already exists" "Browser Capabilities Detection","Browser Capabilities Detection" "CSRF protection","CSRF protection" -"CSS Settings","CSS Settings" "Cache Storage Management","Cache Storage Management" "Cache storage may contain additional data. Are you sure that you want flush it?","Cache storage may contain additional data. Are you sure that you want flush it?" "Can not create invoice. Order was not found.","Can not create invoice. Order was not found." @@ -187,7 +186,6 @@ "Invalid template path used in layout update.","Invalid template path used in layout update." "Invalid transactional email code: %s","Invalid transactional email code: %s" "Invalid website's configuration path: %s","Invalid website's configuration path: %s" -"JavaScript Settings","JavaScript Settings" "Layout","Layout" "Leave empty for access from any location.","Leave empty for access from any location." "List of stores","List of stores" @@ -210,8 +208,6 @@ "Match expressions in the same order as displayed in the configuration.","Match expressions in the same order as displayed in the configuration." "Maximum Log Level","Maximum Log Level" "Media Storage","Media Storage" -"Merge CSS Files","Merge CSS Files" -"Merge JavaScript Files","Merge JavaScript Files" "Message recipients data must be set.","Message recipients data must be set." "Messages with a priority lower than the selected one will not be logged. Log Levels are ordered from highest to lowest priority.","Messages with a priority lower than the selected one will not be logged. Log Levels are ordered from highest to lowest priority." "Miscellaneous HTML","Miscellaneous HTML"