Skip to content

Commit ea0f83f

Browse files
committed
Import Magento Release 1.8.0.0
1 parent 78b9e7c commit ea0f83f

File tree

107 files changed

+3186
-3700
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+3186
-3700
lines changed

RELEASE_NOTES.txt

Lines changed: 2 additions & 202 deletions
Large diffs are not rendered by default.

app/Mage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ public static function getVersionInfo()
171171
'minor' => '8',
172172
'revision' => '0',
173173
'patch' => '0',
174-
'stability' => 'alpha',
175-
'number' => '1',
174+
'stability' => '',
175+
'number' => '',
176176
);
177177
}
178178

app/code/community/Cm/RedisSession/Model/Session.php

Lines changed: 731 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<config>
2+
<modules>
3+
<Cm_RedisSession>
4+
<version>0.2</version>
5+
</Cm_RedisSession>
6+
</modules>
7+
<global>
8+
<models>
9+
<core_mysql4>
10+
<rewrite>
11+
<session>Cm_RedisSession_Model_Session</session>
12+
</rewrite>
13+
</core_mysql4>
14+
</models>
15+
</global>
16+
</config>

app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,15 @@ protected function _prepareForm() {
111111
}
112112

113113
$this->_setFieldset($attributes, $fieldset);
114-
115114
foreach ($attributes as $attribute) {
115+
$rootId = Mage_Catalog_Model_Category::TREE_ROOT_ID;
116116
/* @var $attribute Mage_Eav_Model_Entity_Attribute */
117117
if ($attribute->getAttributeCode() == 'url_key') {
118-
if ($this->getCategory()->getLevel() == 1) {
118+
if (
119+
(!$this->getCategory()->getId() && $this->getRequest()->getParam('parent', $rootId) == $rootId)
120+
|| ($this->getCategory()->getParentId() == $rootId)
121+
) {
119122
$fieldset->removeField('url_key');
120-
$fieldset->addField('url_key', 'hidden', array(
121-
'name' => 'url_key',
122-
'value' => $this->getCategory()->getUrlKey()
123-
));
124123
} else {
125124
$form->getElement('url_key')->setRenderer(
126125
$this->getLayout()->createBlock('adminhtml/catalog_form_renderer_attribute_urlkey')

app/code/core/Mage/Mview/Helper/Data.php renamed to app/code/core/Mage/Adminhtml/Model/System/Config/Source/Locale/Weekdaycodes.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,20 @@
1919
* needs please refer to http://www.magentocommerce.com for more information.
2020
*
2121
* @category Mage
22-
* @package Mage_Mview
22+
* @package Mage_Adminhtml
2323
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
2424
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
2525
*/
2626

2727
/**
28-
* Mage_Mview_Helper_Data
28+
* Locale weekdays source
2929
*
30-
* @category Mage
31-
* @package Mage_Mview
3230
* @author Magento Core Team <[email protected]>
3331
*/
34-
class Mage_Mview_Helper_Data extends Mage_Core_Helper_Data
32+
class Mage_Adminhtml_Model_System_Config_Source_Locale_Weekdaycodes
3533
{
36-
34+
public function toOptionArray()
35+
{
36+
return Mage::app()->getLocale()->getOptionWeekdays(true, true);
37+
}
3738
}

app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ public function moveAction()
383383
* Category id after which we have put our category
384384
*/
385385
$prevNodeId = $this->getRequest()->getPost('aid', false);
386-
386+
$category->setData('save_rewrites_history', Mage::helper('catalog')->shouldSaveUrlRewritesHistory());
387387
try {
388388
$category->move($parentNodeId, $prevNodeId);
389389
$this->getResponse()->setBody("SUCCESS");

app/code/core/Mage/Api/etc/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<config>
2929
<modules>
3030
<Mage_Api>
31-
<version>1.6.0.0</version>
31+
<version>1.6.0.1</version>
3232
</Mage_Api>
3333
</modules>
3434
<global>

app/code/core/Mage/Mview/Model/Command/Chagelog/Trigger/Drop.php renamed to app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-1.6.0.0-1.6.0.1.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,23 @@
1919
* needs please refer to http://www.magentocommerce.com for more information.
2020
*
2121
* @category Mage
22-
* @package Mage_Mview
22+
* @package Mage_Api
2323
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
2424
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
2525
*/
2626

27-
/**
28-
* Mage_Mview_Model_Command_Trigger_Drop
29-
*
30-
* @category Mage
31-
* @package Mage_Mview
32-
* @author Magento Core Team <[email protected]>
33-
*/
27+
/* @var $this Mage_Core_Model_Resource_Setup */
28+
$this->startSetup();
29+
30+
$this->getConnection()->changeColumn(
31+
$this->getTable('api/user'),
32+
'api_key',
33+
'api_key',
34+
array(
35+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
36+
'length' => 100,
37+
'comment' => 'Api key'
38+
)
39+
);
3440

41+
$this->endSetup();
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?php
2+
/**
3+
* Magento
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
* If you did not receive a copy of the license and are unable to
12+
* obtain it through the world-wide-web, please send an email
13+
* to [email protected] so we can send you a copy immediately.
14+
*
15+
* DISCLAIMER
16+
*
17+
* Do not edit or add to this file if you wish to upgrade Magento to newer
18+
* versions in the future. If you wish to customize Magento for your
19+
* needs please refer to http://www.magentocommerce.com for more information.
20+
*
21+
* @category Mage
22+
* @package Mage_Catalog
23+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25+
*/
26+
27+
/**
28+
* Product url key attribute backend
29+
*
30+
* @category Mage
31+
* @package Mage_Catalog
32+
* @author Magento Core Team <[email protected]>
33+
*/
34+
abstract class Mage_Catalog_Model_Attribute_Backend_Urlkey_Abstract
35+
extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract
36+
{
37+
/**
38+
* Format url key attribute before save, also use product name as url key if it empty
39+
*
40+
* @param Varien_Object $object
41+
* @return Mage_Catalog_Model_Category_Attribute_Backend_Urlkey
42+
*/
43+
public function beforeSave($object)
44+
{
45+
$attributeName = $this->getAttribute()->getName();
46+
47+
$urlKey = $object->getData($attributeName);
48+
if ($urlKey === false) {
49+
return $this;
50+
}
51+
if ($urlKey=='') {
52+
$urlKey = $object->getName();
53+
}
54+
55+
$object->setData($attributeName, $object->formatUrlKey($urlKey));
56+
57+
return $this;
58+
}
59+
60+
/**
61+
* Executes after url attribute save.
62+
*
63+
* @param Varien_Object $object
64+
*
65+
* @return Mage_Catalog_Model_Category_Attribute_Backend_Urlkey
66+
*/
67+
public function afterSave($object)
68+
{
69+
/**
70+
* This logic moved to Mage_Catalog_Model_Indexer_Url
71+
*/
72+
return $this;
73+
}
74+
}

app/code/core/Mage/Catalog/Model/Category.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ protected function _construct()
126126
{
127127
// If Flat Data enabled then use it but only on frontend
128128
$flatHelper = Mage::helper('catalog/category_flat');
129-
if ($flatHelper->isAvailable() && !Mage::app()->getStore()->isAdmin() && $flatHelper->isBuilt(true)) {
129+
if ($flatHelper->isAvailable() && !Mage::app()->getStore()->isAdmin() && $flatHelper->isBuilt(true)
130+
&& !$this->getDisableFlat()
131+
) {
130132
$this->_init('catalog/category_flat');
131133
$this->_useFlatResource = true;
132134
} else {
@@ -469,7 +471,7 @@ public function getCategoryIdUrl()
469471
*/
470472
public function formatUrlKey($str)
471473
{
472-
$str = Mage::helper('core')->removeAccents($str);
474+
$str = Mage::helper('catalog/product_url')->format($str);
473475
$urlKey = preg_replace('#[^0-9a-z]+#i', '-', $str);
474476
$urlKey = strtolower($urlKey);
475477
$urlKey = trim($urlKey, '-');
@@ -726,6 +728,9 @@ public function hasChildren()
726728
*/
727729
public function getRequestPath()
728730
{
731+
if (!$this->_getData('request_path')) {
732+
$this->getUrl();
733+
}
729734
return $this->_getData('request_path');
730735
}
731736

@@ -834,6 +839,16 @@ public function getChildrenCategories()
834839
return $this->getResource()->getChildrenCategories($this);
835840
}
836841

842+
/**
843+
* Return children categories of current category
844+
*
845+
* @return array
846+
*/
847+
public function getChildrenCategoriesWithInactive()
848+
{
849+
return $this->getResource()->getChildrenCategoriesWithInactive($this);
850+
}
851+
837852
/**
838853
* Return parent category of current category with own custom design settings
839854
*

app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Urlkey.php

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -30,59 +30,9 @@
3030
*
3131
* @category Mage
3232
* @package Mage_Catalog
33-
* @author Magento Core Team <[email protected]>
33+
* @author Magento Core Team <[email protected]>
3434
*/
35-
class Mage_Catalog_Model_Category_Attribute_Backend_Urlkey extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract
35+
class Mage_Catalog_Model_Category_Attribute_Backend_Urlkey extends Mage_Catalog_Model_Attribute_Backend_Urlkey_Abstract
3636
{
37-
/**
38-
* Format url_key value
39-
*
40-
* @param Mage_Catalog_Model_Category $object
41-
* @return Mage_Catalog_Model_Category_Attribute_Backend_Urlkey
42-
*/
43-
public function beforeSave($object)
44-
{
45-
$attributeName = $this->getAttribute()->getName();
4637

47-
$urlKey = $object->getData($attributeName);
48-
if ($urlKey === false) {
49-
return $this;
50-
}
51-
if ($urlKey=='') {
52-
$urlKey = $object->getName();
53-
}
54-
if (empty($urlKey)) {
55-
$urlKey = Mage::helper('core')->uniqHash();
56-
}
57-
$object->setData($attributeName, $object->formatUrlKey($urlKey));
58-
59-
$this->_validateEntityUrl($object);
60-
return $this;
61-
}
62-
63-
/**
64-
* Check unique url_key value in catalog_category_entity_url_key table.
65-
*
66-
* @param Mage_Catalog_Model_Category $object
67-
* @return Mage_Catalog_Model_Category_Attribute_Backend_Urlkey
68-
* @throws Mage_Core_Exception
69-
*/
70-
protected function _validateEntityUrl($object)
71-
{
72-
$connection = $object->getResource()->getReadConnection();
73-
74-
$select = $connection->select()
75-
->from($this->getAttribute()->getBackendTable(), array('count' => new Zend_Db_Expr('COUNT(\'value_id\')')))
76-
->where($connection->quoteInto('entity_id <> ?', $object->getId()))
77-
->where($connection->quoteInto('value = ?', $object->getUrlKey()));
78-
$result = $connection->fetchOne($select);
79-
if ((int)$result) {
80-
throw new Mage_Core_Exception(
81-
Mage::helper('catalog')->__("Category with the '%s' url_key attribute already exists.",
82-
$object->getUrlKey())
83-
);
84-
}
85-
86-
return $this;
87-
}
8838
}

app/code/core/Mage/Catalog/Model/Category/Url.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ public function getCategoryUrl(Mage_Catalog_Model_Category $category)
7979

8080
Varien_Profiler::start('REWRITE: '.__METHOD__);
8181

82-
if ($category->hasData('request_path') && $category->getRequestPath() != '') {
83-
$category->setData('url', $this->getUrlInstance()->getDirectUrl($category->getRequestPath()));
82+
if ($category->hasData('request_path') && $category->getData('request_path') != '') {
83+
$category->setData('url', $this->_getDirectUrl($category));
8484
Varien_Profiler::stop('REWRITE: '.__METHOD__);
8585
return $category->getData('url');
8686
}
8787

8888
$requestPath = $this->_getRequestPath($category);
8989
if ($requestPath) {
9090
$category->setRequestPath($requestPath);
91-
$category->setData('url', $this->getUrlInstance()->getDirectUrl($requestPath));
91+
$category->setData('url', $this->_getDirectUrl($category));
9292
Varien_Profiler::stop('REWRITE: '.__METHOD__);
9393
return $category->getData('url');
9494
}
@@ -99,6 +99,16 @@ public function getCategoryUrl(Mage_Catalog_Model_Category $category)
9999
return $category->getData('url');
100100
}
101101

102+
/**
103+
* Returns category URL by which it can be accessed
104+
* @param Mage_Catalog_Model_Category $category
105+
* @return string
106+
*/
107+
protected function _getDirectUrl(Mage_Catalog_Model_Category $category)
108+
{
109+
return $this->getUrlInstance()->getDirectUrl($category->getRequestPath());
110+
}
111+
102112
/**
103113
* Retrieve request path
104114
*

app/code/core/Mage/Catalog/Model/Product.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,8 +1077,7 @@ public function duplicate()
10771077
->setCreatedAt(null)
10781078
->setUpdatedAt(null)
10791079
->setId(null)
1080-
->setStoreId(Mage::app()->getStore()->getId())
1081-
->setUrlKey(Mage::helper('core')->uniqHash());
1080+
->setStoreId(Mage::app()->getStore()->getId());
10821081

10831082
Mage::dispatchEvent(
10841083
'catalog_model_product_duplicate',
@@ -1536,6 +1535,9 @@ public function delete()
15361535
*/
15371536
public function getRequestPath()
15381537
{
1538+
if (!$this->_getData('request_path')) {
1539+
$this->getProductUrl();
1540+
}
15391541
return $this->_getData('request_path');
15401542
}
15411543

0 commit comments

Comments
 (0)