diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt
index e49c38e0a..ce8804534 100644
--- a/docs/changelog/7.x.x.txt
+++ b/docs/changelog/7.x.x.txt
@@ -9,6 +9,7 @@
- fix: Gallery is now part of the default set of assets
- fix: replaced return; with return undef; and changed WGBP.
- Default maximum attachment size is now 100kB
+ - Updated to work with the new JSON 2.04 module. See gotcha.txt for details.
- removed old CS based photo gallery prototype in favor of the new gallery
asset
diff --git a/docs/gotcha.txt b/docs/gotcha.txt
index b561b22f5..02fb7f9e3 100644
--- a/docs/gotcha.txt
+++ b/docs/gotcha.txt
@@ -14,6 +14,13 @@ save you many hours of grief.
located at:
WebGUI/docs/upgrades/packages-7.5.0/root_import_timetracking_user.wgpkg
+ * WebGUI requires newer versions of some existing modules. Be sure to
+ install them BEFORE upgrading. They are:
+
+ JSON 2.04
+ Config::JSON 1.1.2
+
+
7.5.0
--------------------------------------------------------------------
* Event related links are now displayed using a template loop
@@ -25,12 +32,14 @@ save you many hours of grief.
upgrade to the beta. If you upgrade past 7.4.21 then you cannot
use the beta.
+
7.4.12
--------------------------------------------------------------------
* Any customizations made to the Matrix default Search, Compare or
Detailed listing templates will be lost. Please back up your
custom templates before running the upgrade.
+
7.4.11
--------------------------------------------------------------------
* The 7.4.8 upgrade script had an error for sites using Dashboards.
diff --git a/lib/Spectre/Admin.pm b/lib/Spectre/Admin.pm
index f00029a1c..995f4f770 100644
--- a/lib/Spectre/Admin.pm
+++ b/lib/Spectre/Admin.pm
@@ -152,7 +152,7 @@ sub loadSiteData {
}
else {
my $siteData = {};
- eval { $siteData = JSON::jsonToObj($response->content); };
+ eval { $siteData = JSON::from_json($response->content); };
if ($@) {
$self->error("Couldn't fetch Spectre configuration data for $key");
}
diff --git a/lib/Spectre/Cron.pm b/lib/Spectre/Cron.pm
index 798230a60..2dd89e9c0 100644
--- a/lib/Spectre/Cron.pm
+++ b/lib/Spectre/Cron.pm
@@ -19,7 +19,7 @@ use DateTime;
use HTTP::Request::Common;
use HTTP::Cookies;
use POE qw(Component::Client::HTTP);
-use JSON 'objToJson';
+use JSON qw/ to_json /;
#-------------------------------------------------------------------
@@ -337,7 +337,7 @@ sub getJsonStatus {
next unless $self->{_jobs}->{$key}->{sitename} eq $sitename;
$data{$key} = $self->{_jobs}->{$key};
}
- $kernel->call(IKC => post => $rsvp, objToJson(\%data));
+ $kernel->call(IKC => post => $rsvp, to_json(\%data));
}
diff --git a/lib/Spectre/Workflow.pm b/lib/Spectre/Workflow.pm
index aa94413ac..5e3b7e242 100644
--- a/lib/Spectre/Workflow.pm
+++ b/lib/Spectre/Workflow.pm
@@ -20,7 +20,7 @@ use HTTP::Cookies;
use POE qw(Component::Client::HTTP);
use POE::Queue::Array;
use Tie::IxHash;
-use JSON 'objToJson';
+use JSON qw/ to_json /;
#-------------------------------------------------------------------
@@ -223,7 +223,7 @@ sub editWorkflowPriority {
if ($ackPriority != $newPriority) {
# return an error
my $error = 'edit priority setting error';
- $kernel->call(IKC=>post=>$rsvp, objToJson({message => $error}));
+ $kernel->call(IKC=>post=>$rsvp, to_json({message => $error}));
}
$found = 1;
last;
@@ -232,11 +232,11 @@ sub editWorkflowPriority {
if (! $found) {
# return an error message
my $error = 'edit priority instance not found error';
- $kernel->call(IKC=>post=>$rsvp, objToJson({message => $error}));
+ $kernel->call(IKC=>post=>$rsvp, to_json({message => $error}));
}
else {
# return success message
- $kernel->call(IKC=>post=>$rsvp, objToJson({message => 'edit priority success'}));
+ $kernel->call(IKC=>post=>$rsvp, to_json({message => 'edit priority success'}));
}
}
@@ -338,7 +338,7 @@ sub getJsonStatus {
}
}
- $kernel->call(IKC=>post=>$rsvp, objToJson(\%output));
+ $kernel->call(IKC=>post=>$rsvp, to_json(\%output));
}
#-------------------------------------------------------------------
diff --git a/lib/WebGUI/Asset/File/Image/Photo.pm b/lib/WebGUI/Asset/File/Image/Photo.pm
index 4702c79b6..1803cf858 100644
--- a/lib/WebGUI/Asset/File/Image/Photo.pm
+++ b/lib/WebGUI/Asset/File/Image/Photo.pm
@@ -19,7 +19,7 @@ use base 'WebGUI::Asset::File::Image';
use Carp qw( carp croak );
use Image::ExifTool qw( :Public );
-use JSON;
+use JSON qw/ to_json from_json /;
use Tie::IxHash;
use WebGUI::DateTime;
@@ -439,7 +439,7 @@ sub getTemplateVars {
}
### Format exif vars
- my $exif = jsonToObj( delete $var->{exifData} );
+ my $exif = from_json( delete $var->{exifData} );
$exif = ImageInfo( $self->getStorageLocation->getPath( $self->get("filename") ) );
for my $tag ( keys %$exif ) {
# Hash of exif_tag => value
@@ -679,9 +679,8 @@ sub updateExifDataFromFile {
return undef;
my $info = ImageInfo( $storage->getPath( $self->get('filename') ) );
- use Data::Dumper; $self->session->errorHandler->info( Dumper $info );
$self->update({
- exifData => objToJson( $info ),
+ exifData => to_json( $info ),
});
}
diff --git a/lib/WebGUI/Asset/Wobject/Calendar.pm b/lib/WebGUI/Asset/Wobject/Calendar.pm
index 10df5ac3f..10cd1d214 100644
--- a/lib/WebGUI/Asset/Wobject/Calendar.pm
+++ b/lib/WebGUI/Asset/Wobject/Calendar.pm
@@ -2,8 +2,6 @@ package WebGUI::Asset::Wobject::Calendar;
use strict;
-our $VERSION = "0.0.0";
-
####################################################################
# WebGUI is Copyright 2001-2007 Plain Black Corporation.
####################################################################
@@ -26,7 +24,7 @@ use WebGUI::DateTime;
use base 'WebGUI::Asset::Wobject';
use DateTime;
-use JSON;
+use JSON qw/to_json/;
=head1 Name
@@ -553,7 +551,7 @@ ENDHTML
my $feeds = $self->getFeeds();
$tab->raw('');
diff --git a/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm b/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm
index 031377684..9f93e624a 100644
--- a/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm
+++ b/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm
@@ -18,7 +18,7 @@ use strict;
use base 'WebGUI::Asset::Wobject';
use Tie::IxHash;
use WebGUI::HTMLForm;
-use JSON;
+use JSON qw/ to_json /;
use Digest::MD5;
use WebGUI::Workflow::Instance;
use WebGUI::Cache;
@@ -952,7 +952,7 @@ sub getBadgeSelector {
};
}
$js = '';
%options = (%options,%{$badges});
$output .= WebGUI::Form::selectBox($self->session,{
diff --git a/lib/WebGUI/Asset/Wobject/Poll.pm b/lib/WebGUI/Asset/Wobject/Poll.pm
index 8d930de8f..1f30659e3 100644
--- a/lib/WebGUI/Asset/Wobject/Poll.pm
+++ b/lib/WebGUI/Asset/Wobject/Poll.pm
@@ -192,7 +192,7 @@ sub freezeGraphConfig {
my $self = shift;
my $obj = shift;
- return JSON::objToJson($obj);
+ return JSON::to_json($obj);
}
@@ -403,7 +403,7 @@ sub thawGraphConfig {
my $self = shift;
my $string = shift;
- return JSON::jsonToObj($string);
+ return JSON::from_json($string);
}
#-------------------------------------------------------------------
diff --git a/lib/WebGUI/AssetPackage.pm b/lib/WebGUI/AssetPackage.pm
index e65250f88..edb78ccc2 100644
--- a/lib/WebGUI/AssetPackage.pm
+++ b/lib/WebGUI/AssetPackage.pm
@@ -65,7 +65,7 @@ sub exportPackage {
my $storage = WebGUI::Storage->createTemp($self->session);
foreach my $asset (@{$self->getLineage(["self","descendants"],{returnObjects=>1})}) {
my $data = $asset->exportAssetData;
- $storage->addFileFromScalar($data->{properties}{lineage}.".json", JSON::objToJson($data,{pretty => 1, indent => 4, autoconv=>0, skipinvalid=>1}));
+ $storage->addFileFromScalar($data->{properties}{lineage}.".json", JSON->new->pretty->encode($data));
foreach my $storageId (@{$data->{storage}}) {
my $assetStorage = WebGUI::Storage->get($self->session, $storageId);
$assetStorage->tar($storageId.".storage", $storage);
@@ -209,8 +209,7 @@ sub importPackage {
next unless ($decompressed->getFileExtension($file) eq "json");
$error->info("Found data file $file");
my $data = eval{
- local $JSON::UnMapping = 1;
- JSON::jsonToObj($decompressed->getFileContentsAsScalar($file))
+ JSON->new->relaxed(1)->decode($decompressed->getFileContentsAsScalar($file))
};
if ($@ || $data->{properties}{assetId} eq "" || $data->{properties}{className} eq "" || $data->{properties}{revisionDate} eq "") {
$error->error("package corruption: ".$@) if ($@);
diff --git a/lib/WebGUI/Commerce/Transaction.pm b/lib/WebGUI/Commerce/Transaction.pm
index 9108d5d26..4833d86c5 100644
--- a/lib/WebGUI/Commerce/Transaction.pm
+++ b/lib/WebGUI/Commerce/Transaction.pm
@@ -18,7 +18,7 @@ package WebGUI::Commerce::Transaction;
use strict;
use WebGUI::SQL;
use WebGUI::Commerce::Payment;
-use JSON;
+use JSON qw/ from_json to_json /;
#-------------------------------------------------------------------
@@ -567,11 +567,11 @@ sub shippingOptions {
$shippingOptions = shift;
if (scalar (keys %{$shippingOptions})) {
- $self->{_properties}{shippingOptions} = objToJson($shippingOptions);
+ $self->{_properties}{shippingOptions} = to_json($shippingOptions);
$self->session->db->write("update transaction set shippingOptions=? where transactionId=?",[$self->{_properties}{shippingOptions},$self->{_transactionId}]);
}
- return jsonToObj($self->{_properties}{shippingOptions});
+ return from_json($self->{_properties}{shippingOptions});
}
#-------------------------------------------------------------------
diff --git a/lib/WebGUI/Operation/Spectre.pm b/lib/WebGUI/Operation/Spectre.pm
index 0c009b228..f6312064d 100644
--- a/lib/WebGUI/Operation/Spectre.pm
+++ b/lib/WebGUI/Operation/Spectre.pm
@@ -97,7 +97,7 @@ sub www_spectreGetSiteData {
}
$siteData{cron} = \@schedules;
}
- return JSON::objToJson(\%siteData,{autoconv=>0, skipinvalid=>1});
+ return JSON::to_json(\%siteData);
}
#-------------------------------------------------------------------
@@ -144,8 +144,8 @@ sub www_spectreStatus {
}
my %data = (
- workflow => jsonToObj($workflowResult),
- cron => jsonToObj($cronResult),
+ workflow => from_json($workflowResult),
+ cron => from_json($cronResult),
);
my $workflowCount = @{ $data{workflow}{Suspended} } + @{ $data{workflow}{Waiting} } + @{ $data{workflow}{Running} };
diff --git a/lib/WebGUI/Operation/Workflow.pm b/lib/WebGUI/Operation/Workflow.pm
index 82510c744..6205eb6ba 100644
--- a/lib/WebGUI/Operation/Workflow.pm
+++ b/lib/WebGUI/Operation/Workflow.pm
@@ -21,7 +21,7 @@ use WebGUI::Workflow::Activity;
use WebGUI::Workflow::Instance;
use WebGUI::Utility;
use POE::Component::IKC::ClientLite;
-use JSON 'jsonToObj';
+use JSON qw/ from_json /;
=head1 NAME
@@ -337,7 +337,7 @@ sub www_editWorkflowPriority {
return $ac->render($output, $i18n->get('show running workflows'));
}
- my $responseHref = jsonToObj($resultJson);
+ my $responseHref = from_json($resultJson);
my $message = $i18n->get($responseHref->{message}) || $i18n->get('edit priority unknown error');
return $ac->render($message, $i18n->get('show running workflows'));
@@ -577,7 +577,7 @@ ENDCODE
}
if (defined $workflowResult) {
- my $workflowsHref = jsonToObj($workflowResult);
+ my $workflowsHref = from_json($workflowResult);
my $workflowTitleFor = $session->db->buildHashRef(<<"");
SELECT wi.instanceId, w.title
diff --git a/lib/WebGUI/Session/ErrorHandler.pm b/lib/WebGUI/Session/ErrorHandler.pm
index 2cd51fc71..614dd83ef 100644
--- a/lib/WebGUI/Session/ErrorHandler.pm
+++ b/lib/WebGUI/Session/ErrorHandler.pm
@@ -398,7 +398,7 @@ sub showDebug {
$form->{$key} = "********";
}
}
- $text = JSON::objToJson($form, {pretty => 1, indent => 4, autoconv=>0, skipinvalid=>1});
+ $text = JSON->new->pretty->encode($form);
$text =~ s/&/&/sg;
$text =~ s/>/>/sg;
$text =~ s/</sg;
diff --git a/lib/WebGUI/Workflow/Activity/CalendarUpdateFeeds.pm b/lib/WebGUI/Workflow/Activity/CalendarUpdateFeeds.pm
index a2b1e6d99..ca75d1aa0 100755
--- a/lib/WebGUI/Workflow/Activity/CalendarUpdateFeeds.pm
+++ b/lib/WebGUI/Workflow/Activity/CalendarUpdateFeeds.pm
@@ -25,7 +25,7 @@ use WebGUI::DateTime;
use DateTime::TimeZone;
use LWP::UserAgent;
-use JSON qw(objToJson jsonToObj);
+use JSON qw(to_json from_json);
=head1 NAME
@@ -92,8 +92,8 @@ sub execute {
my $eventList = [];
my $feedList;
if ($instance->getScratch('events')) {
- $eventList = jsonToObj($instance->getScratch('events'));
- $feedList = jsonToObj($instance->getScratch('feeds'));
+ $eventList = from_json($instance->getScratch('events'));
+ $feedList = from_json($instance->getScratch('feeds'));
}
else {
my $ua = LWP::UserAgent->new(agent => "WebGUI");
@@ -356,8 +356,8 @@ sub execute {
}
while (@$eventList) {
if ($startTime + 55 < time()) {
- $instance->setScratch('events', objToJson($eventList));
- $instance->setScratch('feeds', objToJson($feedList));
+ $instance->setScratch('events', to_json($eventList));
+ $instance->setScratch('feeds', to_json($feedList));
return $self->WAITING;
}
my $eventData = shift @$eventList;
diff --git a/lib/WebGUI/Workflow/Activity/GetSyndicatedContent.pm b/lib/WebGUI/Workflow/Activity/GetSyndicatedContent.pm
index 80282117e..44f2ce0ab 100644
--- a/lib/WebGUI/Workflow/Activity/GetSyndicatedContent.pm
+++ b/lib/WebGUI/Workflow/Activity/GetSyndicatedContent.pm
@@ -105,7 +105,7 @@ sub execute {
# See if we're done
if (scalar(@arrayCopy) > 0) {
- $instance->setScratch("syndicatedUrls", objToJson(@arrayCopy));
+ $instance->setScratch("syndicatedUrls", JSON::to_json(@arrayCopy));
return $self->WAITING;
}
@@ -139,11 +139,11 @@ sub getSyndicatedUrls {
asset.state='published'"
);
- $instance->setScratch("syndicatedUrls", objToJson($urls));
+ $instance->setScratch("syndicatedUrls", JSON::to_json($urls));
return $urls;
}
- return jsonToObj($syndicatedUrls);
+ return JSON::from_json($syndicatedUrls);
}
diff --git a/lib/WebGUI/Workflow/Cron.pm b/lib/WebGUI/Workflow/Cron.pm
index 46a1da45f..9d04967a0 100644
--- a/lib/WebGUI/Workflow/Cron.pm
+++ b/lib/WebGUI/Workflow/Cron.pm
@@ -116,7 +116,7 @@ sub get {
my $self = shift;
my $name = shift;
if ($name eq "parameters") {
- my $parameters = JSON::jsonToObj($self->{_data}{$name});
+ my $parameters = JSON::from_json($self->{_data}{$name});
return $parameters->{parameters};
}
return $self->{_data}{$name};
@@ -298,7 +298,7 @@ sub set {
$self->{_data}{className} = (exists $properties->{className}) ? $properties->{className} : $self->{_data}{className};
$self->{_data}{methodName} = (exists $properties->{methodName}) ? $properties->{methodName} : $self->{_data}{methodName};
if (exists $properties->{parameters}) {
- $self->{_data}{parameters} = JSON::objToJson({parameters => $properties->{parameters}},{pretty => 1, indent => 4, autoconv=>0, skipinvalid=>1});
+ $self->{_data}{parameters} = JSON->new->pretty->encode({parameters => $properties->{parameters}});
}
$self->{_data}{enabled} = 0 unless ($self->{_data}{workflowId});
my $spectre = WebGUI::Workflow::Spectre->new($self->session);
diff --git a/lib/WebGUI/Workflow/Instance.pm b/lib/WebGUI/Workflow/Instance.pm
index 82bee41e7..352ec12cc 100644
--- a/lib/WebGUI/Workflow/Instance.pm
+++ b/lib/WebGUI/Workflow/Instance.pm
@@ -66,7 +66,7 @@ sub create {
my ($isSingleton) = $session->db->quickArray("select count(*) from Workflow where workflowId=? and
mode='singleton'",[$properties->{workflowId}]);
my $params = (exists $properties->{parameters})
- ? JSON::objToJson({parameters => $properties->{parameters}}, {pretty => 1, indent => 4, autoconv=>0, skipinvalid=>1})
+ ? JSON->new->pretty->encode({parameters => $properties->{parameters}})
: undef;
my ($count) = $session->db->quickArray("select count(*) from WorkflowInstance where workflowId=? and parameters=?",[$properties->{workflowId},$params]);
return undef if ($isSingleton && $count);
@@ -147,7 +147,7 @@ sub get {
my $self = shift;
my $name = shift;
if ($name eq "parameters") {
- my $parameters = JSON::jsonToObj($self->{_data}{$name});
+ my $parameters = JSON::from_json($self->{_data}{$name});
return $parameters->{parameters};
}
return $self->{_data}{$name};
@@ -416,7 +416,7 @@ sub set {
$self->{_data}{className} = (exists $properties->{className}) ? $properties->{className} : $self->{_data}{className};
$self->{_data}{methodName} = (exists $properties->{methodName}) ? $properties->{methodName} : $self->{_data}{methodName};
if (exists $properties->{parameters}) {
- $self->{_data}{parameters} = JSON::objToJson({parameters => $properties->{parameters}}, {pretty => 1, indent => 4, autoconv=>0, skipinvalid=>1});
+ $self->{_data}{parameters} = JSON->new->pretty->encode({parameters => $properties->{parameters}});
}
$self->{_data}{currentActivityId} = (exists $properties->{currentActivityId}) ? $properties->{currentActivityId} : $self->{_data}{currentActivityId};
$self->{_data}{lastUpdate} = time();
diff --git a/sbin/testEnvironment.pl b/sbin/testEnvironment.pl
index d6006238d..662cd8435 100644
--- a/sbin/testEnvironment.pl
+++ b/sbin/testEnvironment.pl
@@ -103,8 +103,8 @@ checkModule("HTML::TagFilter",0.07);
checkModule("HTML::Template",2.9);
checkModule("HTML::Template::Expr",0.05,2);
checkModule("XML::RSSLite",0.11);
-checkModule("JSON",0.991);
-checkModule("Config::JSON","1.1.0");
+checkModule("JSON",2.04);
+checkModule("Config::JSON","1.1.2");
checkModule("Text::CSV_XS","0.26");
checkModule("Net::Subnets",0.21);
checkModule("Finance::Quote",1.08);
diff --git a/sbin/upgrade.pl b/sbin/upgrade.pl
index 06f43b763..c92f58066 100644
--- a/sbin/upgrade.pl
+++ b/sbin/upgrade.pl
@@ -19,7 +19,6 @@ use strict;
use DBI;
use File::Path;
use Getopt::Long;
-use JSON;
use WebGUI::Config;
use WebGUI::Session;
use WebGUI::Utility;
@@ -331,8 +330,8 @@ STOP
sub checkVersion {
$_[0] =~ /(\d+)\.(\d+)\.(\d+)/;
my $goal = 7;
- my $feature = 3;
- my $fix = 22;
+ my $feature = 4;
+ my $fix = 21;
if ($1 > $goal) {
return 1;
}