Recent Topics

1 May 16, 2006 15:16    

Atm, _config.php loads up the basic configuration e.g. base_url, and database params, as well as loading the other /conf/ files.

So if my plugin wants to load up just the database config, by including _config.php i'm also including the rest of the /conf/ folder.

I think it should be like this;
_config.php - loads up all the /conf/ files
_basic.php - loads up the basic config. E.g. $EvoConfig->DB, base_url, etc

So with the latest CVS - 1.8 - 16/05/2006 - should look something like this;

_config.php


# IMPORTANT: you will find more parameters in the other files of the /conf folder.
# IT IS RECOMMENDED YOU DO NOT TOUCH THOSE SETTINGS
# UNTIL YOU ARE FAMILIAR WITH THE DEFAULT INSTALLATION.
#
# It is however strongly recommended you browse through these files as soon as you've
# got your basic installation working. They'll let you customize a lot of things!

# DO NOT EDIT THE FOLLOWING!

require  dirname(__FILE__).'/_basic.php';
define( 'EVO_CONFIG_LOADED', true );

@include_once dirname(__FILE__).'/_config_TEST.php';    // Put testing conf in there (For testing, you can also set $install_password here)
require_once  dirname(__FILE__).'/_advanced.php';       // advanced settings
require_once  dirname(__FILE__).'/_locales.php';        // locale settings
require_once  dirname(__FILE__).'/_formatting.php';     // formatting settings
require_once  dirname(__FILE__).'/_admin.php';          // admin settings
require_once  dirname(__FILE__).'/_stats.php';          // stats/hitlogging settings
require_once  dirname(__FILE__).'/_application.php';    // application settings
@include_once dirname(__FILE__).'/_overrides_TEST.php'; // Override for testing in there

_basic.php

/*
header('HTTP/1.0 503 Service Unavailable');
echo '<h1>503 Service Unavailable</h1>';
die( 'The site is temporarily down for maintenance.' );
*/

/**
 * @var object Holds settings.
 */
$EvoConfig = & new stdClass;

/**
 * MySQL DB settings.
 * Fill in your database details (check carefully or nothing will work!)
 */
$EvoConfig->DB = array(
	'user'     => 'root',     // your MySQL username
	'password' => 'none',     // ...and password
	'name'     => 'b2evolution',  // the name of the database
	'host'     => 'localhost',    // MySQL Server (typically 'localhost')
);


/**
 * the tables prefix (gets placed before each b2evo table name),
 * use this to have multiple installations in one DB.
 *
 * @global string $tableprefix
 */
$tableprefix = 'evo_';


/**
 * If you want to be able to reset your existing b2evolution tables and start anew
 * you must set $allow_evodb_reset to 1.
 *
 * NEVER LEAVE THIS SETTING ON ANYTHING ELSE THAN 0 (ZERO) ON A PRODUCTION SERVER.
 * IF THIS IS ON (1) AND YOU FORGET TO DELETE THE INSTALL FOLDER, ANYONE WOULD BE ABLE TO
 * ERASE YOUR B2EVOLUTION TABLES AND DATA BY A SINGLE CLICK!
 */
$allow_evodb_reset = 0;	// Set to 1 to enable. Do not leave this on 1 on production servers


/**
 * $baseurl is where your blogs reside by default. CHECK THIS CAREFULLY or nothing will work.
 * It should be set to the URL where you can find the blog templates and/or the blog stub files,
 * that means index.php, blog_b.php, etc.
 * Note: Blogs can be in subdirectories of the baseurl. However, no blog should be outside
 * of there, or some tricky things may fail (e-g: pingback)
 *
 * IMPORTANT: If you want to test b2evolution on your local machine, do NOT use that machine's
 * name in the $baseurl!
 * For example, if you machine is called HOMER, do not use http://homer/b2evolution/blogs/ !
 * Use http://localhost/b2evolution/blogs/ instead. And log in on localhost too, not homer!
 * If you don't, login cookies will not hold.
 *
 * @global string $baseurl
 */

$baseurl = 'http://localhost/site/b2evolution/blogs/';


/**
 * Your email. Will be used in severe error messages so that users can contact you.
 * You will also receive notifications for new user registrations there.
 */
$admin_email = 'balupton@gmail.com';


/**
 * Once you have edited this file to your settings, set the following to 1 (one):
 */
$config_is_done = 1;

2 May 16, 2006 16:12

I've said it already via IM: I don't think it would make it noticable faster, but would also do no harm, of course.

BUT: I always use _config_TEST.php for my installations, because it allows to easily merge/update from CVS (without conflicts) and therefor, _config_TEST.php needs to get "conditionally included" at the end of _basic.php.

Btw: I've seen already a lot of application packages, which do it like this: they have a config_sample.php file that you have to rename to config.php (or the installer creates/generates a fresh one). config.php by itself is then not under under version control (and probably even in .cvsignore/..).

3 May 16, 2006 17:26

blueyed: I've seen apps with only a sample config file, too. IMO, it does make upgrading easier, but it may not be worth the trade off because it makes installing a bit harder. I would always lean toward making the first install as easy as possible. People upgrading should know to backup their files and merge the old config file back in. It's the first time users that need the most help. But, that's just my opinion. It's a minor difference.

