Creating/updating database tables needed by a mod

Discuss the development of future releases of phpBB (phpBB 3.x minor releases) and MODing/Coding related questions.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
John Line
New member
New member
Posts: 2
Joined: 23 Jul 2008, 13:43
Real name: John
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Creating/updating database tables needed by a mod

Postby John Line » 23 Jul 2008, 14:28

Background:

I'm working on a phpBB3 mod which will integrate our (University of Cambridge) local web single sign-on facility and our local directory service into phpBB. The authentication side is largely complete, though it needed rather a lot of small changes scattered around the core phpBB code (unavoidably, I believe, though I'll skip the details). For the directory integration, I need to add some database tables, and potentially also update the structure of those tables in future. Hence the questions below.

That would be easy if I only needed to do it for a single phpBB installation that I was running, but the modifications are being made available more widely - though only locally since they'd be no use outside the context of our authentication and directory services.

Additionally, because of the extensive changes needed to core phpBB code (several hundred lines of +/-/! lines in unified context diff, not counting totally new files), I'm not currently using the MODX format for distribution. It would be far too time-consuming and error-prone requiring people to make all those changes by hand, initially or after each upgrade to a new release of phpBB. For now, I'm distributing kits comprising edited copies of the files that are changed by the modifications (to copy in place of the original versions), necessarily with distinct kits for each phpBB release. If/when an automated MODX installer is available, that would become the preferred option. I don't know if that would simplify things in relation to the questions below, but for now it's not an option.

If anyone has suggestions for a better approach now (i.e. without a MODX installer) than simply providing modified copies of complete files, I'd certainly be interested.

The questions:

(1) I've seen the suggestion at [url]http://phpbbmodders.net/board/viewtopic.php?f=55&t=1984&p=12932&hilit=create_schema_files.php&sid=8f29bbe82d1b7e3a7a7b3b797abb0d3c#p12932[/url] to use the create_schema_files.php in the /develop folder from the CVS. But that prompts more new questions than it answers.

That suggestion was apparently in the context of adding tables during phpBB installation, but I really need solutions that will work when installing or upgrading the modifications when phpBB has already been installed.

Is that script still relevant for my rather different situation?

It's unclear how the schema files it generates would actually be used "standalone", without the phpBB installation scripts to select the right set of definitions for the database being used and do whatever was necessary to create or modify the extra tables. I'd prefer not to have to give people lengthy/confusing instructions for how to identify the right schema file and process it "by hand", rather than "run this script" and/or "access this URL" to do what's needed.

(2) While I was able to obtain a copy of create_schema_files.php from the phpBB 3.0 CVS at [url]http://area51.phpbb.com/cvs/[/url], and ran it successfully (without making any changes), the resulting schema files did not match the versions included in the phpBB 3.0.2 kit - and although I had a look around, I could not find a corresponding version of that script for phpBB 3.0.2.

That may be irrelevant if all I need is to generate schema files for the extra tables that I needed (and that may depend on how they'd actually be used to create/update the tables) - but it would certainly be important if the easiest way to get the relevant generated schema file used would involve a processing script that would expect to be dealing with definitions for all the standard phpBB tables as well as an extra ones. Where should I be looking for copies of create_schema_files.php that match the database structure for a particular phpBB release?

Those are the important questions that spring to mind at present, though maybe they are the wrong questions and I should be looking in a totally different direction for the best way to handle adding/updating tables when installing a modification, in a way that can be done by "anyone" who's running phpBB, not necessarily a PHP, phpBB, or database expert.

Any suggestions?

John

User avatar
momentum
New member
New member
Posts: 32
Joined: 28 Feb 2008, 04:54
Real name: Craig
Location: Melbourne, Australia
Contact:

Re: Creating/updating database tables needed by a mod

Postby momentum » 24 Jul 2008, 06:31


User avatar
Lord Le Brand
Website Team
Website Team
Posts: 223
Joined: 08 Sep 2006, 15:44
Real name: Leroy
Location: Parkstad, Limburg, the Netherlands (GMT+1)
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Creating/updating database tables needed by a mod

Postby Lord Le Brand » 24 Jul 2008, 12:55

The create_schema_files.php is in the SVN on http://code.phpbb.com/repositories/show/5, for phpBB 3 it's in the /branches/phpBB-3_0_0/phpBB/develop/ folder. It would most certainly be appropriate for your table creation queries. For installing them, I have based the installation script for my MOD, [url=http://phpbbmodders.net/board/viewtopic.php?f=37&t=2675]phpBB Project[/url], on phpBB's script.
Also, for installing MODX, there's Blinky: http://code.phpbb.com/repositories/show/6 :)

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Creating/updating database tables needed by a mod

Postby igorw » 26 Jul 2008, 15:55

You may want to take a look at these two articles i've written: [url=http://phpbbmodders.net/articles/3.0/create_table/]create a new table[/url] and [url=http://phpbbmodders.net/articles/3.0/dbal/]dbal[/url] (db tools). They may answer some of your questions. :)

- we're poor!

John Line
New member
New member
Posts: 2
Joined: 23 Jul 2008, 13:43
Real name: John
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Creating/updating database tables needed by a mod

Postby John Line » 18 Aug 2008, 21:10

Sorry for the delay replying, but thank you all for those suggestions - very helpful!

John

leviatan21
New member
New member
Posts: 3
Joined: 24 Nov 2008, 18:14
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Creating/updating database tables needed by a mod

Postby leviatan21 » 24 Nov 2008, 18:37

Excuse me for my poor English, I speak Spanish.

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Creating/updating database tables needed by a mod

Postby igorw » 24 Nov 2008, 20:04

If a query fails it will display an error automatically.

- we're poor!

leviatan21
New member
New member
Posts: 3
Joined: 24 Nov 2008, 18:14
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Creating/updating database tables needed by a mod

Postby leviatan21 » 24 Nov 2008, 20:19

Excuse me for my poor English, I speak Spanish.

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Creating/updating database tables needed by a mod

Postby igorw » 24 Nov 2008, 20:36

Yes.

- we're poor!

leviatan21
New member
New member
Posts: 3
Joined: 24 Nov 2008, 18:14
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Creating/updating database tables needed by a mod

Postby leviatan21 » 24 Nov 2008, 20:43

Excuse me for my poor English, I speak Spanish.


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Return to “phpBB Development discussion”

Who is online

Users browsing this forum: No registered users and 13 guests