Skip to content

Commit

Permalink
- released "dibi 1.0"
Browse files Browse the repository at this point in the history
- fixed FirePHP protocol bug
- DibiTable -> DibiTableX
  • Loading branch information
dg committed Oct 30, 2008
1 parent 8d063fe commit 901dc76
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
4 changes: 2 additions & 2 deletions dibi/dibi.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class FileNotFoundException extends IOException {}
require_once dirname(__FILE__) . '/libs/DibiResult.php';
require_once dirname(__FILE__) . '/libs/DibiTranslator.php';
require_once dirname(__FILE__) . '/libs/DibiVariable.php';
require_once dirname(__FILE__) . '/libs/DibiTable.php';
require_once dirname(__FILE__) . '/libs/DibiTableX.php';
require_once dirname(__FILE__) . '/libs/DibiDataSource.php';
require_once dirname(__FILE__) . '/libs/DibiFluent.php';
require_once dirname(__FILE__) . '/libs/DibiDatabaseInfo.php';
Expand Down Expand Up @@ -111,7 +111,7 @@ class dibi
/**#@+
* dibi version
*/
const VERSION = '0.9';
const VERSION = '1.0';
const REVISION = '$WCREV$ released on $WCDATE$';
/**#@-*/

Expand Down
6 changes: 3 additions & 3 deletions dibi/libs/DibiProfiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ public function after($ticket, $res = NULL)
$payload = function_exists('json_encode') ? json_encode($payload) : self::json_encode($payload);
foreach (str_split($payload, 4990) as $num => $s) {
$num++;
header("X-Wf-dibi-1-1-$num: |$s|\\"); // protocol-, structure-, plugin-, message-index
header("X-Wf-dibi-1-1-d$num: |$s|\\"); // protocol-, structure-, plugin-, message-index
}
header("X-Wf-dibi-1-1-$num: |$s|");
header("X-Wf-dibi-Index: $num");
header("X-Wf-dibi-1-1-d$num: |$s|");
header("X-Wf-dibi-Index: d$num");
}

if ($this->file) {
Expand Down
9 changes: 8 additions & 1 deletion dibi/libs/DibiTable.php → dibi/libs/DibiTableX.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @copyright Copyright (c) 2005, 2008 David Grudl
* @package dibi
*/
abstract class DibiTable extends DibiObject
abstract class DibiTableX extends DibiObject
{
/** @var string primary key mask */
public static $primaryMask = 'id';
Expand Down Expand Up @@ -411,3 +411,10 @@ public function __call($name, $args)
}

}




abstract class DibiTable extends DibiTableX
{
}
13 changes: 6 additions & 7 deletions examples/Nette/Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function
class
Framework{const
VERSION='0.8';const
REVISION='106 released on 2008/10/27 11:13:57';final
REVISION='107 released on 2008/10/29 20:40:23';final
public
function
__construct(){throw
Expand Down Expand Up @@ -80,8 +80,7 @@ class
static$keysToHide=array('password','passwd','pass','pwd','creditcard','credit card','cc','pin');private
static$colophons=array(array(__CLASS__,'getDefaultColophons'));private
static$keyFilter=array();public
static$time;private
static$fireCounter;const
static$time;const
LOG='LOG';const
INFO='INFO';const
WARN='WARN';const
Expand Down Expand Up @@ -597,13 +596,13 @@ function
fireLog($message,$priority=self::LOG,$label=NULL){if($message
instanceof
Exception){$priority='TRACE';$message=array('Class'=>get_class($message),'Message'=>$message->getMessage(),'File'=>$message->getFile(),'Line'=>$message->getLine(),'Trace'=>self::replaceObjects($message->getTrace()));}elseif($priority==='GROUP_START'){$label=$message;$message=NULL;}return
self::fireSend(1,array(array('Type'=>$priority,'Label'=>$label),$message));}private
self::fireSend(1,array(array('Type'=>$priority,'Label'=>$label),self::replaceObjects($message)));}private
static
function
fireSend($index,$payload){if(headers_sent())return
FALSE;if(!self::$fireCounter){header('X-Wf-Protocol-nette: http://meta.wildfirehq.org/Protocol/JsonStream/0.2');header('X-Wf-nette-Plugin-1: http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.2.0');header('X-Wf-nette-Structure-1: http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');header('X-Wf-nette-Structure-2: http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1');}$payload=json_encode($payload);foreach(str_split($payload,4990)as$s){$num=++self::$fireCounter;header("X-Wf-nette-$index-1-$num: |$s|\\");}header("X-Wf-nette-$index-1-$num: |$s|");header("X-Wf-nette-Index: $num");return
FALSE;header('X-Wf-Protocol-nette: http://meta.wildfirehq.org/Protocol/JsonStream/0.2');header('X-Wf-nette-Plugin-1: http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.2.0');if($index===1){header('X-Wf-nette-Structure-1: http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');}elseif($index===2){header('X-Wf-nette-Structure-2: http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1');}$payload=json_encode($payload);static$counter;foreach(str_split($payload,4990)as$s){$num=++$counter;header("X-Wf-nette-$index-1-n$num: |$s|\\");}header("X-Wf-nette-$index-1-n$num: |$s|");header("X-Wf-nette-Index: n$num");return
TRUE;}static
private
function
replaceObjects($val){foreach($val
as$k=>$v){if(is_object($v)){$val[$k]='object '.get_class($v).'';}elseif(is_array($v)){$val[$k]=self::replaceObjects($v);}}return$val;}}Debug::$html=PHP_SAPI!=='cli';Debug::$time=microtime(TRUE);
replaceObjects($val){if(is_object($val)){return'object '.get_class($val).'';}elseif(is_array($val)){foreach($val
as$k=>$v){unset($val[$k]);$val[$k]=self::replaceObjects($v);}}return$val;}}Debug::$html=PHP_SAPI!=='cli';Debug::$time=microtime(TRUE);
6 changes: 3 additions & 3 deletions examples/dibi.table.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>DibiTable demo</h1>
<h1>DibiTableX demo</h1>
<pre>
<?php

Expand All @@ -15,11 +15,11 @@


// autodetection: primary keys are customer_id, order_id, ...
DibiTable::$primaryMask = '%s_id';
DibiTableX::$primaryMask = '%s_id';


// table products
class Products extends DibiTable
class Products extends DibiTableX
{
// rely on autodetection...
// protected $name = 'products';
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Dibi 0.9 (revision $WCREV$ released on $WCDATE$)
Dibi 1.0 (revision $WCREV$ released on $WCDATE$)

0 comments on commit 901dc76

Please sign in to comment.