Skip to content

Commit

Permalink
Update as of 9/05/2012
Browse files Browse the repository at this point in the history
* Implemented encryption of the credit card name and expiration date for the payment method "Credit Card (saved)"
* Implemented console utility `dev/tools/migration/get_aliases_map.php`, which generates map file "M1 class alias" to "M2 class name"
* Implemented automatic data upgrades for replacing "M1 class aliases" to "M2 class names" in a database
* Implemented recursive `chmod` in the library class `Varien_Io_File`
* Improved verbosity of the library class `Magento_Shell`
* Migrated client-side translation mechanism to jQuery
* Performance tests:
  * Improved assertion for number of created orders for the checkout performance testing scenario
    * Reverted the feature of specifying PHP scenarios to be executed before and after a JMeter scenario
    * Implemented validation for the number of created orders as a part of the JMeter scenario
    * Implemented the "Admin Login" user activity as a separate file to be reused in the performance testing scenarios
  * Implemented fixture of 100k customers for the performance tests
  * Implemented fixture of 100k products for the performance tests
    * Enhanced module `Mage_ImportExport` in order to utilize it for the fixture implementation
  * Implemented back-end performance testing scenario, which covers Dashboard, Manage Products, Manage Customers pages
* Fixes:
  * Fixed Magento console installer to enable write permission recursively to the `var` directory
  * Fixed performance tests to enable write permission recursively to the `var` directory
  * Fixed integration test `Mage_Adminhtml_Model_System_Config_Source_Admin_PageTest::testToOptionArray` to not produce "Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity" in the developer mode
