Skip to content

Commit

Permalink
release 2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kkasowski committed May 11, 2017
1 parent 4f2684d commit 6225095
Show file tree
Hide file tree
Showing 10 changed files with 352 additions and 46 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## Changelog
* 2.1.2 - 2017.05.11:
* New: Possibility to get country code in ISO 3166-1 alfa-3 standard.
* Fix: Properly display custom settings tabs.
* Fix: Properly migrate stock status.
* 2.1.1 - 2017.05.10:
* New: Tools to remove zombie variations and meta.
* Fix: Remove debug method from, create variations from all attributes.
Expand Down
84 changes: 45 additions & 39 deletions jigoshop.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Description: Jigoshop, a WordPress eCommerce plugin that works.
* Author: Jigoshop
* Author URI: http://www.jigoshop.com
* Version: 2.1.1
* Version: 2.1.2
* Requires at least: 4.0
* Tested up to: 4.7.4
* Text Domain: jigoshop
Expand Down Expand Up @@ -95,48 +95,54 @@ function jigoshop_required_wordpress_version()

$ini_memory_limit = ini_get('memory_limit');
preg_match('/^(\d+)(\w*)?$/', $ini_memory_limit, $memory);
$memory_limit = $memory[1];
if (isset($memory[2])) {
switch (strtoupper($memory[2])) {
/** @noinspection PhpMissingBreakStatementInspection */
case 'M':
$memory_limit *= 1024 * 1024;
case 'K':
$memory_limit *= 1024;
}
}
if($memory_limit < JIGOSHOP_REQUIRED_MEMORY*1024*1024){
function jigoshop_required_memory_warning()
{
$ini_memory_limit = ini_get('memory_limit');
echo '<div class="error"><p>'.
sprintf(__('<strong>Warning!</strong> Jigoshop requires at least %sM of memory! Your system currently has: %s.', 'jigoshop'), JIGOSHOP_REQUIRED_MEMORY, $ini_memory_limit).
'</p></div>';
}
add_action('admin_notices', 'jigoshop_required_memory_warning');
if(isset($memory[1])) {
$memory_limit = $memory[1];
if (isset($memory[2])) {
switch (strtoupper($memory[2])) {
/** @noinspection PhpMissingBreakStatementInspection */
case 'M':
$memory_limit *= 1024 * 1024;
case 'K':
$memory_limit *= 1024;
}
}
if ($memory_limit < JIGOSHOP_REQUIRED_MEMORY * 1024 * 1024) {
function jigoshop_required_memory_warning()
{
$ini_memory_limit = ini_get('memory_limit');
echo '<div class="error"><p>' .
sprintf(__('<strong>Warning!</strong> Jigoshop requires at least %sM of memory! Your system currently has: %s.', 'jigoshop'), JIGOSHOP_REQUIRED_MEMORY, $ini_memory_limit) .
'</p></div>';
}

add_action('admin_notices', 'jigoshop_required_memory_warning');
}
}

preg_match('/^(\d+)(\w*)?$/', WP_MEMORY_LIMIT, $memory);
$memory_limit = $memory[1];
if (isset($memory[2])) {
switch (strtoupper($memory[2])) {
/** @noinspection PhpMissingBreakStatementInspection */
case 'M':
$memory_limit *= 1024 * 1024;
case 'K':
$memory_limit *= 1024;
}
}
if(isset($memory[1])) {
$memory_limit = $memory[1];
if (isset($memory[2])) {
switch (strtoupper($memory[2])) {
/** @noinspection PhpMissingBreakStatementInspection */
case 'M':
$memory_limit *= 1024 * 1024;
case 'K':
$memory_limit *= 1024;
}
}

if($memory_limit < JIGOSHOP_REQUIRED_WP_MEMORY*1024*1024){
function jigoshop_required_wp_memory_warning()
{
echo '<div class="error"><p>'.
sprintf(__('<strong>Warning!</strong> Jigoshop requires at least %sM of memory for WordPress! Your system currently has: %s. <a href="%s" target="_blank">How to change?</a>', 'jigoshop'),
JIGOSHOP_REQUIRED_WP_MEMORY, WP_MEMORY_LIMIT, 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP').
'</p></div>';
}
add_action('admin_notices', 'jigoshop_required_wp_memory_warning');
if ($memory_limit < JIGOSHOP_REQUIRED_WP_MEMORY * 1024 * 1024) {
function jigoshop_required_wp_memory_warning()
{
echo '<div class="error"><p>' .
sprintf(__('<strong>Warning!</strong> Jigoshop requires at least %sM of memory for WordPress! Your system currently has: %s. <a href="%s" target="_blank">How to change?</a>', 'jigoshop'),
JIGOSHOP_REQUIRED_WP_MEMORY, WP_MEMORY_LIMIT, 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP') .
'</p></div>';
}

add_action('admin_notices', 'jigoshop_required_wp_memory_warning');
}
}
require_once(__DIR__.'/src/JigoshopInit.php');
$jigoshop = new JigoshopInit(__FILE__);
Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ However, if you want priority, dedicated support from Jigoshop staff, we dp offe

== Changelog ==

= 2.1.2 - 2017.05.11 =
* New: Possibility to get country code in ISO 3166-1 alfa-3 standard.
* Fix: Properly display custom settings tabs.
* Fix: Properly migrate stock status.
= 2.1.1 - 2017.05.10 =
* New: Tools to remove zombie variations and meta.
* Fix: Remove debug method from, create variations from all attributes.
Expand Down
18 changes: 18 additions & 0 deletions src/Jigoshop/Admin/Migration/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public function migrate($products)
$attributes = [];
$productAttributes = [];
$globalAttributes = [];
$stock = [];
foreach ($wpdb->get_results("SELECT * FROM {$wpdb->prefix}jigoshop_attribute_taxonomies") as $attribute) {
$this->checkSql();
$globalAttributes[$this->wp->getHelpers()
Expand Down Expand Up @@ -269,8 +270,12 @@ public function migrate($products)

$key = $this->_transformKey($products[$i]->meta_key);


if ($key !== null) {
$value = $this->_transform($products[$i]->meta_key, $products[$i]->meta_value);
if(in_array($key, ['stock_manage', 'stock_stock'])) {
$stock[$key] = $value;
}
if ($key == 'regular_price') {
$regularPrice = $value;
}
Expand All @@ -289,8 +294,21 @@ public function migrate($products)

$i++;
} while ($i < $endI && $products[$i]->ID == $product->ID);

if(isset($stock['stock_manage'], $stock['stock_stock'])) {
if($stock['stock_manage'] && $stock['stock_stock'] == 0) {
$wpdb->update($wpdb->postmeta, [
'meta_value' => StockStatus::OUT_STOCK,
], [
'post_id' => $product->ID,
'meta_key' => 'stock_status',
]);
}
}
}



foreach ($globalAttributes as $slug => $attributeData) {

if(isset($attributes[$slug])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function addServices(Services $services)
{
$services->setDetails('wpal', 'WPAL\Wordpress', []);
$services->setDetails('parsedown', 'Parsedown', []);
$services->setDetails('jigoshop.integration', 'Jigoshop\Integration', [ 'di' ]);
$services->setDetails('jigoshop.product_type.simple', 'Jigoshop\Core\Types\Product\Simple', []);
$services->setDetails('jigoshop.product_type.virtual', 'Jigoshop\Core\Types\Product\Virtual', []);
$services->setDetails('jigoshop.product_type.variable.initializer', 'Jigoshop\Core\Installer\Product\Variable', []);
Expand Down
2 changes: 1 addition & 1 deletion src/Jigoshop/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class Core
{
const VERSION = '2.1.1';
const VERSION = '2.1.2';
const WIDGET_CACHE = 'jigoshop_widget_cache';
const TERMS = 'jigoshop_term';

Expand Down
Loading

0 comments on commit 6225095

Please sign in to comment.