Merge branch 'master' of git://github.com/pdonelan/webgui into filepump
This commit is contained in:
commit
8e3891a7bd
44 changed files with 5516 additions and 80 deletions
|
|
@ -1,3 +1,12 @@
|
|||
7.7.5
|
||||
- Adding StoryManager.
|
||||
- fixed #10223: Calendar List View Ignores Event Permissions (dhelsten)
|
||||
- fixed #10226: html2text dropping text
|
||||
- fixed #10210: Generated Message-Id invalid (patch basis from tektek)
|
||||
- fixed #10209: Changing existing user profile field type doesn't change underlying database column type
|
||||
- fixed #10047: SQLReport Debug doesn't catch when bind variables are incorrect
|
||||
- fixed #10260: WebGUI::Asset::Wobject::Gallery.pm default search date misfunction
|
||||
|
||||
7.7.4
|
||||
- rfe: Extend DateTime for Week-Nrs (#9151)
|
||||
- fixed: 7.6 upgrade left some default content marked as packages
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
BIN
docs/upgrades/packages-7.7.5/root_import_storymanager.wgpkg
Normal file
BIN
docs/upgrades/packages-7.7.5/root_import_storymanager.wgpkg
Normal file
Binary file not shown.
218
docs/upgrades/upgrade_7.7.4-7.7.5.pl
Normal file
218
docs/upgrades/upgrade_7.7.4-7.7.5.pl
Normal file
|
|
@ -0,0 +1,218 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "../..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Storage;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Utility qw/isIn/;
|
||||
|
||||
|
||||
my $toVersion = '7.7.5';
|
||||
my $quiet; # this line required
|
||||
|
||||
|
||||
my $session = start(); # this line required
|
||||
|
||||
# upgrade functions go here
|
||||
|
||||
# Story Manager
|
||||
installStoryManagerTables($session);
|
||||
sm_upgradeConfigFiles($session);
|
||||
sm_updateDailyWorkflow($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Describe what our function does
|
||||
#sub exampleFunction {
|
||||
# my $session = shift;
|
||||
# print "\tWe're doing some stuff here that you should know about... " unless $quiet;
|
||||
# # and here's our code
|
||||
# print "DONE!\n" unless $quiet;
|
||||
#}
|
||||
|
||||
sub installStoryManagerTables {
|
||||
my ($session) = @_;
|
||||
print "\tAdding Story Manager tables... " unless $quiet;
|
||||
my $db = $session->db;
|
||||
$db->write(<<EOSTORY);
|
||||
CREATE TABLE Story (
|
||||
assetId CHAR(22) BINARY NOT NULL,
|
||||
revisionDate BIGINT NOT NULL,
|
||||
headline CHAR(255),
|
||||
subtitle CHAR(255),
|
||||
byline CHAR(255),
|
||||
location CHAR(255),
|
||||
highlights TEXT,
|
||||
story MEDIUMTEXT,
|
||||
photo LONGTEXT,
|
||||
PRIMARY KEY ( assetId, revisionDate )
|
||||
)
|
||||
EOSTORY
|
||||
|
||||
$db->write(<<EOARCHIVE);
|
||||
CREATE TABLE StoryArchive (
|
||||
assetId CHAR(22) BINARY NOT NULL,
|
||||
revisionDate BIGINT NOT NULL,
|
||||
storiesPerPage INTEGER,
|
||||
groupToPost CHAR(22) BINARY,
|
||||
templateId CHAR(22) BINARY,
|
||||
storyTemplateId CHAR(22) BINARY,
|
||||
editStoryTemplateId CHAR(22) BINARY,
|
||||
keywordListTemplateId CHAR(22) BINARY,
|
||||
archiveAfter INT(11),
|
||||
richEditorId CHAR(22) BINARY,
|
||||
approvalWorkflowId CHAR(22) BINARY DEFAULT 'pbworkflow000000000003',
|
||||
PRIMARY KEY ( assetId, revisionDate )
|
||||
)
|
||||
EOARCHIVE
|
||||
|
||||
$db->write(<<EOTOPIC);
|
||||
CREATE TABLE StoryTopic (
|
||||
assetId CHAR(22) BINARY NOT NULL,
|
||||
revisionDate BIGINT NOT NULL,
|
||||
storiesPer INTEGER,
|
||||
storiesShort INTEGER,
|
||||
templateId CHAR(22) BINARY,
|
||||
storyTemplateId CHAR(22) BINARY,
|
||||
PRIMARY KEY ( assetId, revisionDate )
|
||||
)
|
||||
EOTOPIC
|
||||
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
sub sm_upgradeConfigFiles {
|
||||
my ($session) = @_;
|
||||
print "\tAdding Story Manager to config file... " unless $quiet;
|
||||
my $config = $session->config;
|
||||
$config->addToHash(
|
||||
'assets',
|
||||
'WebGUI::Asset::Wobject::StoryTopic' => {
|
||||
'category' => 'community'
|
||||
},
|
||||
);
|
||||
$config->addToHash(
|
||||
'assets',
|
||||
"WebGUI::Asset::Wobject::StoryArchive" => {
|
||||
"isContainer" => 1,
|
||||
"category" => "community"
|
||||
},
|
||||
);
|
||||
my $activities = $config->get('workflowActivities');
|
||||
my $none = $activities->{None};
|
||||
if (!isIn('WebGUI::Workflow::Activity::ArchiveOldStories', @{ $none })) {
|
||||
unshift @{ $none }, 'WebGUI::Workflow::Activity::ArchiveOldStories';
|
||||
}
|
||||
$config->set('workflowActivities', $activities);
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
sub sm_updateDailyWorkflow {
|
||||
my ($session) = @_;
|
||||
print "\tAdding Archive Old Stories to Daily Workflow... " unless $quiet;
|
||||
my $workflow = WebGUI::Workflow->new($session, 'pbworkflow000000000001');
|
||||
foreach my $activity (@{ $workflow->getActivities }) {
|
||||
return if $activity->getName() eq 'WebGUI::Workflow::Activity::ArchiveOldStories';
|
||||
}
|
||||
my $activity = $workflow->addActivity('WebGUI::Workflow::Activity::ArchiveOldStories');
|
||||
$activity->set('title', 'Archive Old Stories');
|
||||
$activity->set('description', 'Archive old stories, based on the settings of the Story Archives that own them');
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add a package to the import node
|
||||
sub addPackage {
|
||||
my $session = shift;
|
||||
my $file = shift;
|
||||
|
||||
# Make a storage location for the package
|
||||
my $storage = WebGUI::Storage->createTemp( $session );
|
||||
$storage->addFileFromFilesystem( $file );
|
||||
|
||||
# Import the package into the import node
|
||||
my $package = WebGUI::Asset->getImportNode($session)->importPackage( $storage );
|
||||
|
||||
# Turn off the package flag, and set the default flag for templates added
|
||||
my $assetIds = $package->getLineage( ['self','descendants'] );
|
||||
for my $assetId ( @{ $assetIds } ) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
|
||||
if ( !$asset ) {
|
||||
print "Couldn't instantiate asset with ID '$assetId'. Please check package '$file' for corruption.\n";
|
||||
next;
|
||||
}
|
||||
my $properties = { isPackage => 0 };
|
||||
if ($asset->isa('WebGUI::Asset::Template')) {
|
||||
$properties->{isDefault} = 1;
|
||||
}
|
||||
$asset->update( $properties );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub start {
|
||||
my $configFile;
|
||||
$|=1; #disable output buffering
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile,
|
||||
'quiet'=>\$quiet
|
||||
);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
$session->user({userId=>3});
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Upgrade to ".$toVersion});
|
||||
return $session;
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub finish {
|
||||
my $session = shift;
|
||||
updateTemplates($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->commit;
|
||||
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
|
||||
$session->close();
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub updateTemplates {
|
||||
my $session = shift;
|
||||
return undef unless (-d "packages-".$toVersion);
|
||||
print "\tUpdating packages.\n" unless ($quiet);
|
||||
opendir(DIR,"packages-".$toVersion);
|
||||
my @files = readdir(DIR);
|
||||
closedir(DIR);
|
||||
my $newFolder = undef;
|
||||
foreach my $file (@files) {
|
||||
next unless ($file =~ /\.wgpkg$/);
|
||||
# Fix the filename to include a path
|
||||
$file = "packages-" . $toVersion . "/" . $file;
|
||||
addPackage( $session, $file );
|
||||
}
|
||||
}
|
||||
|
||||
#vim:ft=perl
|
||||
Loading…
Add table
Add a link
Reference in a new issue