* GitHub requests:
  * [#43](#43) -- implemented logging of executed setup files
  * [#44](#44)
    * Implemented support of writing logs into wrappers (for example, `php://output`)
    * Enforced a log writer model to be an instance of `Zend_Log_Writer_Stream`
  * [#49](#49)
    * Fixed sorting of totals according to "before" and "after" properties
    * Introduced `Magento_Data_Graph` library class and utilized it for finding cycles in "before" and "after" declarations
    * Implemented tests for totals sorting including the ambiguous cases
  • Loading branch information
magento-team committed Sep 6, 2012
1 parent fa5121e commit c0cf1af
Show file tree
Hide file tree
Showing 109 changed files with 4,723 additions and 700 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
Update as of 9/05/2012
======================
* Implemented encryption of the credit card name and expiration date for the payment method "Credit Card (saved)"
* Implemented console utility `dev/tools/migration/get_aliases_map.php`, which generates map file "M1 class alias" to "M2 class name"
* Implemented automatic data upgrades for replacing "M1 class aliases" to "M2 class names" in a database
* Implemented recursive `chmod` in the library class `Varien_Io_File`
* Improved verbosity of the library class `Magento_Shell`
* Migrated client-side translation mechanism to jQuery
* Performance tests:
* Improved assertion for number of created orders for the checkout performance testing scenario
* Reverted the feature of specifying PHP scenarios to be executed before and after a JMeter scenario
* Implemented validation for the number of created orders as a part of the JMeter scenario
* Implemented the "Admin Login" user activity as a separate file to be reused in the performance testing scenarios
* Implemented fixture of 100k customers for the performance tests
* Implemented fixture of 100k products for the performance tests
* Enhanced module `Mage_ImportExport` in order to utilize it for the fixture implementation
* Implemented back-end performance testing scenario, which covers Dashboard, Manage Products, Manage Customers pages
* Fixes:
* Fixed Magento console installer to enable write permission recursively to the `var` directory
* Fixed performance tests to enable write permission recursively to the `var` directory
* Fixed integration test `Mage_Adminhtml_Model_System_Config_Source_Admin_PageTest::testToOptionArray` to not produce "Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity" in the developer mode
* GitHub requests:
* [#43](https://github.com/magento/magento2/pull/43) -- implemented logging of executed setup files
* [#44](https://github.com/magento/magento2/pull/44)
* Implemented support of writing logs into wrappers (for example, `php://output`)
* Enforced a log writer model to be an instance of `Zend_Log_Writer_Stream`
* [#49](https://github.com/magento/magento2/pull/49)
* Fixed sorting of totals according to "before" and "after" properties
* Introduced `Magento_Data_Graph` library class and utilized it for finding cycles in "before" and "after" declarations
* Implemented tests for totals sorting including the ambiguous cases

Update as of 8/30/2012
======================
* Fixes:
Expand Down
67 changes: 45 additions & 22 deletions app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ final class Mage
*/
static private $_isInstalled;

/**
* Logger entities
*
* @var array
*/
static private $_loggers = array();

/**
* Magento edition constants
*/
Expand Down Expand Up @@ -172,6 +179,7 @@ public static function reset()
self::$_isDownloader = false;
self::$_isDeveloperMode = false;
self::$_isInstalled = null;
self::$_loggers = array();
// do not reset $headersSentThrowsException
}

Expand Down Expand Up @@ -761,49 +769,64 @@ public static function log($message, $level = null, $file = '', $forceLog = fals
return;
}

static $loggers = array();

$level = is_null($level) ? Zend_Log::DEBUG : $level;
$file = empty($file) ? 'system.log' : $file;

try {
if (!isset($loggers[$file])) {
$logDir = self::getBaseDir('var') . DS . 'log';
$logFile = $logDir . DS . $file;

if (!is_dir($logDir)) {
mkdir($logDir);
chmod($logDir, 0777);
}

if (!file_exists($logFile)) {
file_put_contents($logFile, '');
chmod($logFile, 0777);
}
if (!isset(self::$_loggers[$file])) {
$logFile = self::_expandLogFileName($file);

$format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;
$formatter = new Zend_Log_Formatter_Simple($format);
$writerModel = (string)self::getConfig()->getNode('global/log/core/writer_model');
if (!self::$_app || !$writerModel) {
$writer = new Zend_Log_Writer_Stream($logFile);
}
else {
$writer = new $writerModel($logFile);
if (!self::$_app || !$writerModel || !is_subclass_of($writerModel, 'Zend_Log_Writer_Stream')) {
$writerModel = 'Zend_Log_Writer_Stream';
}
/** @var $writer Zend_Log_Writer_Stream */
$writer = new $writerModel($logFile);
$writer->setFormatter($formatter);
$loggers[$file] = new Zend_Log($writer);
self::$_loggers[$file] = new Zend_Log($writer);
}

if (is_array($message) || is_object($message)) {
$message = print_r($message, true);
}

$loggers[$file]->log($message, $level);
self::$_loggers[$file]->log($message, $level);
}
catch (Exception $e) {
}
}

/**
* Expand log file name to absolute path, if necessary
*
* @param string $file
* @return string
*/
protected static function _expandLogFileName($file)
{
/*
* Check whether a file is a wrapper
* @link http://www.php.net/manual/en/wrappers.php
*/
if (preg_match('#^[a-z][a-z0-9+.-]*\://#i', $file)) {
return $file;
}
$dir = self::getBaseDir('var') . DIRECTORY_SEPARATOR . 'log';
$file = $dir . DIRECTORY_SEPARATOR . $file;
if (!is_dir($dir)) {
mkdir($dir);
chmod($dir, 0777);
}
if (!file_exists($file)) {
file_put_contents($file, '');
chmod($file, 0777);
}
return $file;
}


/**
* Write exception to log
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,7 @@ Moneybookers.prototype = {
},

translate: function(text) {
try {
if(Translator){
return Translator.translate(text);
}
}
catch(e){}
return text;
return jQuery.mage.__ ? jQuery.mage.__(text) : text;
},

button: function () {
Expand Down
6 changes: 1 addition & 5 deletions app/code/core/Mage/Adminhtml/Helper/Media/Js.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ public function __construct()
*/
public function getTranslatorScript()
{
$script = 'if (typeof(Translator) == \'undefined\') {'
. ' var Translator = new Translate('.$this->getTranslateJson().');'
. '} else {'
. ' Translator.add('.$this->getTranslateJson().');'
. '}';
$script = '(function($) {$.mage.translate.add(' . $this->getTranslateJson() . ')})(jQuery);';
return $this->getScript($script);
}

Expand Down
4 changes: 4 additions & 0 deletions app/code/core/Mage/Adminhtml/view/adminhtml/dataflow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
<remove name="root"/>
<block type="Mage_Adminhtml_Block_Page" name="convert_root" output="1" template="admin/page.phtml">
<block type="Mage_Adminhtml_Block_Page_Head" name="convert_root_head" as="head" template="page/head.phtml">
<action method="addJs"><file>jquery/jquery-1.7.1.min.js</file></action>
<action method="addJs"><file>mage/jquery-no-conflict.js</file></action>
<action method="addJs"><file>prototype/prototype.js</file></action>
<action method="addJs"><file>prototype/validation.js</file></action>
<action method="addJs"><file>varien/js.js</file></action>
Expand All @@ -46,6 +48,8 @@
<remove name="root"/>
<block type="Mage_Adminhtml_Block_Page" name="convert_root" output="1" template="admin/page.phtml">
<block type="Mage_Adminhtml_Block_Page_Head" name="convert_root_head" as="head" template="page/head.phtml">
<action method="addJs"><file>jquery/jquery-1.7.1.min.js</file></action>
<action method="addJs"><file>mage/jquery-no-conflict.js</file></action>
<action method="addJs"><file>prototype/prototype.js</file></action>
<action method="addJs"><file>prototype/validation.js</file></action>
<action method="addJs"><file>varien/js.js</file></action>
Expand Down
2 changes: 2 additions & 0 deletions app/code/core/Mage/Adminhtml/view/adminhtml/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Supported layout update handles (special):
<block type="Mage_Adminhtml_Block_Page" name="root" output="1" template="admin/page.phtml">
<block type="Mage_Adminhtml_Block_Page_Head" name="head" as="head" template="page/head.phtml">
<action method="setTitle" translate="title"><title>Magento Admin</title></action>
<action method="addJs"><file>jquery/jquery-1.7.1.min.js</file></action>
<action method="addJs"><file>mage/jquery-no-conflict.js</file></action>
<action method="addJs"><file>prototype/prototype.js</file></action>
<action method="addJs"><file>mage/adminhtml/fix-extjs-defer.js</file><params/><if/><condition>can_load_ext_js</condition></action>
<action method="addJs"><file>mage/adminhtml/fix-extjs-defer-before.js</file><params/><if/><condition>can_load_ext_js</condition></action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,7 @@ $_data = array(
);
?>
<script type="text/javascript">
var Translator = new Translate(<?php echo Zend_Json::encode($_data) ?>);
(function($) {
$.mage.translate.add(<?php echo Zend_Json::encode($_data) ?>)
})(jQuery);
</script>
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/view/adminhtml/promo/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ VarienRulesForm.prototype = {
var new_type = elem.value;
var new_elem = document.createElement('LI');
new_elem.className = 'rule-param-wait';
new_elem.innerHTML = Translator.translate('Please wait, loading...');
new_elem.innerHTML = jQuery.mage.__('Please wait, loading...');
children_ul.insertBefore(new_elem, $(elem).up('li'));

new Ajax.Request(this.newChildUrl, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ AdminOrder.prototype = {
}
});

var searchButton = new ControlButton(Translator.translate('Add Products')),
var searchButton = new ControlButton(jQuery.mage.__('Add Products')),
searchAreaId = this.getAreaId('search');
searchButton.onClick = function() {
$(searchAreaId).show();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
* @package Mage_Catalog
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

/** @var $this Mage_Catalog_Model_Resource_Setup */

/** @var $installer Mage_Core_Model_Resource_Setup_Migration */
$installer = Mage::getResourceModel('Mage_Core_Model_Resource_Setup_Migration', 'core_setup');
$installer->startSetup();

$attributeData = $this->getAttribute('catalog_category', 'custom_layout_update');
$installer->appendClassAliasReplace('catalog_category_entity_text', 'value',
Mage_Core_Model_Resource_Setup_Migration::ENTITY_TYPE_BLOCK,
Mage_Core_Model_Resource_Setup_Migration::FIELD_CONTENT_TYPE_XML,
array('value_id'),
'attribute_id = ' . (int) $attributeData['attribute_id']
);

$attributeData = $this->getAttribute('catalog_product', 'custom_layout_update');
$installer->appendClassAliasReplace('catalog_product_entity_text', 'value',
Mage_Core_Model_Resource_Setup_Migration::ENTITY_TYPE_BLOCK,
Mage_Core_Model_Resource_Setup_Migration::FIELD_CONTENT_TYPE_XML,
array('value_id'),
'attribute_id = ' . (int) $attributeData['attribute_id']
);

$installer->appendClassAliasReplace('catalog_eav_attribute', 'frontend_input_renderer',
Mage_Core_Model_Resource_Setup_Migration::ENTITY_TYPE_BLOCK,
Mage_Core_Model_Resource_Setup_Migration::FIELD_CONTENT_TYPE_PLAIN,
array('attribute_id')
);
$installer->doUpdateClassAliases();

$installer->endSetup();
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<config>
<modules>
<Mage_Catalog>
<version>1.6.0.0.16</version>
<version>1.6.0.0.17</version>
<active>true</active>
<codePool>core</codePool>
<depends>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
* @package Mage_CatalogRule
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

/** @var $installer Mage_Core_Model_Resource_Setup_Migration */
$installer = Mage::getResourceModel('Mage_Core_Model_Resource_Setup_Migration', 'core_setup');
$installer->startSetup();

$installer->appendClassAliasReplace('catalogrule', 'conditions_serialized',
Mage_Core_Model_Resource_Setup_Migration::ENTITY_TYPE_MODEL,
Mage_Core_Model_Resource_Setup_Migration::FIELD_CONTENT_TYPE_SERIALIZED,
array('rule_id')
);
$installer->appendClassAliasReplace('catalogrule', 'actions_serialized',
Mage_Core_Model_Resource_Setup_Migration::ENTITY_TYPE_MODEL,
Mage_Core_Model_Resource_Setup_Migration::FIELD_CONTENT_TYPE_SERIALIZED,
array('rule_id')
);

$installer->doUpdateClassAliases();

$installer->endSetup();
2 changes: 1 addition & 1 deletion app/code/core/Mage/CatalogRule/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<config>
<modules>
<Mage_CatalogRule>
<version>1.6.0.3</version>
<version>1.6.0.4</version>
<active>true</active>
<codePool>core</codePool>
<depends>
Expand Down
10 changes: 5 additions & 5 deletions app/code/core/Mage/Checkout/view/frontend/opcheckout.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Checkout.prototype = {
this.gotoSection('billing');
}
else{
alert(Translator.translate('Please choose to register or to checkout as a guest').stripTags());
alert(jQuery.mage.__('Please choose to register or to checkout as a guest').stripTags());
return false;
}
document.body.fire('login:setMethod', {method : this.method});
Expand Down Expand Up @@ -545,7 +545,7 @@ ShippingMethod.prototype = {
validate: function() {
var methods = document.getElementsByName('shipping_method');
if (methods.length==0) {
alert(Translator.translate('Your order cannot be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address.').stripTags());
alert(jQuery.mage.__('Your order cannot be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address.').stripTags());
return false;
}

Expand All @@ -558,7 +558,7 @@ ShippingMethod.prototype = {
return true;
}
}
alert(Translator.translate('Please specify shipping method.').stripTags());
alert(jQuery.mage.__('Please specify shipping method.').stripTags());
return false;
},

Expand Down Expand Up @@ -732,7 +732,7 @@ Payment.prototype = {
}
var methods = document.getElementsByName('payment[method]');
if (methods.length==0) {
alert(Translator.translate('Your order cannot be completed at this time as there is no payment methods available for it.').stripTags());
alert(jQuery.mage.__('Your order cannot be completed at this time as there is no payment methods available for it.').stripTags());
return false;
}
for (var i=0; i<methods.length; i++) {
Expand All @@ -744,7 +744,7 @@ Payment.prototype = {
if (result) {
return true;
}
alert(Translator.translate('Please specify payment method.').stripTags());
alert(jQuery.mage.__('Please specify payment method.').stripTags());
return false;
},

Expand Down
Loading

0 comments on commit c0cf1af

Please sign in to comment.