Compare commits

..

No commits in common. "master" and "v7.10.31" have entirely different histories.

3596 changed files with 212519 additions and 239010 deletions

View file

@ -1,15 +0,0 @@
# https://medium.com/@bounouh.fedi/mastering-the-dockerignore-file-boosting-docker-build-efficiency-398719f4a0e1
# Ignore version control (directories), not needed in container
.git
.git/
.gitignore
# If we're cacheing cpan modules, so they are not downloaded every time
# ignore these caches in the container
.cpanrc
cpan-cache/
# Ignore Docker-related files
Dockerfile*
.dockerignore

3
.gitignore vendored
View file

@ -1,2 +1 @@
.DS_Store /*.kpf
/*.kpf

9
.gitmodules vendored
View file

@ -1,9 +0,0 @@
[submodule "custom/webgui_newsletter"]
path = custom/webgui_newsletter
url = ssh://forgejo@git.oqapi.nl/UnitedKnowledge/webgui_newsletter.git
[submodule "custom/webgui_specialstate"]
path = custom/webgui_specialstate
url = ssh://forgejo@git.oqapi.nl/UnitedKnowledge/webgui_specialstate.git
[submodule "custom/customlib_honeypot"]
path = custom/customlib_honeypot
url = ssh://forgejo@git.oqapi.nl/UnitedKnowledge/customlib_honeypot.git

1
.proverc Normal file
View file

@ -0,0 +1 @@
--recurse

View file

@ -1,173 +0,0 @@
FROM debian:trixie
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt -y install perl cpanminus libaspell-dev make libdbd-mysql-perl libdigest-perl-md5-perl libxml-simple-perl \
libmodule-install-perl gcc libperl-dev default-libmysqlclient-dev libpng-dev build-essential libgd-dev mariadb-client imagemagick \
libpng-dev libjpeg-dev libtiff-dev libapache2-mod-perl2 libapache2-mod-perl2-dev libapache2-request-perl libimage-magick-perl vim \
apache2 apache2-utils mailutils
RUN cpanm --notest --no-cache --force \
Algorithm::Permute \
App::Cmd \
Archive::Any \
Archive::Tar \
Archive::Zip \
Business::OnlinePayment \
Business::OnlinePayment::AuthorizeNet \
Business::PayPal::API \
Business::Tax::VAT::Validation \
CHI \
CSS::Minifier::XS \
CSS::Packer \
Cache::FastMmap \
Capture::Tiny \
Class::C3 \
Class::InsideOut \
Clone \
Color::Calc \
Compress::Zlib \
Config::JSON \
DBI \
Data::ICal \
DateTime \
DateTime::Event::ICal \
DateTime::Format::HTTP \
DateTime::Format::Mail \
DateTime::Format::Strptime \
DBD::mysql@4.051 \
Devel::StackTrace \
Devel::StackTrace::WithLexicals \
Digest::MD5 \
Digest::SHA \
Email::Valid \
Exception::Class \
Facebook::Graph \
File::Path \
Finance::Quote \
GD \
GD::Graph \
Geo::Coder::Googlev3 \
HTML::Form \
HTML::Highlight \
HTML::Packer \
HTML::Parser \
HTML::TagCloud \
HTML::TagFilter \
HTML::Template \
HTML::Template::Expr \
HTTP::BrowserDetect \
HTTP::Exception \
HTTP::Headers \
HTTP::Request \
IO::File::WithPath \
IO::Interactive::Tiny \
IO::Socket::SSL \
IO::Zlib \
Image::ExifTool \
Imager \
Imager::File::PNG \
JSON \
JSON::Any \
JSON::PP \
JavaScript::Minifier::XS \
JavaScript::Packer \
Kwargs \
LWP \
LWP::Protocol::https \
List::MoreUtils \
Locales \
Log::Log4perl \
Mail::DeliveryStatus::BounceParser \
MIME::Tools \
Module::Find \
Monkey::Patch \
Moose \
MooseX::NonMoose \
MooseX::Storage \
MooseX::Storage::Format::JSON \
Net::CIDR::Lite \
Net::DNS \
Net::LDAP \
Net::POP3 \
Net::SMTP \
Net::Twitter \
Number::Format \
POE \
POE::Component::Client::HTTP \
POE::Component::IKC::Server \
POE::Component::IKC \
Package::Stash \
Params::Validate \
Path::Class \
PerlIO::eol \
Plack \
Plack::Middleware::Debug \
Plack::Middleware::Status \
Plack::Request \
Plack::Response \
Pod::Coverage \
Readonly \
Scope::Guard \
Search::QueryParser \
Storable \
Template \
Test::Class \
Test::Deep \
Test::Differences \
Test::Exception \
Test::Harness \
Test::Log::Dispatch \
Test::LongString \
Test::MockObject \
Test::MockTime \
Test::More \
Test::Tester \
Test::WWW::Mechanize::PSGI \
Text::Aspell \
Text::Balanced \
Text::CSV_XS \
Tie::CPHash \
Tie::IxHash \
Time::HiRes \
Try::Tiny \
URI::Escape \
UUID::Tiny \
Weather::Com::Finder \
XML::FeedPP \
XML::FeedPP::MediaRSS \
XML::Simple \
common::sense \
namespace::autoclean
RUN apt -y remove libjson-xs-perl
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*
#RUN cpanm --notest --force \
# DBD::mysql@4.051
ADD lib /data/WebGUI/lib
ADD sbin /data/WebGUI/sbin
ADD share /data/WebGUI/share
ADD www/extras /data/WebGUI/www/extras
ADD www/maintenance.html /data/WebGUI/www/maintenance.html
ADD www/uploads /data/WebGUI/uploads
ADD etc /data/WebGUI/etc
ADD distribution/webgui/entrypoint /entrypoint
ADD distribution/webgui/www.example.com.conf /etc/apache2/sites-available/000-default.conf
ADD distribution/webgui/webgui.conf /etc/apache2/mods-enabled/webgui.conf
ADD distribution/webgui/modperl.pl /etc/apache2/modperl.pl
RUN useradd --home=/data/WebGUI webgui; chown -R webgui: /data/WebGUI; chmod 755 /entrypoint; \
# apt remove -y cpanminus make gcc libperl-dev ; rm -rf /root/.cpanm; \
echo "ServerName localhost" >> /etc/apache2/apache2.conf;
#USER webgui
WORKDIR /data/WebGUI
CMD [ "/entrypoint" ]

50
README Normal file
View file

@ -0,0 +1,50 @@
This is the PSGI branch of WebGUI8
To try this out:
0) Start from WebGUI 7.10.23 or the example .conf and create.sql that comes with WebGUI 8.
1) Run testEnvironment.pl to install all new requirements.
2) Get a new wgd from http://haarg.org/wgd
3) Copy etc/WebGUI.conf.original to www.whatever.com.conf; edit it and set dbuser, dbpass,
dsn, uploadsPath (eg to /data/domains/www.example.com/public/uploads/), extrasPath,
maintenancePage and siteName
4) Set WEBGUI_CONFIG to point at your new config file
5) $ export PERL5LIB='/data/WebGUI/lib'
6) $ wgd reset --upgrade
7) $ cd /data/WebGUI (or whereever you unpacked it)
8) $ rsync -r -a (or cp -a) /data/WebGUI/www/extras /data/domains/www.example.com/public/
(from whereever you unpacked it to whereever you pointed extrasPath to; note 'extras'
goes inside 'public', both under where extrasPath points to)
To start it:
8) $ plackup app.psgi
See docs/install.txt for more detailed installation instructions.
Currently, the best performance is achieved via:
plackup -E none -s Starman --workers 10 --disable-keepalive
You can benchmark your server via:
ab -t 3 -c 10 -k http://dev.localhost.localdomain:5000/ | grep Req
I'm currently getting 370 requests/second, whereas I'm getting 430/second on the non-PSGI WebGUI8 branch.
= ARCHITECTURE =
* The root level app.psgi file loads all the config files found and
loads the site specific psgi file for each, linking them to the
proper host names.
* The site psgi file uses the WEBGUI_CONFIG environment variable to find the config.
* It instantiates the $wg WebGUI object (one per app).
* $wg creates and stores the WebGUI::Config (one per app)
* $wg creates the $app PSGI app code ref (one per app)
* WebGUI::Middleware::Session is wrapped around $app at the outer-most layer so that it can open and
close the $session WebGUI::Session. Any other wG middleware that needs $session should go in between
it and $app ($session created one per request)
* $session creates the $request WebGUI::Session::Request and $response WebGUI::Session::Response
objects (one per request)

287
README.md
View file

@ -1,287 +0,0 @@
# WebGUI Content Management System
WebGUI is a powerful, open-source content management system and web framework built with Perl. It provides a comprehensive platform for building dynamic websites, managing content, and handling user interactions with a focus on flexibility and extensibility.
## About
- **Version**: 7.10.32
- **Status**: Stable
- **License**: GNU General Public License v2
- **Copyright**: 2001-2009 Plain Black Corporation, and contributors
- **Website**: http://www.plainblack.com
## Features
- **Modular Architecture**: Pluggable asset and component system
- **User Management**: Comprehensive user authentication and group management
- **Content Management**: Flexible asset-based content system
- **Workflow Engine**: Built-in workflow automation
- **Search Capabilities**: Full-text search and indexing
- **API-Driven**: RESTful API support
- **Internationalization**: Multi-language support
- **Commerce Ready**: E-commerce functionality with payment processing
- **Session Management**: Robust session handling and security
- **Caching**: Multiple caching strategies (CHI, FastMmap)
- **Database Abstraction**: Works with MySQL/MariaDB
## System Requirements
### Required Software
- **Perl**: 5.8 or higher
- **Apache**: 2.0+ with mod_perl 2.0 and mod_apreq2
- **MySQL/MariaDB**: 5.0.10 or higher
- **ImageMagick**: 6.0 or higher
### Recommended Modules
A comprehensive list of Perl dependencies is installed via `cpanm` (see Dockerfile for details).
## Quick Start Installation
### 1. Prepare Environment
```bash
# Install Perl 5.8+
# Install Apache 2.0 with mod_perl and mod_apreq2
# Install MySQL/MariaDB 5.0.10+
# Install ImageMagick 6.0+
```
### 2. Configure Apache
Add to your Apache configuration:
```apache
LoadModule apreq_module modules/mod_apreq2.so
LoadModule perl_module modules/mod_perl.so
PerlSetVar WebguiRoot /data/WebGUI
PerlCleanupHandler Apache2::SizeLimit
PerlRequire /data/WebGUI/sbin/preload.perl
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
DocumentRoot /data/domains/example.com/www
SetHandler perl-script
PerlInitHandler WebGUI
PerlSetVar WebguiConfig www.example.com.conf
</VirtualHost>
```
### 3. Database Setup
```bash
# Create database and user
mysql -e "create database WebGUI"
mysql -e "grant all privileges on WebGUI.* to webgui@localhost identified by 'your_password'"
mysql -e "flush privileges"
# Load schema
mysql -uwebgui -pyour_password WebGUI < docs/create.sql
```
### 4. Configuration
Edit `etc/WebGUI.conf` to match your database and environment settings:
```conf
# Database connection
<database>
driver=MySQL
DSN=DBI:mysql:WebGUI:localhost:3306
username=webgui
password=your_password
</database>
# Logging
<logging>
configFile=/data/WebGUI/etc/log.conf
</logging>
```
### 5. Start Services
```bash
# Start MySQL/MariaDB
mysql.server start
# Start Apache
apachectl start
```
## Docker Deployment
WebGUI includes Docker support for easy containerized deployment:
# Build Docker image
```bash
docker build -t webgui:latest .
```
# Run with docker-compose (see distribution/docker-compose.yml)
```bash
cd distribution
docker-compose up -d
```
The Docker setup includes:
- Debian-based container with all dependencies
- Apache 2 with mod_perl
- MariaDB client
- ImageMagick for image processing
- Nginx reverse proxy configuration (distribution/nginx/)
## Project Structure
```
├── lib/ # Perl modules (main codebase)
│ ├── WebGUI.pm # Core handler
│ ├── WebGUI/ # WebGUI framework modules
│ ├── WGDev/ # Development utilities
│ └── Spectre/ # Job scheduler
├── sbin/ # System utilities and scripts
├── t/ # Test suite
├── etc/ # Configuration files
├── docs/ # Documentation
├── distribution/ # Docker and deployment configs
├── www/ # Web content (uploads, extras)
└── share/ # Shared resources (nginx config, SQL)
```
### Key Directories
| Directory | Purpose |
|-----------|---------|
| `lib/WebGUI/` | Core WebGUI framework modules |
| `lib/WebGUI/Asset/` | Content asset classes |
| `lib/WebGUI/Form/` | Form field types |
| `lib/WebGUI/Operation/` | Admin operations |
| `sbin/` | Command-line utilities for administration |
| `t/` | Automated test suite |
| `etc/` | Configuration files |
| `docs/` | Installation and reference documentation |
## Development & Testing
### Running Tests
```bash
# Run the complete test suite
perl t/00_compile.t
perl t/Account.t
perl t/Config.t
# ... and many more
# Run specific test
perl t/MyTest.t
```
### Available Utilities
- `sbin/wgd` - WebGUI development tool
- `sbin/spectre.pl` - Job scheduler daemon
- `sbin/upgrade.pl` - Database upgrade utility
- `sbin/testEnvironment.pl` - Environment validation
- `sbin/findBrokenAssets.pl` - Asset consistency checker
## Configuration Files
### Main Configuration
- `etc/WebGUI.conf` - Primary configuration file
- `etc/WebGUI.conf.original` - Original configuration backup
### Logging
- `etc/log.conf` - Logging configuration
- `etc/log.conf.original` - Original logging backup
### Virtual Host Configuration
- `etc/www.example.com.conf` - Example virtual host config
- `distribution/webgui/www.example.com.conf` - Docker example
## Database Schema
The database schema is initialized using:
- `docs/create.sql` - Initial database schema
- `docs/upgrades/` - Version upgrade migration scripts
## Documentation
Detailed documentation is available in the `docs/` directory:
- `install.txt` - Installation instructions
- `changelog/` - Version history and changes
- `credits.txt` - List of contributors
- `legal.txt` - Legal information
- `license.txt` - GPL v2 license text
- `templates.txt` - Template documentation
For more information, visit: [http://wiki.webgui.org](http://wiki.webgui.org)
## Key Components
### Asset System
WebGUI uses an asset-based system for content management where all content types (pages, images, documents, etc.) are assets with configurable properties and workflows.
### Workflow Engine
Automated workflow management for content approval, publishing, and state transitions.
### Session Management
Robust session handling with security features and configuration options for user tracking.
### Commerce
Built-in e-commerce capabilities including:
- Product catalogs
- Shopping carts
- Payment processing (PayPal, Authorize.net)
- Tax calculation
### Search
Full-text search capabilities with indexing for quick content discovery.
## License
WebGUI is released under the **GNU General Public License v2**. See `docs/license.txt` for full license text.
## Credits
WebGUI was created and is maintained by Plain Black Corporation, with contributions from many developers and organizations worldwide. See `docs/credits.txt` for a complete list of contributors.
## Support & Community
- **Main Website**: http://www.plainblack.com
- **Email**: info@plainblack.com
- **Wiki**: http://wiki.webgui.org
- **Installation Guide**: http://wiki.webgui.org/installation-options
## Contributing
Contributions are welcome! Please ensure:
- All tests pass (`perl t/*.t`)
- Code follows Perl best practices
- Changes include appropriate documentation
- Pod comments are included for public APIs
## Troubleshooting
### Database Connection Issues
- Verify MySQL is running: `mysql -uwebgui -p -e "SELECT 1"`
- Check credentials in `etc/WebGUI.conf`
- Verify database user has appropriate privileges
### Apache/mod_perl Issues
- Check Apache error log: `/var/log/apache2/error.log`
- Verify mod_perl and mod_apreq2 are loaded
- Ensure WebguiRoot path is correct
### Missing Dependencies
- Use the Dockerfile as a reference for all dependencies
- Install via cpanm: `cpanm Module::Name`
- Run: `perl sbin/testEnvironment.pl`
## Additional Resources
- Plain Black home: http://www.plainblack.com
- WebGUI Wiki: http://wiki.webgui.org
- Test suite: `t/` directory with comprehensive test coverage
- Configuration examples: `etc/` and `distribution/` directories

21
TODO Normal file
View file

@ -0,0 +1,21 @@
TODO
* Deprecate WebGUI::Session::HTTP - replace with WebGUI::Request/Response
* Investigate moving Cookie handling into middleware
* Reinstate WebGUI::authen with something equivalent
* Refactor assets to use streaming response
* Fix WebGUI::Form::param
DONE
* $session->request is now a Plack::Request object
* serverObject gone from WebGUI::Session::open()
* WebGUI::authen API changed
* urlHandler API changed - no longer gets server, config
* Streaming response body
* Mostly decoupled WebGUI from Log4perl
* Exception handling and error doc mapping
* Plack::Middleware::Debug panels
* Replaces all URL Handlers with Middleware
NB
* Periodically do a big stress-test and check for leaks, mysql overload etc..
ab -t 100 -c 10 -k http://dev.localhost.localdomain:5000 | grep 'Req'

52
app.psgi Normal file
View file

@ -0,0 +1,52 @@
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2012 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
-------------------------------------------------------------------
=cut
use strict;
use Plack::Builder;
use Plack::Util;
use WebGUI::Paths -inc;
use WebGUI::Config;
use WebGUI::Fork;
if ($ENV{PLACK_ENV} ne 'development') {
WebGUI::Paths->preloadAll;
}
WebGUI::Fork->init();
builder {
my $first_app;
WebGUI::Paths->siteConfigs or die "no configuration files found";
for my $config_file (WebGUI::Paths->siteConfigs) {
my $config = WebGUI::Config->new($config_file) or die "failed to log configuration file: $config_file: $!";
my $psgi = $config->get('psgiFile') || WebGUI::Paths->defaultPSGI;
my $app = do {
# default psgi file uses environment variable to find config file
local $ENV{WEBGUI_CONFIG} = $config_file;
Plack::Util::load_psgi($psgi);
} or die;
$first_app ||= $app;
my $gateway = $config->get('gateway');
$gateway =~ s{^/?}{/};
for my $sitename ( @{ $config->get('sitename') } ) {
mount "http://$sitename$gateway" => $app;
}
}
# use the first config found as a fallback
mount '/' => $first_app;
};

19
benchmark.pl Executable file
View file

@ -0,0 +1,19 @@
# Little script used to run benchmarks against dev.localhost.localdomain
#
# To profile, run "perl -d:NYTProf benchmark.pl"
use lib '/data/WebGUI/lib';
use WebGUI;
use Plack::Test;
use Plack::Builder;
use HTTP::Request::Common;
my $wg = WebGUI->new( root => '/data/WebGUI', site => 'dev.localhost.localdomain.conf' );
my $app = builder {
enable '+WebGUI::Middleware::Session', config => $wg->config;
$wg;
};
test_psgi $app, sub {
my $cb = shift;
$cb->( GET "/" ) for 1..1000;
};

@ -1 +0,0 @@
Subproject commit e0eea4fe9c80865a6bde24cae6ab33dcc8089daf

@ -1 +0,0 @@
Subproject commit abaa483aa34e10c1473968dc6f0373cfb7527a31

@ -1 +0,0 @@
Subproject commit ade1aab77063c56cf6ddcc7a69956179e7c3dbe5

View file

@ -1,44 +0,0 @@
# This file is ideal for development and testing.
# --- DO NOT USE FOR PRODUCTION ---
# however, you can use it as a guide to create a proper production environment.
services:
db:
image: docker.io/library/mariadb:latest
container_name: db
environment:
- MYSQL_ROOT_PASSWORD=123qwe
- MYSQL_USER=webgui
- MYSQL_PASSWORD=123qwe
- MYSQL_DATABASE=www_example_com
volumes:
- ./share/create.sql:/docker-entrypoint-initdb.d/1.sql
ports:
- 3306:3306
webgui:
image: webgui:latest
build:
context: ..
dockerfile: Dockerfile
container_name: webgui
depends_on:
- db
volumes:
- ../.:/data/WebGUI
expose:
- "80"
nginx-proxy:
image: nginx:latest
container_name: nginx_proxy
depends_on:
- webgui
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "80:80"
#TODO: add ssl later
#- "443:443"
# TODO: serve staatic files directly from nginx
#- ./www:/var/www/html:ro

View file

@ -1,20 +0,0 @@
worker_processes auto;
events {}
http {
upstream backend {
server webgui:80;
}
server {
listen 80;
location / {
proxy_pass http://backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -1,46 +0,0 @@
#!/bin/bash
# script that runs when the docker container starts
echo "Starting WebGUI entrypoint script with:"
perl -Ilib sbin/wgd ls
echo "Starting WebGUI entrypoint script..."
for configfile in `perl -Ilib sbin/wgd for-each`;do
echo "Processing config file: $configfile"
# wait for the db to come up and get our version so we know if we need to run upgrades
connection_info=`perl -Ilib sbin/wgd db --config-file=$configfile --webgui-root=/data/WebGUI --print | sed "s/'//g" `
while true; do
db_version=`mysql --skip-column-names -e 'select webguiVersion from webguiVersion order by dateApplied desc limit 1;' $connection_info ` && break
echo "waiting for the database to come up..."
sleep 10
done
code_version=`perl -Ilib -e 'use WebGUI; print $WebGUI::VERSION;'`
echo "code version $code_version"
echo "database version $db_version for $configfile with configfile $configfile"
if [ "$db_version" != "$code_version" ];then
echo "Upgrading Webgui from $db_version to $code_version..."
#first we alter the userSession table to make sure that the userId has a default value This is required for the upgrade process to work correctly.
`mysql -e 'alter table userSession MODIFY COLUMN userId char(22) NOT NULL DEFAULT "0";' $connection_info `
perl -Ilib sbin/wgd reset --upgrade --verbose --config-file=$configfile --webgui-root=/data/WebGUI/
## perl -Ilib sbin/wgd db --config-file=www.example.com --webgui-root=/data/WebGUI
#install newsletter module
perl -I /data/WebGUI/lib -I /data/WebGUI/custom/webgui_newsletter/lib /data/WebGUI/custom/webgui_newsletter/sbin/install_icons.pl --customRoot=/data/WebGUI/custom
cd /data/WebGUI/lib
perl -I /data/WebGUI/lib -I /data/WebGUI/custom/webgui_newsletter/lib /data/WebGUI/custom/webgui_newsletter/sbin/install_newsletter.pl --configFile=www.example.com.conf
fi
done
perl -I/data/WebGUI/lib sbin/spectre.pl --daemon
apachectl -DFOREGROUND

View file

@ -1,6 +0,0 @@
#use Apache2::SizeLimit;
#$Apache2::SizeLimit::MAX_PROCESS_SIZE = 600000;
#$Apache2::SizeLimit::MAX_UNSHARED_SIZE = 600000;
#$Apache2::SizeLimit::CHECK_EVERY_N_REQUESTS = 10;
1;

View file

@ -1,4 +0,0 @@
PerlSetVar WebguiRoot /data/WebGUI
#PerlCleanupHandler Apache2::SizeLimit
PerlRequire /data/WebGUI/sbin/preload.perl
PerlRequire /etc/apache2/modperl.pl

View file

@ -1,16 +0,0 @@
<VirtualHost 0.0.0.0:80>
ServerName localhost
ServerAlias webgui www.example.com example.com unitedknowledge.vps2.unitedknowledge.net www.unitedknowledge.eu unitedknowledge.eu www.united-knowledge.eu united-knowledge.eu www.unitedknowledge.net unitedknowledge.net
DocumentRoot /data/WebGUI/www
SetEnvIf SSLPROXY "1" \
SSLPROXY
SetHandler perl-script
PerlInitHandler WebGUI
CustomLog /var/log/apache2/www.example.com.access.log combined
ErrorLog /var/log/apache2/www.example.com.error.log
PerlSetVar WebguiConfig www.example.com.conf
<Directory "/data/WebGUI/www">
Require all granted
</Directory>
</VirtualHost>

View file

@ -1,80 +1,4 @@
7.10.33
- fixed: Columns defined with 'NOT NULL' must have a default value in MySQL 8.x
7.10.32
- fixed: Bad asset redirect from AssetTrash www_delete if encryptPage is set
7.10.31
- fixed: Warnings about API changes in POE::Component::IKC::ClientLite
- fixed: Allow WebGUI::Cache and all consumers to fetch SSL URLs, but not verify the certificates.
- fixed: Migrate to reCAPTCHA v2
7.10.30
- fixed: Do not generate the Not Found page when JS or CSS is requested. In admin mode, this is bypassed so that admins can see which pages are really missing and can easily add them.
- fixed: Allow IS NULL/IS NOT NULL queries in the Asset Report.
- fixed #12461: Carousel fails to initial the rich editor in multiple tabs
7.10.29
- fixed #12454: Email to Group ignores the From field
- fixed #12455: USPS Ship driver fails
- fixed #12456: style type not declared in the minicart template
7.10.28
- fixed: Clearing the caches for groups that don't exist, but have created group objects.
- fixed #12398: WebGUI still uses Clone (missed Spectre code)
- fixed #12413: Cropping problem or bug?
7.10.27
- fixed #12379: userImport documentation error
- fixed #12382: WebGUI::Crud does not work with all form types
- fixed: Threads with no posts return the wrong lastReply data.
- fixed #12339: Upgrade to 7.10 causes metadata values to "disappear" (Dale Trexel)
- Upgraded TinyMCE to 3.5.6
- fixed #12362: Thingy default Y/N field overly default
- fixed #12385: UTF-8 characters in Asset title break the Trash
- fixed ... and the same problem in the Clipboard
- fixed: UpdateAssetSubscribers workflow activity ERRORs if the group cannot be found.
- fixed: EMS has issues showing badges WITHOUT related badge groups.
- fixed: It's okay to paste assets which are archived, because if you don't they stay in the clipboard forever.
- fixed #12386: Story Manager - Carousel rendering broken in Story
- fixed #12386: Story Manager - Carousel rendering broken in Story
- fixed #12384: Click and drag reordering does not work in IE9
- fixed: MessageBoard tolerates Collaboration children not yet having a value for lastPostId
- on invalid proceed method in call to editSave, warn and recover rather than run time error
7.10.26
- fixed: Template diagnostics when called without a session asset.
- fixed: #12378 Wiki search does not work with some metacharacters
7.10.25 7.10.25
- fixed: #12373: Asset::Wobject::Search::view() so HTML highlite not broken by search phrase with unmatched char pairs
- fixed: if user1 adds user2 as a friend, user2 doesn't see user1 as a friend
- fixed: data sync bug in WebGUI::User::friends
- added: give WebGUI::PseudoRequest a hostname method
- fixed: don't clobber the request handler if WebGUI::Test was loaded inside of mod_perl
- fixed #12365: editing a metadata may cause a fatal error (Arjan Widlak / United Knowledge)
- fixed #12346: toVersion in upgrade_7.9.34-7.10.22.pl was "0.0.0"
- fixed #12010 related link duplication where links have group view restrictions
- fixed #12297: keywords.form missing from Post template help
- fixed #12321: Error while deleting a group.
- fixed #12322: Cache/CHI stomps on the config file
- fixed #12327: HttpProxy does not clean up cookie jar storage locations
- fixed #12329: FlatDiscount Sku forces you to enter in negative numbers for price
- fixed #12334: Company name with : in it breaks email sender identity
- fixed #12328: invalid wgaccess file in uploads
- RFE: 9730 (actually missing documentation)
- fixed: Crud updateFromFormPost
- fixed: encryptLogin and sslEnabled both need to be true
- fixed: Cache's setByHTTP method returns content, even when it gets an error in the request. This gives the SC asset fits.
- fixed #12349: Friends invitation error
- fixed #12353: Dataform List mode
- fixed #12364: Site export loses session info
- fixed #12345: tickets in trash still show up
- fixed #12305: dbSlave breaks WebGUI when not able to connect
- fixed: Http Proxy assets with no URL to proxy cannot be deleted.
- fixed: Friends request messages that no longer exist throw a warning.
- fixed: Asset Report asset can search for all wobjects in addition to all assets.
- fixed #12375: Gateway URL ignored for password recovery
7.10.24 7.10.24
- fixed #12318: asset error causes asset manager to fail - fixed #12318: asset error causes asset manager to fail

14
docs/changelog/8.x.x.txt Normal file
View file

@ -0,0 +1,14 @@
8.0.1
- #11849 - Use a different image library -- partially implemented; WebGUI::Image still uses Image::Magick
8.0.0
- #10012 - larger meta data values for multi-value fields
- #12310 - fixed rendering and submit button on user edit/add form
- Replaced the existing caching mechanism with memcached, which results in a 400% improvement to cache speed. See migration.txt for API changes and gotcha.txt for prereq changes.
- Added "hot sessions" so sessions interact with the database less.
- Added Facebook Auth and FacebookLogin macro.
- Removed the WebGUI statistics program and code.
- Prevent Env Macro from being used to access objects in the environment - Thanks to Haarg
- added: Redirect on Logout setting
- RFE: 9730 (actually missing documentation)

File diff suppressed because it is too large Load diff

View file

@ -34,7 +34,6 @@ Contributing Developers..............C.J. Adams-Collier / <cjac@colliertech.org>
Greg Fast / Brunswick Greg Fast / Brunswick
Chris Gebhardt / OpenServe Chris Gebhardt / OpenServe
Andy Grundman Andy Grundman
Chris Hanson / Plain Black
Tessa Harmon / Knowmad Technologies Tessa Harmon / Knowmad Technologies
Chris Jackson Chris Jackson
Roy Johnson / Plain Black Roy Johnson / Plain Black
@ -50,7 +49,6 @@ Contributing Developers..............C.J. Adams-Collier / <cjac@colliertech.org>
Colin Kuskie / perlDreamer Consulting LLC Colin Kuskie / perlDreamer Consulting LLC
Christophe Marcant Christophe Marcant
Kristi McCombs / Plain Black Kristi McCombs / Plain Black
Vince Liao (Global NOC at IU)
Tony Mountifield Tony Mountifield
Kaleb Murphy / Plain Black Kaleb Murphy / Plain Black
Chris Nehren / Plain Black Chris Nehren / Plain Black
@ -86,6 +84,7 @@ Contributing Developers..............C.J. Adams-Collier / <cjac@colliertech.org>
Bernd Kalbfuß-Zimmermann Bernd Kalbfuß-Zimmermann
Tabitha Zipperer / Plain Black Tabitha Zipperer / Plain Black
Rory Zweistra / Oqapi Rory Zweistra / Oqapi
Chris Hanson / Plain Black
The following are people/companies who didn't directly contribute The following are people/companies who didn't directly contribute
to WebGUI, but whose work has made WebGUI possible: to WebGUI, but whose work has made WebGUI possible:
@ -100,3 +99,5 @@ TinyMCE..............................MoxieCode
Yahoo User Interface (YUI)...........Yahoo! Yahoo User Interface (YUI)...........Yahoo!
http://www.yahoo.com http://www.yahoo.com
FamFamFam Silk Icon set..............FamFamFam
http://famfamfam.com/lab/icons/silk/

View file

@ -7,21 +7,43 @@ upgrading from one version to the next, or even between multiple
versions. Be sure to heed the warnings contained herein as they will versions. Be sure to heed the warnings contained herein as they will
save you many hours of grief. save you many hours of grief.
7.10.27 8.0.0
-------------------------------------------------------------------- --------------------------------------------------------------------
* Due to instability in the Clone module, WebGUI is now using Storable's * WebGUI 8 is not API compatible with WebGUI 7. If you have custom
dclone instead. Storable is a core Perl module, so you do not need code, chances are you'll need to update it to make it work with
to install anything new. WebGUI 8. Please read docs/migration.txt for information about
changes to the WebGUI API.
* YUI has been upgraded to 2.9.0 in this release. * Many scripts in the sbin directory have been replaced by the webgui.pl
master script.
* upgrade.pl -> webgui.pl upgrade
7.10.25 * The rotation, deletion and reordering of Photos in a Gallery Album
-------------------------------------------------------------------- has been removed because the way it was implemented in WebGUI 7
* Custom WebGUI plugins written using WebGUI::Crud with hand built forms is incompatible with WebGUI 8.
should be reviewed. A serious bug in how Crud handles forms has been fixed,
and the side-effect of the bug is now that forms processed by updateFromFormPost * As part of the migration to Template::Toolkit, we will be changing template
must include ALL fields, otherwise the data in fields which are missing from the variables from using dots to underscores. All templates using that namespace were
form will be lost. automatically upgraded to use the new variables.
In this version, these templates were updated:
Account Macro template
Admin Toggle Macro template
* The new Admin Console required changes to layout templates. Old templates
will continue to work, but show two sets of editing and drag controls.
* WebGUI 8 does not support HTTP Basic Authentication any longer.
* Support for server-side spell checking in the Rich Editor TinyMCE has been removed.
* The field metaData_values.value has been changed from 'char(255)' to varchar(1024).
This may be incompatible with some MySQL operations. Please check any custom modules
that access this field.
* Template::Toolkit is no longer an optional dependency. Please install it before attempting
to upgrade to 8.0.
7.10.24 7.10.24
-------------------------------------------------------------------- --------------------------------------------------------------------
@ -120,6 +142,7 @@ save you many hours of grief.
is in WebGUI again. Licencing information was overlooked. An is in WebGUI again. Licencing information was overlooked. An
upgrade to 7.10.1 will break the Matrix. This is fixed now. upgrade to 7.10.1 will break the Matrix. This is fixed now.
7.10.1 7.10.1
-------------------------------------------------------------------- --------------------------------------------------------------------
* WebGUI now depends on PerlIO::eol, for doing line ending translation. * WebGUI now depends on PerlIO::eol, for doing line ending translation.
@ -156,6 +179,7 @@ save you many hours of grief.
-------------------------------------------------------------------- --------------------------------------------------------------------
* The javascript check for email addresses has been removed. * The javascript check for email addresses has been removed.
7.9.5 7.9.5
-------------------------------------------------------------------- --------------------------------------------------------------------
* Starting in WebGUI 7.9.4, the CHI and Cache::FastMmap modules are required. * Starting in WebGUI 7.9.4, the CHI and Cache::FastMmap modules are required.
@ -163,6 +187,7 @@ save you many hours of grief.
* Starting in WebGUI 7.9.5, you cannot enter in a URL that is a has more than 2 dashes, * Starting in WebGUI 7.9.5, you cannot enter in a URL that is a has more than 2 dashes,
"-", in a row. They will be collapsed down into 1 dash. "-", in a row. They will be collapsed down into 1 dash.
7.9.4 7.9.4
-------------------------------------------------------------------- --------------------------------------------------------------------
* Shop and Cart changes * Shop and Cart changes
@ -198,7 +223,6 @@ save you many hours of grief.
in components of the core for a while, since the release of the new Survey. in components of the core for a while, since the release of the new Survey.
Test::Deep version 0.095 or higher is now required. Test::Deep version 0.095 or higher is now required.
7.9.2 7.9.2
-------------------------------------------------------------------- --------------------------------------------------------------------
* new dependency: DateTime::Event::ICal 0.10 or higher * new dependency: DateTime::Event::ICal 0.10 or higher
@ -304,7 +328,6 @@ save you many hours of grief.
prefix from the filename. prefix from the filename.
7.8.0 7.8.0
-------------------------------------------------------------------- --------------------------------------------------------------------

View file

@ -2,69 +2,103 @@
# Quick And Dirty Install Instructions # # Quick And Dirty Install Instructions #
################################################################## ##################################################################
The following is a rough overview of how to install WebGUI. For The following is a rough overview of how to install WebGUI *8*.
more detailed instructions read the WebGUI installation
documentation.
http://wiki.webgui.org/installation-options
QnD INSTALL INSTRUCTIONS: http://wiki.webgui.org/installation-options has instructions for
WebGUI 7.
1. Install Perl 5.8 or higher. == INSTALL ==
2. Install Apache 2.0 with mod_perl 2.0 and set up your config. Add the * Install a recent Perl (5.12.1 or better) if you don't have one already
following directives to mod_perl (See WebGUI Done Right for more detail.)
LoadModule apreq_module modules/mod_apreq2.so * Install a recent MySQL and set up a user account
LoadModule perl_module modules/mod_perl.so
PerlSetVar WebguiRoot /data/WebGUI
PerlCleanupHandler Apache2::SizeLimit
PerlRequire /data/WebGUI/sbin/preload.perl
<VirtualHost *:80> * Install ImageMagick (http://www.imagemagick.org/, compile and install the
ServerName www.example.com source or binary package)
ServerAlias example.com
DocumentRoot /data/domains/example.com/www/public
SetHandler perl-script
PerlInitHandler WebGUI
PerlSetVar WebguiConfig www.example.com.conf
</VirtualHost>
3. Install MySQL 5.0.10 or higher. * Get WebGUI from GitHub and check out the WebGUI8 branch:
4. Install Image Magick 6.0 or higher. $ git clone https://github.com/plainblack/webgui.git
$ git checkout WebGUI8 --track
5. Extract WebGUI into your webroot. * Setup your configuration files
6. Start MySQL. Copy WebGUI.conf.original to something named after the site's URL and
ending in .conf, such as www.example.com.conf, and edit it, making sure
to insert your site's URL and the database connection information
(dbuser, dbpass, dsn).
7. Run the following Database commands. (You should modify the Set uploadsPath in the .conf file to eg
commands to match your database, username, and password.) /data/domains/www.example.com/public/uploads/.
mysql -e "create database WebGUI" Edit "etc/spectre.conf" to define port and worker settings for spectre.
mysql -e "grant all privileges on WebGUI.* to webgui@localhost identified by 'password'"
mysql -e "flush privileges"
mysql -uwebgui -ppassword WebGUI < docs/create.sql
8. Edit "etc/WebGUI.conf" to match your DB settings and log directory. Set WEBGUI_CONFIG to point at your new configuration file:
9. Edit "etc/spectre.conf" to define port and worker settings for spectre $ export WEBGUI_CONFIG='/data/WebGUI/etc/www.example.com.conf'
10. Run the following command from your WebGUI/sbin directory to install * Automatically install new Perl module dependencies:
the required perl modules and determine whether you've configured
your system correctly.
perl testEnvironment.pl $ sbin/testEnvironment.pl as root to install Perl modules
If it returns all "OK" then you're done. * Create a MySQL user account for the domain WebGUI is to host
and share/create.sql into that database
11. Start Apache. $ mysql --password --user=root -e "create database www_example_com"
$ mysql --password --user=root -e "grant all privileges on www_example_com.*
to webgui@localhost identified by 'XXXXpasswordhereXXXX'"
$ mysql --password --user=webgui < share/create.sql
12. Start Spectre. * wgd reset --uploads
* Continue with the UPGRADE instructions below
== UPGRADE ==
* Run sbin/testEnvironment.pl. WebGUI 8 adds new dependencies.
* Update wgd:
WebGUI has a new upgrades system for wgd to support. The old system silently
ignores the new upgrade scripts.
Get wgd from http://haarg.org/wgd, put in /data/wre/prereqs/bin/ (if you're
using the WRE), /usr/local/bin, or ~/bin.
Do chmod ugo+x wgd to make it executable.
* Run Upgrades:
$ wgd reset --upgrade
This is needed even for new WebGUI 8 installs. The create.sql and
WebGUI.conf.original are both from 7.10.x.
* Copy new "extras" (images, CSS, JavaScript) over:
$ rsync -r -a (or cp -a) /data/WebGUI/www/extras \
/data/domains/www.example.com/public/
* Add WebGUI's libraries to Perl's library path:
$ export PERL5LIB='/data/WebGUI/lib:/data/WebGUI/t/lib'
Previously, this would break Apache if it were set; now it's required for the
stuff plackup loads to find the rest of WebGUI.
* Launch WebGUI 8:
$ plackup app.psgi
... then connect your browser to the URL it advertises.
You'll be guided through a few quick questions to setup an admin account.
(Or, if you aren't but wanted to be, run wgd reset --starter to enable it.)
* Start Spectre:
cd /data/WebGUI/sbin cd /data/WebGUI/sbin
perl spectre.pl --daemon perl spectre.pl --daemon
13. Browse to your site. You'll be guided through a few quick questions
to setup an admin account.

View file

@ -2,7 +2,7 @@
# WebGUI Legal Information # # WebGUI Legal Information #
#################################################################### ####################################################################
WebGUI is Copyright 2001-2011 Plain Black Corporation. All rights WebGUI is Copyright 2001-2012 Plain Black Corporation. All rights
reserved. reserved.
WebGUI Content Engine, WebGUI Runtime Environment, and Plain Black WebGUI Content Engine, WebGUI Runtime Environment, and Plain Black
@ -27,7 +27,7 @@ each file, or this file, or the license file. The notice at the top
of each file looks like the following: of each file looks like the following:
#------------------------------------------------------------------- #-------------------------------------------------------------------
# WebGUI is Copyright 2001-2009 Plain Black Corporation. # WebGUI is Copyright 2001-2012 Plain Black Corporation.
#------------------------------------------------------------------- #-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license # Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using # (docs/license.txt) that came with this distribution before using

View file

@ -1,38 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Site Down For Maintenance</title>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT">
<style type="text/css">
.text {
position: absolute;
z-index: 10;
font-family: georgia, verdana, helvetica, arial, sans-serif;
font-weight: bold;
color: white;
top: 40%;
width: 95%;
text-align: center;
text-shadow: black 2px 2px 2px; /* safari */
filter:progid:DXImageTransform.Microsoft.dropshadow(offX=1, offY=1, color='black', positive='true') /* ie */
}
.header {
font-size: 30px;
}
.body {
background-color: #6974DE;
}
</style>
</head>
<body>
<div class="text">
<div class="header">Maintenance</div>
<p> This site is currently undergoing maintenance. Please check back again shortly. </p>
</div>
<img src="/extras/background.jpg" border="0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 5;" />
</body>
</html>

