cvs: phd(PHD_ENTERPRISE) / render.php /formats bigxhtml.php /include PhDErrors.php PhDFormat.class.php PhDIndex.class.php PhDRender.class.php

From: Date: Fri, 01 Aug 2008 14:55:19 +0000
Subject: cvs: phd(PHD_ENTERPRISE) / render.php /formats bigxhtml.php /include PhDErrors.php PhDFormat.class.php PhDIndex.class.php PhDRender.class.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-1975@lists.php.net to get a copy of this message
loudi Fri Aug 1 14:55:19 2008 UTC Modified files: (Branch: PHD_ENTERPRISE) /phd/include PhDIndex.class.php PhDFormat.class.php PhDErrors.php PhDRender.class.php /phd/formats bigxhtml.php /phd render.php Log: * fixed verbose flags issue * a new indexing is required if .manual.xml has changed since the last one ('--index false' automatically choose if a new indexing have to be done __ maybe it could be the default option? __) * added few verbose msgs

http://cvs.php.net/viewvc.cgi/phd/include/PhDIndex.class.php?r1=1.2.2.5&r2=1.2.2.6&diff_format=u Index: phd/include/PhDIndex.class.php diff -u phd/include/PhDIndex.class.php:1.2.2.5 phd/include/PhDIndex.class.php:1.2.2.6 --- phd/include/PhDIndex.class.php:1.2.2.5 Wed Jul 30 12:27:27 2008 +++ phd/include/PhDIndex.class.php Fri Aug 1 14:55:19 2008 @@ -74,30 +74,43 @@ } public function appendData($data) { } + // Require indexing if --index=true, if no indexing has been successfully done before + // or if xml input file has changed since the last indexing + final static public function requireIndexing() { + if (!PhDConfig::index() && file_exists(PhDConfig::output_dir() . "index.sqlite")) { + $db = new SQLite3('index.sqlite'); + $indexingCount = $db->query('SELECT COUNT(time) FROM indexing')->fetchArray(SQLITE3_NUM); + if ($indexingCount[0] > 0) { + $indexing = $db->query('SELECT time FROM indexing')->fetchArray(SQLITE3_ASSOC); + $xmlLastModification = filemtime(PhDConfig::xml_file()); + if ($indexing["time"] > $xmlLastModification) { + return false; + } + } + } + return true; + } public function update($event, $value = null) { switch($event) { case PhDRender::CHUNK: - $this->flags = $value; - break; + $this->flags = $value; + break; case PhDRender::STANDALONE: - if ($value) { - $this->registerElementMap(static::getDefaultElementMap()); - $this->registerTextMap(static::getDefaultTextMap()); - } - break; - case PhDRender::INIT: - if ($value) { - if (file_exists("index.sqlite")) { - unlink("index.sqlite"); + if ($value) { + $this->registerElementMap(static::getDefaultElementMap()); + $this->registerTextMap(static::getDefaultTextMap()); } - $db = new SQLite3('index.sqlite'); - - $db->exec('PRAGMA default_synchronous=OFF'); - $db->exec('PRAGMA count_changes=OFF'); - $db->exec('PRAGMA cache_size=100000'); - - $create = <<<SQL + break; + case PhDRender::INIT: + if ($value) { + if (file_exists(PhDConfig::output_dir() . "index.sqlite")) { + $db = new SQLite3(PhDConfig::output_dir() . 'index.sqlite'); + $db->exec('DELETE FROM ids'); + $db->exec('DELETE FROM indexing'); + } else { + $db = new SQLite3(PhDConfig::output_dir() . 'index.sqlite'); + $create = <<<SQL CREATE TABLE ids ( docbook_id TEXT PRIMARY KEY, filename TEXT, @@ -106,18 +119,25 @@ ldesc TEXT, element TEXT ); +CREATE TABLE indexing ( + time INTEGER PRIMARY KEY +); SQL; - $db->exec('PRAGMA default_synchronous=OFF'); - $db->exec('PRAGMA count_changes=OFF'); - $db->exec('PRAGMA cache_size=100000'); - $db->exec($create); - - $this->db = $db; - - $this->chunks = array(); - } else { - print_r($this->chunks); - } + $db->exec('PRAGMA default_synchronous=OFF'); + $db->exec('PRAGMA count_changes=OFF'); + $db->exec('PRAGMA cache_size=100000'); + $db->exec($create); + } + $this->db = $db; + + $this->chunks = array(); + } else { + print_r($this->chunks); + } + break; + case PhDRender::FINALIZE: + $this->db->exec("INSERT INTO indexing (time) VALUES ('" . time() . "')"); + break; } } public function getDefaultElementMap() { http://cvs.php.net/viewvc.cgi/phd/include/PhDFormat.class.php?r1=1.10.6.5&r2=1.10.6.6&diff_format=u Index: phd/include/PhDFormat.class.php diff -u phd/include/PhDFormat.class.php:1.10.6.5 phd/include/PhDFormat.class.php:1.10.6.6 --- phd/include/PhDFormat.class.php:1.10.6.5 Thu Jul 31 21:23:19 2008 +++ phd/include/PhDFormat.class.php Fri Aug 1 14:55:19 2008 @@ -11,8 +11,10 @@ private static $autogen = array(); public function __construct() { - $this->sqlite = new SQLite3('index.sqlite'); - $this->sortIDs(); + if (file_exists(PhDConfig::output_dir() . "index.sqlite")) { + $this->sqlite = new SQLite3('index.sqlite'); + $this->sortIDs(); + } } abstract public function transformFromMap($open, $tag, $name, $attrs, $props); http://cvs.php.net/viewvc.cgi/phd/include/PhDErrors.php?r1=1.3.4.3&r2=1.3.4.4&diff_format=u Index: phd/include/PhDErrors.php diff -u phd/include/PhDErrors.php:1.3.4.3 phd/include/PhDErrors.php:1.3.4.4 --- phd/include/PhDErrors.php:1.3.4.3 Fri Aug 1 13:04:05 2008 +++ phd/include/PhDErrors.php Fri Aug 1 14:55:19 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: PhDErrors.php,v 1.3.4.3 2008/08/01 13:04:05 loudi Exp $ */ +/* $Id: PhDErrors.php,v 1.3.4.4 2008/08/01 14:55:19 loudi Exp $ */ /* {{{ PhD error & message handler */ @@ -33,7 +33,7 @@ define_error('VERBOSE_NOVERSION', 'Missing Version Information'); define_error('VERBOSE_DONE', 'PhD Processing Completion'); -define('VERBOSE_ALL', (VERBOSE_NOVERSION << 1)-1); +define('VERBOSE_ALL', (VERBOSE_DONE << 1)-1); define('VERBOSE_DEFAULT', (VERBOSE_ALL^(VERBOSE_PARTIAL_CHILD_READING|VERBOSE_CHUNK_WRITING|VERBOSE_NOVERSION|VERBOSE_DONE))); $olderrrep = error_reporting(); http://cvs.php.net/viewvc.cgi/phd/include/PhDRender.class.php?r1=1.2.2.4&r2=1.2.2.5&diff_format=u Index: phd/include/PhDRender.class.php diff -u phd/include/PhDRender.class.php:1.2.2.4 phd/include/PhDRender.class.php:1.2.2.5 --- phd/include/PhDRender.class.php:1.2.2.4 Wed Jul 30 12:17:21 2008 +++ phd/include/PhDRender.class.php Fri Aug 1 14:55:19 2008 @@ -5,6 +5,7 @@ const CLOSE = 0x004; const STANDALONE = 0x008; const INIT = 0x010; + const FINALIZE = 0x020; private $STACK = array(); @@ -207,9 +208,9 @@ } } - /* Closing time */ + /* Closing time */ foreach($this as $format) { - //$format->notify(PhDRender::INIT, false); + $format->notify(PhDRender::FINALIZE, true); } $r->close(); http://cvs.php.net/viewvc.cgi/phd/formats/bigxhtml.php?r1=1.2.2.5&r2=1.2.2.6&diff_format=u Index: phd/formats/bigxhtml.php diff -u phd/formats/bigxhtml.php:1.2.2.5 phd/formats/bigxhtml.php:1.2.2.6 --- phd/formats/bigxhtml.php:1.2.2.5 Fri Aug 1 11:02:03 2008 +++ phd/formats/bigxhtml.php Fri Aug 1 14:55:19 2008 @@ -109,24 +109,24 @@ if ($val) { if (!is_resource($this->bigfp)) { $this->open(); + v("Starting %s rendering", $this->simpleName, VERBOSE_FORMAT_RENDERING); } } else { $this->close(); } - v("Starting %s rendering", $this->simpleName, VERBOSE_FORMAT_RENDERING); break; } } public function createLink($for, &$desc = null, $type = self::SDESC) { $retval = '#' . $for; if ($desc !== null) { - $rsl = $this->sqlite($this->sqlite, "SELECT sdesc, ldesc FROM ids WHERE docbook_id='$for'")->fetchArray(SQLITE3_ASSOC); + $result = $this->sqlite->query("SELECT sdesc, ldesc FROM ids WHERE docbook_id='$for'")->fetchArray(SQLITE3_ASSOC); $retval = '#' . $for; if ($type === self::SDESC) { - $desc = $rsl[0]["sdesc"] ?: $rsl[0]["ldesc"]; + $desc = $result["sdesc"] ?: $result["ldesc"]; } else { - $desc = $rsl[0]["ldesc"] ?: $rsl[0]["sdesc"]; + $desc = $result["ldesc"] ?: $result["sdesc"]; } } http://cvs.php.net/viewvc.cgi/phd/render.php?r1=1.3.2.7&r2=1.3.2.8&diff_format=u Index: phd/render.php diff -u phd/render.php:1.3.2.7 phd/render.php:1.3.2.8 --- phd/render.php:1.3.2.7 Fri Aug 1 11:02:03 2008 +++ phd/render.php Fri Aug 1 14:55:19 2008 @@ -36,10 +36,11 @@ $render = new PhDRender(); $reader = new PhDReader(); +// Indexing & registering formats foreach(range(0, 0) as $i) { //var_dump(date(DATE_RSS)); - if (PhDConfig::index()) { + if (PhDIndex::requireIndexing()) { v("Indexing...", VERBOSE_INDEXING); // Create indexer $format = new PhDIndex(); @@ -90,8 +91,11 @@ */ } +// Rendering formats foreach(range(0, 0) as $i) { $reader->open(PhDConfig::xml_file()); $render->render($reader); } +v("Finished rendering", VERBOSE_FORMAT_RENDERING); +
« previous php.doc.cvs (#1975) next »