phpPgAds   Home  

 

 

 

  2.3 Upgrading from a previous version  

 

Updates, Upgrades, and changes should never be performed in a production environment without careful testing on a staging server.

 
   
  2.3.1 phpPgAds 2.0 beta 1 to CVS  

 


Run this code in a psql session or from phpPgAdmin:

ALTER TABLE phpads_banners ADD column status varchar(255);

 


Changes

???


Important
???

 

 
   
  2.3.2 phpPgAds 1.0 to 2.0 beta 1  

 


Many features were added, so you will have to recreate all tables. Don't delete older ones, as table names are changed and you will be able to reload your data.

Run this code in a psql session or from phpPgAdmin:

CREATE SEQUENCE phpads_clients_clientid_seq;

CREATE TABLE phpads_clients (
clientid int8 NOT NULL DEFAULT nextval('phpads_clients_clientid_seq')::int8,
clientname varchar(255) NOT NULL,
contact varchar(255),
email varchar(64),
views int2,
clicks int2,
clientusername varchar(64),
clientpassword varchar(64),
expire date,
activate date,
permissions int2,
language varchar(64),
active boolean,
weight int2 default 1,
parent int8 DEFAULT 0 NOT NULL,
report boolean,
reportinterval int4 DEFAULT 7,
reportlastdate date,
reportdeactivate boolean,
PRIMARY KEY (clientid)
);

CREATE SEQUENCE phpads_banners_bannerid_seq;

CREATE TABLE phpads_banners (
bannerid int8 NOT NULL DEFAULT nextval('phpads_banners_bannerid_seq')::int8,
clientid int8 DEFAULT 0 NOT NULL,
banner text,
width int2 DEFAULT 0 NOT NULL,
height int2 DEFAULT 0 NOT NULL,
format varchar (4) DEFAULT 'gif' NOT NULL, -- enum('gif','jpeg','png','html','url','web')
url varchar(255) NOT NULL,
alt varchar(255) NOT NULL,
keyword varchar(255) NOT NULL,
bannertext varchar(255) NOT NULL,
active boolean NOT NULL,
weight int2 DEFAULT 1 NOT NULL,
seq int2 DEFAULT 0 NOT NULL,
target varchar(8) DEFAULT '' NOT NULL,
description varchar(255) DEFAULT '' NOT NULL,
autohtml boolean DEFAULT 't' NOT NULL,
PRIMARY KEY (bannerid),
FOREIGN KEY (clientid) REFERENCES phpads_clients (clientid) ON UPDATE CASCADE ON DELETE CASCADE
);

CREATE INDEX phpads_banners_clientid ON phpads_banners(clientid);

CREATE TABLE phpads_adclicks (
bannerid int8 DEFAULT '0' NOT NULL,
t_stamp timestamp,
host varchar(255) NOT NULL,
FOREIGN KEY (bannerid) REFERENCES phpads_banners(bannerid) ON UPDATE CASCADE ON DELETE CASCADE
);

CREATE INDEX phpads_adclicks_bannerid ON phpads_adclicks(bannerid);

CREATE TABLE phpads_adviews (
bannerid int8 DEFAULT '0' NOT NULL,
t_stamp timestamp,
host varchar(255) NOT NULL,
FOREIGN KEY (bannerid) REFERENCES phpads_banners(bannerid) ON UPDATE CASCADE ON DELETE CASCADE
);

CREATE INDEX phpads_adviews_bannerid ON phpads_adviews(bannerid);

CREATE TABLE phpads_acls (
bannerid int8 DEFAULT 0 NOT NULL,
acl_type varchar(12) NOT NULL,
acl_data varchar(255) NOT NULL,
acl_ad boolean NOT NULL,
acl_order int8 DEFAULT 0 NOT NULL,
acl_con varchar(5),
PRIMARY KEY (bannerid, acl_order),
FOREIGN KEY (bannerid) REFERENCES phpads_banners(bannerid) ON UPDATE CASCADE ON DELETE CASCADE
);

CREATE INDEX phpads_acls_bannerid ON phpads_acls (bannerid);

CREATE TABLE phpads_adstats (
views int4 DEFAULT 0 NOT NULL,
clicks int4 DEFAULT 0 NOT NULL,
day date DEFAULT NOW() NOT NULL,
bannerid int8 DEFAULT 0 NOT NULL,
PRIMARY KEY (day, bannerid),
FOREIGN KEY (bannerid) REFERENCES phpads_banners(bannerid) ON UPDATE CASCADE ON DELETE CASCADE
);

CREATE INDEX phpads_adstats_bannerid ON phpads_acls (bannerid);

CREATE SEQUENCE phpads_zones_zoneid_seq;

CREATE TABLE phpads_zones (
zoneid int4 NOT NULL DEFAULT nextval('phpads_banners_bannerid_seq')::int8,
zonename varchar(255) NOT NULL,
zonetype int2 DEFAULT 0 NOT NULL,
what oid NOT NULL,
width int2 DEFAULT 0 NOT NULL,
height int2 DEFAULT 0 NOT NULL,
retrieval varchar(16) DEFAULT 'random' NOT NULL,
cachecontents oid,
cachetimestamp int4 DEFAULT 0 NOT NULL,
PRIMARY KEY (zoneid)
);


Next you need to load your data in the new tables:

INSERT INTO phpads_clients SELECT * FROM clients ORDER BY clientid;
INSERT INTO phpads_banners SELECT * FROM banners ORDER BY bannerid;
INSERT INTO phpads_adclicks SELECT * FROM adclicks;
INSERT INTO phpads_adviews SELECT * FROM adviews;
INSERT INTO phpads_acls SELECT * FROM acls;
INSERT INTO phpads_adstats SELECT * FROM adstats;

SELECT setval('phpads_clients_clientid_seq', nextval('clients_clientid_seq') - 1);
SELECT setval('phpads_banners_bannerid_seq', nextval('banners_bannerid_seq') - 1);


Now you can safely drop old tables and sequences:

DROP TABLE clients;
DROP TABLE banners;
DROP TABLE adclicks;
DROP TABLE adviews;
DROP TABLE acls;
DROP TABLE adstats;

DROP SEQUENCE clients_clientid_seq;
DROP SEQUENCE banners_bannerid_seq;


Changes

The mail.php script is replaced by maintenance.php which is located in the maintenance directory. This script should be schedule to run EVERY day. If you are using a UNIX based system, you can do this by adding it to your cronfile. This script is needed to automatically sent reports to clients and to activate
campaigns on a certain date. If this script does not run, campaigns will not be automatically activated!

The files remotehtmlview.php, click.php and phpads.php were renamed to adjs.php, adclick.php and adview.php, which should describe their function much more clearly. The old files are still available for backwards compatibility, but could be depreciated in future versions of phpPgAds.


Important
After upgrading you should move all banners without a campaign to a new campaign. You can do this in the admin interface. If you don't move these banners to a new campaign the banner could be deactivated.