4 May 16, 2006 18:15

Someone will need to enlighten me on _config_TEST.php ...

5 May 16, 2006 19:31

Because cvs includes_config.php (with default "I've never been installed" settings) you can overide it with a file called _config_TEST.php.

This enables developers to keep their files synched without having to edit _config.php everytime they update.

¥

6 May 17, 2006 01:48

personman: I don't think it makes installing harder at all.. in fact, the casual user uses the /install/index.php installer and therefor does not see any files at all.

It gets more difficult with the several files we have: there would be a sample-file for all of them and all would need to get copied by the installer to the real name. The installer itself only modifies _config.php/_basic.php.

Personally I find a single conf file better, because it would be all in a single file and you would not have to think about where a particular setting might be in (I'm ignoring grep etc here purposely).

7 May 17, 2006 08:31

And me - code-noob - wants to have as mutch parameters as possible in the backoffice.
I'm speaking of these onces (I have to change them several times a week, when people in our blog are posting articles in the wrong cat etc..)

/*** Cross posting  */
$allow_cross_posting = 0;

/*** Moving chapters between blogs  */
$allow_moving_chapters = true;

/*** Default status for new posts */
$default_post_status = 'private';

Also the stuff that is in _icons.php and _stats.php

François told me allready that i's not to difficult, only a lot of dumb work.

(I'm using 1.6 and haven't even looked at cvs)

8 May 29, 2006 07:39

Just got the latest cvs, and glad to see that this has been implemented :D

9 May 29, 2006 08:13

What EXACTLY is the gain here? Near as I can figure the only difference between then and now is that the exact same parameters are split between two different files.

Y'all are getting way heavy on the bloatware. The more y'all bloat the more I think of downgrading to .9.2 and leaving it that way.

10 May 29, 2006 08:19

It's doing exactly the opposite of Bloatware.

It's so plugins, and things that are accessed directly (not through the evocore) can access only the configuration they need, instead of loading up the whole config.

Whats wrong with that?

11 May 29, 2006 08:29

And when would a plugin NOT be part of loading up the core?

Note: You still want to run 0.9.2 on heavy loaded production servers because it's still more efficient than the feature packed Phoenix releases. If you have CPU to spare on your server though, then you may want to upgrade to Phoenix in a couple of weeks.

That comes from [url=http://b2evolution.net/news/2006/05/17/b2evolution_0_9_2_sparkle_released]here[/url]. Microsoft considers their code to be 'feature packed' too, right?

So when does someone visiting your blog, and therefore experiencing all that plugins have to offer, not need to load the core files?

12 May 29, 2006 08:46

Sure the 1.x versions are not 'stable' enough for 'heavy loaded production', but they are the future of b2evo.

I requested this because when i was working on my Gallery Plugin i needed a way to load up the database config, but the only way to do so, is to load _config.php along with the rest of the configuration.
What's the point of loading the whole config when all i need is the config of the database?

What about the File Manager, why would it need the blogging classes?

Or a seperate system that just wants to extract a few post titles to use in a sidebar somewhere.

Or even a system that wants to use b2evo's user database, but not any of it's blogging stuff.

It doesn't hurt b2evo at all, so why not?

13 May 29, 2006 09:00

balupton wrote:

It doesn't hurt b2evo at all, so why not?

But it does because it's bloat. EVERY instance of loading a blog will require 2 files to do the work of one. Carried to it's extreme, every single item defined in config.php will be defined in it's own private little file to serve some tiny little goal. That'll really help when the vast majority of instances are to create a page for a visitor to view.

Wanna know another great example of bloat in b2evolution? Do a raw installation and look at blog #1 then save the source code and look at it's byte size. Now go into _main.php and remove all the tabs that precede all the lines. In fact do that for all the files in the skins/custom folder, but be careful to not remove ALL the tabs because some are serving where a space would serve equally well. Now reload the page, save the new version, and compare the byte size. Each and every tab in the source code bloats the actual product even though it makes code-junkies happy by having nice little indents to follow. I haven't done it in a while but memory tells me something like a 12% reduction in the file size sent to the visitor happens by removing the tabs that serve no purpose other than to make groovy looking .php files.

What is the point of a blog application if not to deliver a web page to a visitor? Given that, what is the point of each and every file in a blog app if not to deliver a web page to a visitor? Restated: identify a plugin that doesn't support delivering a web page to a visitor. If you can you're identifying a pointless plugin.

14 May 29, 2006 09:27

What is bloat, is having to load more than what you need even for the simplist of tasks.

What are the disadvantages right now in terms of effeciency of this change?
And are they really that bad that they outweigh advantages?

15 May 29, 2006 18:12

Fair enough.

All I was doing was pointing out that if there is no gain to the end user then what's the point? To my way of thinking it's all about page generation and delivery - even for those who claim they don't care about traffic. Therefore anything that slows down page generation and delivery detracts from the overall point. Thus I pointed out how the tabs that make the source code look good are bloat because they slow down page delivery. They won't go away, but they don't need to be there and they don't enhance the visitor's experience.

But pluginability is cool!


Form is loading...