phpDocumentor pond
[ class tree: pond ] [ index: pond ] [ all elements ]

Procedural File: _functions_create.php

Source Location: /qp_install/_functions_create.php

Page Details

This file implements creation of DB tables

Quam Plures - Released under GNU GPL License -

Author:  fplanque: Francois PLANQUE.
Author:  blueyed: Daniel HAHLER.
Author:  vegarg: Vegar BERG GULDAL.
Author:  edgester: Jason EDGECOMBE.
Author:  mfollett: Matt Follett.
Copyright:  (c) 2009 - 2011 by the Quam Plures developers -
Copyright:  (c)2003-2009 by Francois PLANQUE - Parts of this file are copyright (c)2004 by Vegar BERG GULDAL - Parts of this file are copyright (c)2005 by Jason EDGECOMBE
Filesource:  Source Code for this file
License:  GNU General Public License (GPL)
create_blog  [line 310]

void create_blog( $blog_name, $blog_shortname, $blog_urlname, [ $blog_tagline = ''], [ $blog_longdesc = ''], [ $blog_template_ID = 1], [ $kind = 'std'], [ $num_posts = 5]  )

Create a new a blog This funtion has to handle all needed DB dependencies!


Information Tags:
Todo:  move this to Blog object (only half done here)

[ Top ]
create_default_data  [line 66]

void create_default_data( )

Insert all default data:

[ Top ]
create_demo_contents  [line 426]

void create_demo_contents( )

This is called only for fresh installs and fills the tables with demo/tutorial things.

[ Top ]
create_tables  [line 49]

void create_tables( )

Used for fresh install

[ Top ]
installer_timestamp  [line 390]

integer installer_timestamp( )

Spread the sample entries across the past ... do the "worst case" math!

$timestamp uses the total count ($count_samples + $count_contribs) as the number of days in the past to use as the starting point for the installation.

$count_samples includes 2 instances of "installer_timestamp()" that are not actual sample posts. The actual function name and once that gets reused foreach( contributor ). "minus 2" will help us :)

$count_contribs counts the number of elements in the contributors array.

$backdate is how far back we pushed the starting point, or the second half of $timestamp = ( time() - ( ( count_samples + count_contribs ) * 86400 ) );

$max_per_item_spread is the maximum real delta between time stamps, accounting for the 2 instances of installer_timestamp() that are not applications of a time stamp. This will, by design, be greater than the number of seconds in one day.

$ave_per_item_spread is simply the max minus 2 hours in seconds, which would be the average between it + or - 7200 :)

$fixed_entry_delta is the float rounded down to the next whole int value. We need that to make sure that the most recent item is always in the past.

This function modifies timestamp by a fixed amount of time +/- 2 hours, so the "worst case" math has to have the latest entry in the past. If the "coin toss" always comes up heads and the random addition is always 7200 we can now calculate backwards to find what the minimum fixed amount of time needs to be.

NOTE: using $timestamp inside if( $fixed_entry_delta === NULL ) ensures we never get closer than a day to right now.

API Tags:
Return:  The new $timestamp value.

Information Tags:
Todo:  EdB: do this the other way. Create an array for timestamps with values for each timestamped bit based on the most recent is "now minus 10 seconds" and 24 +/-4 hours between items, then flip the array and work through it as we insert posts. That gives us built-in variance between posts and the most recent will always be right about now :)

[ Top ]