429
docs/migration.txt Normal file
View file

@ -0,0 +1,429 @@
WebGUI 8 Migration Guide
------------------------
The information contained herein documents the API changes that have occurred
in the WebGUI 8 development effort and how to migrate your code to accomodate
the new APIs.
WebGUI::Auth
==========================
The API for new() has changed: new( $session, $userId );
editUserSettingsForm deprecated. Use editSettingsForm
editUserSettingsFormSave is deprecated. Use editSettingsFormSave
editUserForm and editSettingsForm now return WebGUI::FormBuilder objects instead of raw HTML.
deleteParams is deprecated. use delete()
deleteSingleParam is deprecated. use delete("param")
saveParams is deprecated. use update()
getParams is deprecated. use get()
init() is deprecated. Use www_view()
isAdmin, isVisitor, isRegistered are all deprecated. use user->is* instead
setCallable and isCallable are deprecated. use www_ prefix instead.
WebGUI::User
==========================
updateProfileFields is deprecated. Use update
profileField is deprecated. Use get() and update()
authInstance is deprecated. Instead instantiate the auth method and give it a
user or userId
WebGUI::Macro::AdminBar
==========================
There is no Admin Bar for normal pages. Only the admin mode can see the admin bar.
WebGUI::Macro::AdminToggle
==========================
The Admin Toggle can only enter admin mode, it cannot leave it, so there is no "Turn Off" text. The second
parameter is now the template ID.
WebGUI::Config
==============
WebGUI::Config->new has a new API. Its WebGUI root parameter has been
eliminated. It now only accepts a config file as either an absolute path, or
a path relative to WebGUI's etc directory.
my $config = WebGUI::Config->new($filename);
WebGUI::Session
===============
WebGUI::Session->open has a new API. Its WebGUI root parameter has been
eliminated. The config file it is given can be either an absolute path, or a
path relative to WebGUI's etc directory.
my $session = WebGUI::Session->open($configFile);
perldoc WebGUI::Session for more details about the arguments.
WebGUI::Session::Env
====================
WebGUI::Session::Env has been moved into WebGUI::Session::Request. A listing
of replacements and equivalents follows:
$session->env->getIp => $session->request->address
WebGUI::Session::ErrorHandler
=============================
ErrorHandler has been changed to "log" in all circumstances. $session->errorHandler no longer exists,
use $session->log. WebGUI::Session::ErrorHandler no longer exists, use WebGUI::Session::Log
WebGUI::Utility
===============
This module has been removed. It had many functions that weren't used, and others have better replacements.
formatBytes -> Number::Format::format_bytes
commify -> Number::Format::format_number
emailRegex -> Email::Valid->address()
isBetween -> <= / >=
makeArrayTabSafe -> Text::CSV_XS methods
scalarEquals -> eq
randint -> int( rand( $x ) )
isInSubnet -> Net::CIDR::Lite->new(@filters)->find($ip)
round -> sprintf '%.0f', $x
isIn -> smart match
sortHash -> sort with map
All other subs were unused and were just removed.
WebGUI::Cache
=============
WebGUI::Cache has been completely rewritten. If you were using the cache API
in the past, you'll need to update your code to reflect the changes. NOTE: you
can get a cached reference to the cache object from WebGUI::Session, which
will be substantially faster than instantiating the object yourself.
my $cache = $session->cache;
WebGUI::Asset
=============
The Asset API has been changed in small, but
significant ways. You'll need to make a few changes to your asset subclasses
to support these changes.
Definition
----------
You must migrate your asset to use the new
WebGUI::Definition::Asset class instead of the definition() method. This
executes several orders of magnitude faster, but is different in a few ways.
1) You define your definition using property and define calls, as well as
standard Moose syntax.
2) You no longer have a reference to $session, so you'll need to make sub
routine refs to to method calls. However, you cannot use sub refs on any
attributes or the following property elements: tableName.
3) You no longer have the "customDrawMethod" element. You must make custom
form controls.
4) You no longer have filters. Instead, each property has a method called
propertyName (so a property called 'title' would be title()). You can override
that to achieve the same result. You can see examples of this in Asset.pm,
look at the url and title properties.
5) Because you don't have a reference to $session, you can't internationalize
right in the definition. So property elements like "label" and "hoverHelp" are
just i18n identifiers and will automatically be run through
internationalization on calling the getFormProperties() method. To specify an
i18n identifier, place the label and namespace in an arrayref, like this:
label => ['i18n key', 'namespace'],
6) Definition's are now rigid. This means that every property needs to be
defined in the definition, and it must at least have a "fieldType" element. If
the field is to be displayed (ie: it doesn't have a noFormPost=>1 element)
then it must also at minimum have label elements. In addition, you must
specify assetName, tableName, and properties defines at minimum. Anything less
is invalid.
7) The properties attribute must be an array reference of properties. No more
Tie::IxHash.
8) The autoGenerateForms has been removed. All edit forms are autogenerated in
WebGUI 8.
9) You no longer have the "visible" element. It was a duplicate of
"noFormPost", so use "noFormPost" instead.
10) You no longer have the "displayOnly" element. Make a custom form control
instead.
11) Defaults for properties are set by the default key in the property. This
sets form defaults as well. This means that newly created Assets always have
sane defaults. Unless specifically overridden, any property can be set to
undef. This takes care of the long standing problem with sticky titles and
other fields.
12) You no longer have the "allowEmpty" element. However, you can now specify
an initial value in the "value" element, and set "default" to undef if you
want to have an initial value but allow the field to become empty or undef.
Here's an example.
use WebGUI::Definition::Asset;
extends 'WebGUI::Asset';
define assetName => 'Gadget';
define tableName => 'gadget';
define uiLevel => 5;
define icon => 'gadget.gif';
property urlToJavascript => (
fieldType => 'url',
label => ['URL to Javascript Class','Asset_Gadget'],
hoverHelp => ['URL to Javascript Class help','Asset_Gadget'],
);
property foo => (
fieldType => 'text',
noFormPost => 1,
);
property bar => (
fieldType => 'codearea',
uiLevel => 9,
label => ['Bar','Asset_Gadget'],
hoverHelp => ['Bar help','Asset_Gadget'],
builder => '_bar_builder', ##Set default using Moose's builder and lazy method
lazy => 1,
);
sub _bar_builder {
my $self = shift;
return $self->callSomeMethod;
}
property baz => (
fieldType => 'checkboxList',
label => ['Baz','Asset_Gadget'],
hoverHelp => ['Baz help','Asset_Gadget'],
default => 1,
options => \&_baz_options, ##method called when getFormProperties called, automatically lazy
);
sub _baz_options {
my ($self, $property_meta_object, $property_name) = @_;
my $session = $self->session;
my $i18n = WebGUI::International->new($session, 'Asset_Gadget');
tie my %options, 'Tie::IxHash';
%options = (
one => $i18n->get('one'),
two => $i18n->get('two'),
three => $i18n->get('three'),
);
return \%options;
}
Asset Instanciators
-------------------
Moose does not allow a dynamic class to be passed into ->new. Trying to
access an asset from the database like this:
WebGUI::Asset->new($session, $assetId, 'WebGUI::Asset::Template');
will give you back an object with class WebGUI::Asset, with some of the data from the Template.
You have two options to deal with this:
1) Brute force method
my $class = WebGUI::Asset->loadModule($asset_module_name);
my $asset = $class->new($session, $assetId);
2) Use newById
newById replaces the older, and longer, newByDynamicClass method.
my $asset = WebGUI::Asset->newById($session, $assetId);
->new itself will either lookup an asset in the database and return you an object, or build you
an object without storing the data into the database, depending on how it's called.
WebGUI::Asset::SomeClass->new($session, $assetId, $revisionDate) will try to look up the requested object
of type SomeClass, populated with information from the database.
WebGUI::Asset::SomeClass->new($propertyHashRef) will return you an object of type SomeClass populated
with the properties you have passed in. Missing properties will have default set from the definition.
Asset & Moose
-------------
The update method for Asset's now comes from WebGUI::Definition::Role::Object. Since the Asset base
class does not have an update method, you cannot use Moose's "override" method modifier to add
behavior to it. You must use "around" instead. Note, in most cases, you should never need
to do this, because it is much more modular to use modifiers on individual asset properties.
Exceptions
----------
All Asset instanciators, new, newById, newByUrl, newPending, newByPropertyHashRef throw exceptions instead
of returning undef to indicate an error. You should wrap any call to an instanciator in an eval, and catch
any exceptions that are thrown and deal with them.
my $asset = eval { WebGUI::Asset->newById($session, $assetId); };
if (my $exception = Exception::Class->caught() ) {
##Log or handle the exception. Exceptions can also be rethrown to be passed farther up the call chain.
}
Removed Methods
---------------
assetDbProperties - Simply instanciate the asset if you want it's properties.
assetExists - Simply instanciate the asset if you want to know if it exists.
getValue - Use get() or the individual property accessors instead.
fixTitle - The title() method does what this used to do as the title is set.
fixUrlFromParent - This functionality is built into fixUrl, so that all fixes happen and can't cause breakages.
fixId - Never assign the asset anything other than a GUID.
Asset API
----------
->get will still work, but will be slightly slower since inside it calls the direct Moose accessor. Similarly,
getId is slightly slower than ->assetId.
processPropertiesFromFormPost
-----------------------------
Absurdly long and non-descriptive name, changed to processEditForm
Admin Controls
--------------------
The admin controls are now added to the asset with javascript. This javascript
is located in www/extras/admin/toolbar.js
Turn Admin On
--------------------
There is no Turn Admin On. In order to maintain some backwards compatibility,
if you are a member of the Turn Admin On group, "Admin On" will be set when you
log in.
www_add/www_edit
--------------------
www_add is now its own page, it is no longer handled by www_edit. www_addSave
is also its own page, it is no longer handled by www_addSave.
If you had previously overrode www_edit to provide a template, you must move
that code into an overridden getEditTemplate. See WebGUI::Asset::Event,
WebGUI::Asset::Post, WebGUI::Asset::Wobject::GalleryAlbum for examples.
Lineage
--------------------
Assets created for use during www_add do NOT have a lineage. Calling
getLineage on them will return assets from below the root asset, and not
the child. See WebGUI::Asset::Wobject::GalleryAlbum::getFileIds.
WebGUI::Shop::Vendor
====================
Object properties are no longer written to the database when an object is
created from scratch. The write method needs to be called.
WebGUI::Shop::AddressBook
=========================
Since create is now really new, there is no way to create an address book for
an arbitrary userId. To work around this, update the address book with the
new userId after it has been created.
WebGUI::Shop::PayDriver
=======================
getEditForm now returns a WebGUI::FormBuilder object
WebGUI::Shop::ShipDriver
========================
getEditForm now returns a WebGUI::FormBuilder object
WebGUI::Shop::TaxDriver
=======================
getConfigurationScreen is now called getEditForm and should return a WebGUI::FormBuilder object
WebGUI::Shop::Address
=====================
Object properties are no longer written to the database when an object is
created from scratch. The write method needs to be called.
WebGUI::Shop::Transaction
=========================
Object properties are no longer written to the database when an object is
created from scratch. The write method needs to be called.
WebGUI::Shop::TransactionItem
=============================
Object properties are no longer written to the database when an object is
created from scratch. The write method needs to be called.
WebGUI::Shop::CartItem
=============================
Object properties are no longer written to the database when an object is
created from scratch. The write method needs to be called.
Inventory adjust is also no longer done when an object is created from
scratch. You will need to call onAdjustQuantityInCart manually.
WebGUI::URL
==========================
In WebGUI 8, URL handlers are now done as Plack middleware. See
WebGUI::Middleware::Snoop and WebGUI::Middleware::WGAccess for examples.
WebGUI::Session::Var
==========================
WebGUI::Session::Var was removed, and all of its code merged into
WebGUI::Session. Any call that used to be made to $session->var should now go
directly to $session.
WebGUI::Session::Http
==========================
getStatus and setStatus have been removed. To set or get the status of an HTTP response
generated by WebGUI, access the WebGUI::Response object in the session:
OLD: $session->http->getStatus();
NEW: $session->response->status();
OLD: $session->http->setStatus(200);
NEW: $session->response->status(200);
getMimeType and setMimeType have been removed. To set or get the content type of an HTTP response
generated by WebGUI, access the WebGUI::Response object in the session:
OLD: $session->http->getMimeType();
NEW: $session->response->content_type();
OLD: $session->http->setMimeType('application/json');
NEW: $session->response->content_type('application/json');
getFilename and setFilename have been removed. To set the filename that should be
uploaded to the user, access the WebGUI::Response object in the session. First, set
the header for the Content-Dispostion, then set the content type.
OLD: $session->http->setFilename($filename);
NEW: $session->response->header( 'Content-Disposition' => qq{attachment; filename="}.$filename.'"');
$session->response->content_type('application/octet-stream');
getRedirectLocation and setRedirectLocation have been removed. These methods were not
used outside of WebGUI::Session::Http, but were designed for object encapsulation
inside the object. If you need to directly set or access the redirect location,
use the location mutator in the WebGUI::Response object in the session.
OLD: $session->http->setRedirectLocation($url);
NEW: $session->response->location($url);
OLD: $session->http->getRedirectLocation();
NEW: $session->response->location();
ifModifiedSince was moved from WebGUI::Session::Http to WebGUI::Session::Request.
OLD: $session->http->ifModifiedSince;
NEW: $session->request->ifModifiedSince;
WebGUI::Workflow::Activity
==========================
getEditForm now returns a WebGUI::FormBuilder object
Show Performance Indicators
==========================
This setting is removed, as the Plack debug console shows this for us.
WebGUI::Asset::Wobject::Survey
==========================
The surveyJSON method conflicted with the new Moose accessor. In WebGUI 8,
the old surveyJSON is called getSurveyJSON.

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,16 @@
This is a running list of template changes made during upgrades. If you have copied the default This is a running list of template changes made during upgrades. If you have copied the default
templates, you will need to apply these changes manually to your copies. templates, you will need to apply these changes manually to your copies.
8.0
* Account Macro template variables renamed:
account.url => account_url
account.text => account_text
* AdminToggle Macro template variables renamed:
toggle.url => toggle_url
toggle.text => toggle_text
7.10.22 7.10.22
* Thingy CSS file - root/import/thingy-templates/thingy.css * Thingy CSS file - root/import/thingy-templates/thingy.css
Add CSS to make sure that overflows are visible, to handle style that hide overflow by default. Add CSS to make sure that overflows are visible, to handle style that hide overflow by default.

View file

@ -1,126 +0,0 @@
#!/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;
my $toVersion = "0.0.0"; # make this match what version you're going to
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
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;
#}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------
# Add a package to the import node
sub addPackage {
my $session = shift;
my $file = shift;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
return;
}
#-------------------------------------------------
sub start {
my $configFile;
$|=1; #disable output buffering
GetOptions(
'configFile=s'=>\$configFile,
'quiet'=>\$quiet
);
if ($toVersion eq "0.0.0") {
die "toVersion=$toVersion, aborting upgrade\n";
}
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',".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

View file

@ -1,223 +0,0 @@
#!/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;
my $toVersion = '7.10.1';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
uniqueProductLocations($session);
removeBadSpanishFile($session);
i18nForAddonsTitle($session);
finish($session); # this line required
#----------------------------------------------------------------------------
# Describe what our function does
sub uniqueProductLocations {
my $session = shift;
print "\tMake sure each Product revision has its own storage location... " unless $quiet;
use WebGUI::Asset::Sku::Product;
my $get_product = WebGUI::Asset::Sku::Product->getIsa($session);
# and here's our code
PRODUCT: while (1) {
my $product = eval { $get_product->(); };
next PRODUCT if Exception::Class->caught();
last PRODUCT unless $product;
next PRODUCT unless $product->getRevisionCount > 1;
my $products = $product->getRevisions;
##We already have the first revision, so remove it.
shift @{ $products };
foreach my $property (qw/image1 image2 image3 brochure manual warranty/) {
##Check each property. If there's a duplicate, then make copy of the storage location and update the older version.
foreach my $revision (@{ $products }) {
if ($revision->get($property) eq $product->get($property)) {
$product->_duplicateFile($revision, $property,);
}
}
}
}
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# This internationalizes the link text of the addons link in the adminconsole
sub i18nForAddonsTitle {
my $session = shift;
print "\tInternationalize the text of the addons link in the adminconsole... " unless $quiet;
$session->config->set('adminConsole/addons',
{
icon => "addons.png",
uiLevel => 1,
group => "12",
url => "http://www.webgui.org/addons",
title => "^International(Addons title,WebGUI);"
}
);
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub removeBadSpanishFile {
my $session = shift;
print "\tRemove a bad Spanish translation file... " unless $quiet;
use File::Spec;
unlink File::Spec->catfile($webguiRoot, qw/lib WebGUi i18n Spanish .pm/);
# and here's our code
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Repack all templates since the packed columns may have been wiped out due to the bug.
sub repackTemplates {
my $session = shift;
print "\tRepacking all templates, this may take a while..." unless $quiet;
my $sth = $session->db->read( "SELECT assetId, revisionDate FROM template" );
while ( my ($assetId, $revisionDate) = $sth->array ) {
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId, $revisionDate );
next unless $asset;
$asset->update({
template => $asset->get('template'),
});
}
print "DONE!\n" unless $quiet;
print "\tRepacking head tags in all assets, this may take a while..." unless $quiet;
$sth = $session->db->read( "SELECT assetId, revisionDate FROM assetData where usePackedHeadTags=1" );
while ( my ($assetId, $revisionDate) = $sth->array ) {
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId, $revisionDate );
next unless $asset;
$asset->update({
extraHeadTags => $asset->get('extraHeadTags'),
});
}
print "DONE!\n" unless $quiet;
print "\tRepacking all snippets, this may take a while..." unless $quiet;
$sth = $session->db->read( "SELECT assetId, revisionDate FROM snippet" );
while ( my ($assetId, $revisionDate) = $sth->array ) {
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId, $revisionDate );
next unless $asset;
$asset->update({
snippet => $asset->get('snippet'),
});
}
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# 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;
#}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------
# Add a package to the import node
sub addPackage {
my $session = shift;
my $file = shift;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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);
repackTemplates( $session );
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".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

View file

@ -1,124 +0,0 @@
#!/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::Inbox;
my $toVersion = '7.10.2';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
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;
#}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------
# Add a package to the import node
sub addPackage {
my $session = shift;
my $file = shift;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,123 +0,0 @@
#!/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;
my $toVersion = '7.10.11';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
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;
#}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------
# Add a package to the import node
sub addPackage {
my $session = shift;
my $file = shift;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,189 +0,0 @@
#!/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;
my $toVersion = '7.10.12';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
installNewDashboardTables($session);
addStockDataCacheColumn($session);
addWeatherDataCacheColumn($session);
addLastModifiedByMacro($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;
#}
#----------------------------------------------------------------------------
# Describe what our function does
sub addLastModifiedByMacro {
my $session = shift;
print "\tAdd LastModifiedBy macro to the config file... " unless $quiet;
# and here's our code
$session->config->addToHash('macros', 'LastModifiedBy', 'LastModifiedBy');
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub installNewDashboardTables {
my $session = shift;
print "\tInstall new Dashboard tables... " unless $quiet;
$session->db->write(<<EOSQL);
CREATE TABLE IF NOT EXISTS Dashboard_dashlets (
dashboardAssetId CHAR(22) BINARY,
dashletAssetId CHAR(22) BINARY,
isStatic BOOLEAN,
isRequired BOOLEAN,
PRIMARY KEY (dashboardAssetId, dashletAssetId)
) TYPE=MyISAM CHARSET=utf8;
EOSQL
$session->db->write(<<EOSQL);
CREATE TABLE IF NOT EXISTS Dashboard_userPrefs (
dashboardAssetId CHAR(22) BINARY,
dashletAssetId CHAR(22) BINARY,
userId CHAR(22) BINARY,
isMinimized BOOLEAN,
properties LONGTEXT,
PRIMARY KEY (dashboardAssetId, dashletAssetId, userId)
) TYPE=MyISAM CHARSET=utf8;
EOSQL
# and here's our code
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub addStockDataCacheColumn {
my $session = shift;
print "\tAdd cache column for the StockData asset... " unless $quiet;
$session->db->write(<<EOSQL);
ALTER TABLE StockData ADD COLUMN cacheTimeout BIGINT
EOSQL
# and here's our code
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub addWeatherDataCacheColumn {
my $session = shift;
print "\tAdd cache column for the WeatherData asset... " unless $quiet;
$session->db->write(<<EOSQL);
ALTER TABLE WeatherData ADD COLUMN cacheTimeout BIGINT
EOSQL
# and here's our code
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;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,165 +0,0 @@
#!/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;
my $toVersion = '7.10.13';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
addAutoPlayToCarousel( $session );
addProcessorDropdownToSnippet( $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;
#}
#----------------------------------------------------------------------------
# Add AutoPlay fields to the Carousel
sub addAutoPlayToCarousel {
my $session = shift;
print "\tAdding Auto Play to Carousel... " unless $quiet;
$session->db->write(
"ALTER TABLE Carousel ADD COLUMN autoPlay INT, ADD COLUMN autoPlayInterval INT"
);
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub addProcessorDropdownToSnippet {
my $session = shift;
my $db = $session->db;
print "\tUpdating the Snippet table to add templateProcessor option..."
unless $quiet;
my $rows = $db->buildArrayRefOfHashRefs(q{
select assetId, revisionDate from snippet where processAsTemplate = 1
});
$db->write(q{
alter table snippet
drop column processAsTemplate,
add column templateParser char(255)
});
my $default = $session->config->get('defaultTemplateParser');
for my $row (@$rows) {
$db->write(q{
update snippet
set templateParser = ?
where assetId = ? and revisionDate = ?
}, [ $default, $row->{assetId}, $row->{revisionDate} ]);
}
print "Done!\n";
}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------
# Add a package to the import node
sub addPackage {
my $session = shift;
my $file = shift;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,191 +0,0 @@
#!/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::Asset::Wobject::Calendar;
my $toVersion = '7.10.14';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
addOrganizationsToTransaction($session);
removeDuplicateUndergroundStyleTemplates($session);
addRichEditToCarousel($session);
fixBadCalendarFeedStatus($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;
#}
#----------------------------------------------------------------------------
# Describe what our function does
sub fixBadCalendarFeedStatus {
my $session = shift;
print "\tFix the name of the iCal status field in all Calendar assets... " unless $quiet;
# and here's our code
my $fetch_calendar = WebGUI::Asset::Wobject::Calendar->getIsa($session);
my $sth = $session->db->read('select assetId, revisionDate from Calendar');
CALENDAR: while (my ($assetId, $revisionDate) = $sth->array) {
my $calendar = eval {WebGUI::Asset->new($session, $assetId, 'WebGUI::Asset::Wobject::Calendar', $revisionDate)};
next CALENDAR if !$calendar;
FEED: foreach my $feed ( @{ $calendar->getFeeds } ) {
my $status = delete $feed->{status};
if (!exists $feed->{lastResult}) {
$feed->{lastResult} = $status;
}
if (!exists $feed->{lastUpdated}) {
$feed->{lastUpdated} = 'never';
}
$calendar->setFeed($feed->{feedId}, $feed);
}
}
$sth->finish;
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub addOrganizationsToTransaction {
my $session = shift;
print "\tAdd organization fields to the addresses stored in the Transaction and TransactionItem... " unless $quiet;
# and here's our code
$session->db->write('ALTER TABLE transaction ADD COLUMN shippingOrganization CHAR(35)');
$session->db->write('ALTER TABLE transaction ADD COLUMN paymentOrganization CHAR(35)');
$session->db->write('ALTER TABLE transactionItem ADD COLUMN shippingOrganization CHAR(35)');
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub removeDuplicateUndergroundStyleTemplates {
my $session = shift;
print "\tRemove duplicate Underground Style templatess that were mistakenly added during the 7.10.13 upgrade... " unless $quiet;
# and here's our code
ASSETID: foreach my $assetId(qw/IeFioyemW2Ov-hFGFwD75A niYg8Da1sULTQnevZ8wYpw/) {
my $asset = WebGUI::Asset->newByDynamicClass($session, $assetId);
next ASSETID unless $asset;
$asset->purge; ##Kill it, crush it, grind its bits into dust.
}
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub addRichEditToCarousel {
my $session = shift;
print "\tAdd RichEdit option to the Carousel... " unless $quiet;
# and here's our code
$session->db->write('ALTER TABLE Carousel ADD COLUMN richEditor CHAR(22) BINARY');
$session->db->write(q!update Carousel set richEditor='PBrichedit000000000001'!);
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;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,160 +0,0 @@
#!/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::AssetAspect::Installable;
use WebGUI::Asset::MapPoint;
use WebGUI::Asset::Wobject::Thingy;
my $toVersion = '7.10.15';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
alterAssetIndexTable($session);
reindexAllThingys($session);
WebGUI::AssetAspect::Installable::upgrade("WebGUI::Asset::MapPoint",$session);
addRenderThingDataMacro($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 addRenderThingDataMacro {
my $session = shift;
print "\tAdd the new RenderThingData macro to the site config... " unless $quiet;
$session->config->addToHash('macros', 'RenderThingData', 'RenderThingData');
print "DONE!\n" unless $quiet;
}
sub alterAssetIndexTable {
my $session = shift;
print "\tExtend the assetIndex table so we can search things other than assets... " unless $quiet;
$session->db->write(<<EOSQL);
alter table assetIndex
drop primary key,
add column subId char(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
add primary key (assetId, url)
EOSQL
print "DONE!\n" unless $quiet;
}
sub reindexAllThingys {
my $session = shift;
print "\tReindex all Thingys... " unless $quiet;
my $get_thingy = WebGUI::Asset::Wobject::Thingy->getIsa($session);
THINGY: while (1) {
my $thingy = eval { $get_thingy->() };
next THINGY if Exception::Class->caught();
last THINGY unless $thingy;
$thingy->indexContent;
}
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;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,135 +0,0 @@
#!/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;
my $toVersion = '7.10.16';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
addAssetPropertyMacro($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 addAssetPropertyMacro {
my $session = shift;
my $c = $session->config;
my $hash = $c->get('macros');
unless (grep { $_ eq 'AssetProperty' } values %$hash) {
print "\tAdding AssetProperty macro... " unless $quiet;
$c->set('macros/AssetProperty' => 'AssetProperty');
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;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,139 +0,0 @@
#!/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;
my $toVersion = '7.10.17';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
createThingyDBColumns($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;
#}
#----------------------------------------------------------------------------
# Creates new column in tables for Thingy_fields and Thingy_things
sub createThingyDBColumns {
my $session = shift;
print "\tAdding db. columns Thingy_fields.isUnique and Thingy_things.maxEntriesTotal.." unless $quiet;
# and here's our code
my %tfHash = $session->db->quickHash("show columns from Thingy_fields where Field='isUnique'");
my %ttHash = $session->db->quickHash("show columns from Thingy_things where Field='maxEntriesTotal'");
unless ( $tfHash{'Field'}) { $session->db->write("alter table Thingy_fields add isUnique int(1) default 0"); }
unless ( $ttHash{'Field'}) { $session->db->write("alter table Thingy_things add maxEntriesTotal int default null"); }
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;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,172 +0,0 @@
#!/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;
my $toVersion = '7.10.18';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
addAssetManagerSortPreferences($session);
finish($session); # this line required
#----------------------------------------------------------------------------
sub addAssetManagerSortPreferences {
my $cn = 'assetManagerSortColumn';
my $on = 'assetManagerSortDirection';
unless (WebGUI::ProfileField->new($session, $cn)) {
print 'Adding Asset Manager Sort Column profile field...'
unless $quiet;
WebGUI::ProfileField->create($session, $cn => {
label =>
"WebGUI::International::get('$cn label', 'Account_Profile')",
protected => 1,
fieldType => 'selectBox',
dataDefault => 'lineage',
possibleValues => <<'VALUES',
{
lineage => WebGUI::International::get('rank', 'Asset'),
title => WebGUI::International::get(99, 'Asset'),
className => WebGUI::International::get('type', 'Asset'),
revisionDate => WebGUI::International::get('revision date', 'Asset'),
assetSize => WebGUI::International::get('size', 'Asset'),
lockedBy => WebGUI::International::get('locked', 'Asset'),
}
VALUES
}, 4);
print "Done!\n" unless $quiet;
}
unless (WebGUI::ProfileField->new($session, $on)) {
print 'Adding Asset Manager Sort Direction profile field...'
unless $quiet;
WebGUI::ProfileField->create($session, $on => {
label =>
"WebGUI::International::get('$on label', 'Account_Profile')",
protected => 1,
fieldType => 'selectBox',
dataDefault => 'asc',
possibleValues => <<'VALUES',
{
asc => WebGUI::International::get('ascending', 'Account_Profile'),
desc => WebGUI::International::get('descending', 'Account_Profile'),
}
VALUES
}, 4);
print "Done!\n" unless $quiet;
}
}
#----------------------------------------------------------------------------
# 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;
#}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------
# Add a package to the import node
sub addPackage {
my $session = shift;
my $file = shift;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,177 +0,0 @@
#!/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::Asset::Wobject::Calendar;
use Exception::Class;
my $toVersion = '7.10.19';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
addTicketLimitToBadgeGroup( $session );
fixBrokenCalendarFeedUrls ( $session );
removeUndergroundUserStyleTemplate ( $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;
#}
# Fix calendar feed urls that had adminId attached to them until they blew up
sub fixBrokenCalendarFeedUrls {
my $session = shift;
print "\tChecking all calendar feed URLs for adminId brokenness... " unless $quiet;
my $getCalendar = WebGUI::Asset::Wobject::Calendar->getIsa($session);
CALENDAR: while (1) {
my $calendar = eval { $getCalendar->(); };
next CALENDAR if Exception::Class->caught;
last CALENDAR unless $calendar;
FEED: foreach my $feed (@{ $calendar->getFeeds }) {
$feed->{url} =~ s/adminId=[^;]{22};?//g;
$feed->{url} =~ s/\?$//;
$calendar->setFeed($feed->{feedId}, $feed);
}
}
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Add a ticket limit to badges in a badge group
sub removeUndergroundUserStyleTemplate {
my $session = shift;
print "\tRemove Underground User Style template... " unless $quiet;
if ($session->setting->get('userFunctionStyleId') eq 'zfDnOJgeiybz9vnmoEXRXA') {
$session->setting->set('userFunctionStyleId', 'Qk24uXao2yowR6zxbVJ0xA');
}
my $underground_user = WebGUI::Asset->newByDynamicClass($session, 'zfDnOJgeiybz9vnmoEXRXA');
if ($underground_user) {
$underground_user->purge;
}
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Add a ticket limit to badges in a badge group
sub addTicketLimitToBadgeGroup {
my $session = shift;
print "\tAdd ticket limit to badge groups... " unless $quiet;
# Make sure it hasn't been done already...
my $columns = $session->db->buildHashRef('describe EMSBadgeGroup');
use List::MoreUtils qw(any);
if(!any { $_ eq 'ticketsPerBadge' } keys %{$columns}) {
$session->db->write(q{
ALTER TABLE EMSBadgeGroup ADD COLUMN `ticketsPerBadge` INTEGER
});
}
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;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,147 +0,0 @@
#!/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;
my $toVersion = '7.10.20';
my $quiet; # this line required
my $session = start(); # this line required
addFormFieldMacroToConfig();
# upgrade functions go here
fixSpacesInTaxInfo ( $session );
sub addFormFieldMacroToConfig {
print "\tAdd FormField macro to config... " unless $quiet;
$session->config->addToHash( 'macros', FormField => 'FormField' );
print "DONE!\n" unless $quiet;
}
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;
#}
#----------------------------------------------------------------------------
# Fix calendar feed urls that had adminId attached to them until they blew up
sub fixSpacesInTaxInfo {
my $session = shift;
print "\tRemoving spaces around commas in generic tax rate information... " unless $quiet;
use WebGUI::Shop::TaxDriver::Generic;
my $taxer = WebGUI::Shop::TaxDriver::Generic->new($session);
my $taxIterator = $taxer->getItems;
while (my $taxInfo = $taxIterator->hashRef) {
my $taxId = $taxInfo->{taxId};
$taxer->add($taxInfo); ##Automatically removes spaces now.
$taxer->delete({taxId => $taxId});
}
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;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,172 +0,0 @@
#!/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;
my $toVersion = '7.10.3';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
pruneInboxMessagesFromDeletedUsers($session);
addTemplateToNotifyAboutVersionTag($session);
addPasswordRecoveryEmailTemplate($session);
finish($session); # this line required
#----------------------------------------------------------------------------
# Describe what our function does
sub pruneInboxMessagesFromDeletedUsers {
my $session = shift;
print "\tPruning inbox messages from deleted users. This may take a while... " unless $quiet;
my $sth = $session->db->prepare(<<EOSQL);
select messageId, inbox.userId
from inbox_messageState
join inbox using (messageId)
left outer join users on inbox.userId=users.userId
where users.userId IS NULL
EOSQL
$sth->execute([]);
use WebGUI::Inbox;
my $inbox = WebGUI::Inbox->new($session);
while (my ($messageId, $userId) = $sth->array) {
my $message = $inbox->getMessage($messageId, $userId);
if ($message) {
$message->delete;
}
}
print "...DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub addTemplateToNotifyAboutVersionTag {
my $session = shift;
print "\tAdd template to Notify About Version Tag workflow activities." unless $quiet;
use WebGUI::Workflow::Activity;
use WebGUI::Workflow::Activity::NotifyAboutVersionTag;
my $templateId = WebGUI::Workflow::Activity::NotifyAboutVersionTag->definition($session)->[0]->{properties}->{templateId}->{defaultValue};
my $activityList = $session->db->read(q|select activityId from WorkflowActivity|);
while (my ($activityId) = $activityList->array) {
my $activity = WebGUI::Workflow::Activity->new($session, $activityId);
next unless $activity;
next unless $activity->isa('WebGUI::Workflow::Activity::NotifyAboutVersionTag')
|| $activity->isa('WebGUI::Workflow::Activity::RequestApprovalForVersionTag')
;
$activity->set('templateId', $templateId);
}
print "...DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub addPasswordRecoveryEmailTemplate {
my $session = shift;
print "\tAdd a template for the password recovery email." unless $quiet;
$session->setting->add('webguiPasswordRecoveryEmailTemplate', 'sK_0zVw4kwdJ1sqREIsSzA');
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;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,146 +0,0 @@
#!/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;
my $toVersion = '7.10.21';
my $quiet; # this line required
my $session = start(); # this line required
addWaitForConfirmationWorkflow($session);
addCreateUsersEnabledSetting($session);
finish($session); # this line required
#----------------------------------------------------------------------------
sub addWaitForConfirmationWorkflow {
my $session = shift;
my $c = $session->config;
my $exists = $c->get('workflowActivities/WebGUI::User');
my $class = 'WebGUI::Workflow::Activity::WaitForUserConfirmation';
unless (grep { $_ eq $class } @$exists) {
print "Adding WaitForUserConfirmation workflow..." unless $quiet;
$c->addToArray('workflowActivities/WebGUI::User' => $class);
print "Done!\n" unless $quiet;
}
}
#----------------------------------------------------------------------------
sub addCreateUsersEnabledSetting {
my $session = shift;
my $s = $session->setting;
my $name = 'enableUsersAfterAnonymousRegistration';
return if $s->has($name);
print "Adding $name setting..." unless $quiet;
$s->add($name => 1);
print "Done!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# 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;
#}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------
# Add a package to the import node
sub addPackage {
my $session = shift;
my $file = shift;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,200 +0,0 @@
#!/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;
my $toVersion = '7.10.22';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
addAuthorizePaymentDriver($session);
createAddressField($session);
addLinkedProfileAddress($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;
#}
#----------------------------------------------------------------------------
# Add the Authorize.net payment driver to each config file
sub addAuthorizePaymentDriver {
my $session = shift;
print "\tAdd the Authorize.net payment driver... " unless $quiet;
# and here's our code
$session->config->addToArray('paymentDrivers', 'WebGUI::Shop::PayDriver::CreditCard::AuthorizeNet');
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub addLinkedProfileAddress {
my $session = shift;
print "\tAdding linked profile addresses for existing users... " unless $quiet;
my $users = $session->db->read( q{ select userId from users } );
use WebGUI::User;
use WebGUI::Shop::AddressBook;
while (my ($userId) = $users->array()) {
#check to see if there is user profile information available
next if $userId eq '1' or $userId eq '3';
last unless $userId;
my $u = WebGUI::User->new($session,$userId);
#skip if user does not have any homeAddress fields filled in
next unless (
$u->profileField("homeAddress")
|| $u->profileField("homeCity")
|| $u->profileField("homeState")
|| $u->profileField("homeZip")
|| $u->profileField("homeCountry")
|| $u->profileField("homePhone")
);
#Get the address book for the user (one is created if it does not exist)
my $addressBook = WebGUI::Shop::AddressBook->newByUserId($session,$userId);
#Add the profile address for the user
$addressBook->addAddress({
label => "Profile Address",
firstName => $u->profileField("firstName"),
lastName => $u->profileField("lastName"),
address1 => $u->profileField("homeAddress"),
city => $u->profileField("homeCity"),
state => $u->profileField("homeState"),
country => $u->profileField("homeCountry"),
code => $u->profileField("homeZip"),
phoneNumber => $u->profileField("homePhone"),
email => $u->profileField("email"),
isProfile => 1,
});
}
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub createAddressField {
my $session = shift;
#skip if field exists
my $columns = $session->db->buildArrayRef("show columns from address where Field='isProfile'");
return if(scalar(@$columns));
print "\tAdding profile link to Address... " unless $quiet;
$session->db->write( q{
alter table address add isProfile tinyint default 0
} );
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;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,141 +0,0 @@
#!/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;
my $toVersion = '7.10.23';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
fixBadTemplateAttachments($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 fixBadTemplateAttachments {
my $session = shift;
print "\tRemove template attachements in search templates that refer to an old, deleted CSS snippet... " unless $quiet;
# and here's our code
use WebGUI::Asset::Template;
my $get_template = WebGUI::Asset::Template->getIsa($session);
TEMPLATE: while (1) {
my $template = eval {$get_template->()};
next TEMPLATE if Exception::Class->caught;
last TEMPLATE unless $template;
next TEMPLATE unless $template->get('namespace') eq 'Search';
$template->removeAttachments(['^/(webgui.css);']);
}
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;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

View file

@ -1,183 +0,0 @@
#!/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;
my $toVersion = '7.10.24';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
addPALastLogTable($session);
addForkRedirect($session);
extendBucketName($session);
fixSurveyQuestionTypes($session);
finish($session); # this line required
#----------------------------------------------------------------------------
# Describe what our function does
sub addPALastLogTable {
my $session = shift;
print "\tAdd a table to keep track of additional Passive Analytics data... " unless $quiet;
# and here's our code
$session->db->write(<<EOSQL);
CREATE TABLE IF NOT EXISTS `PA_lastLog` (
`userId` char(22) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`assetId` char(22) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`sessionId` char(22) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`timeStamp` bigint(20) DEFAULT NULL,
`url` char(255) NOT NULL,
PRIMARY KEY (userId, sessionId)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
EOSQL
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub addForkRedirect {
my $session = shift;
print "\tAdd a column to Fork to keep track of late generated redirect URLs... " unless $quiet;
# and here's our code
$session->db->write(<<EOSQL);
ALTER TABLE Fork add column redirect CHAR(255);
EOSQL
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub extendBucketName {
my $session = shift;
print "\tExtend the size of the bucket name in the bucketLog table for Passive Analytics... " unless $quiet;
# and here's our code
$session->db->write(<<EOSQL);
ALTER TABLE bucketLog CHANGE COLUMN Bucket Bucket CHAR(255)
EOSQL
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub fixSurveyQuestionTypes {
my $session = shift;
print "\tFix bad custom Question Types in the Survey... " unless $quiet;
# and here's our code
$session->db->write(<<EOSQL);
update Survey_questionTypes set answers="{}" where answers like 'HASH%';
EOSQL
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# 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;
#}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------
# Add a package to the import node
sub addPackage {
my $session = shift;
my $file = shift;
print "\tUpgrading package $file\n" unless $quiet;
# 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 = eval {
my $node = WebGUI::Asset->getImportNode($session);
$node->importPackage( $storage, {
overwriteLatest => 1,
clearPackageFlag => 1,
setDefaultTemplate => 1,
} );
};
if ($package eq 'corrupt') {
die "Corrupt package found in $file. Stopping upgrade.\n";
}
if ($@ || !defined $package) {
die "Error during package import on $file: $@\nStopping upgrade\n.";
}
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',".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

Some files were not shown because too many files have changed in this diff Show more