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

From: Date: Fri, 01 Aug 2008 18:57:53 +0000
Subject: cvs: phd(PHD_ENTERPRISE) / config.php render.php /formats bigxhtml.php php.php xhtml.php /include PhDFormat.class.php PhDIndex.class.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-1977@lists.php.net to get a copy of this message
bjori Fri Aug 1 18:57:53 2008 UTC Modified files: (Branch: PHD_ENTERPRISE) /phd config.php render.php /phd/formats bigxhtml.php php.php xhtml.php /phd/include PhDFormat.class.php PhDIndex.class.php Log: - Fix version (0.4.0-enterprise) - Set default output dir to ./output/ - Set format output dirs to lowercased version of the format name - Create output dirs if they don't already exist - Register the format name to PhDFormat - Fix index.sqlite file location - Fix odd protos (same argument name twice?) - Fix annoying E_NOTICE

http://cvs.php.net/viewvc.cgi/phd/config.php?r1=1.53.2.3&r2=1.53.2.4&diff_format=u Index: phd/config.php diff -u phd/config.php:1.53.2.3 phd/config.php:1.53.2.4 --- phd/config.php:1.53.2.3 Fri Aug 1 11:02:03 2008 +++ phd/config.php Fri Aug 1 18:57:52 2008 @@ -1,9 +1,9 @@ <?php -/* $Id: config.php,v 1.53.2.3 2008/08/01 11:02:03 loudi Exp $ */ +/* $Id: config.php,v 1.53.2.4 2008/08/01 18:57:52 bjori Exp $ */ require $ROOT . "/include/PhDErrors.php"; -define("PHD_VERSION", "2.0-enterprise"); +define("PHD_VERSION", "0.4.0-enterprise"); class PhDConfig { @@ -29,7 +29,7 @@ 'skip_ids' => array( ), 'color_output' => false, - 'output_dir' => './', + 'output_dir' => './output/', 'intermediate_output_dir' => '.', 'php_error_output' => NULL, 'php_error_color' => false, http://cvs.php.net/viewvc.cgi/phd/render.php?r1=1.3.2.8&r2=1.3.2.9&diff_format=u Index: phd/render.php diff -u phd/render.php:1.3.2.8 phd/render.php:1.3.2.9 --- phd/render.php:1.3.2.8 Fri Aug 1 14:55:19 2008 +++ phd/render.php Fri Aug 1 18:57:52 2008 @@ -24,6 +24,14 @@ if (!is_dir(PhDConfig::xml_root()) || !is_file(PhDConfig::xml_file())) { trigger_error("No '.manual.xml' file was given. Specify it on the command line with --docbook.", E_USER_ERROR); } +if (!file_exists(PhDConfig::output_dir())) { + v("Creating output directory..", E_USER_NOTICE); + if (!mkdir(PhDConfig::output_dir())) { + v("Can't create output directory", E_USER_ERROR); + } +} elseif (!is_dir(PhDConfig::output_dir())) { + v("Output directory is not a file?", E_USER_ERROR); +} PhDConfig::init(array( "verbose" => VERBOSE_ALL^(VERBOSE_PARTIAL_CHILD_READING|VERBOSE_CHUNK_WRITING), http://cvs.php.net/viewvc.cgi/phd/formats/bigxhtml.php?r1=1.2.2.6&r2=1.2.2.7&diff_format=u Index: phd/formats/bigxhtml.php diff -u phd/formats/bigxhtml.php:1.2.2.6 phd/formats/bigxhtml.php:1.2.2.7 --- phd/formats/bigxhtml.php:1.2.2.6 Fri Aug 1 14:55:19 2008 +++ phd/formats/bigxhtml.php Fri Aug 1 18:57:52 2008 @@ -38,6 +38,7 @@ public function __construct() { parent::__construct(); + parent::registerFormatName($this->simpleName); } public function appendData($data) { $id = "BIGHTML ID"; @@ -109,7 +110,7 @@ if ($val) { if (!is_resource($this->bigfp)) { $this->open(); - v("Starting %s rendering", $this->simpleName, VERBOSE_FORMAT_RENDERING); + v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING); } } else { $this->close(); http://cvs.php.net/viewvc.cgi/phd/formats/php.php?r1=1.4.2.5&r2=1.4.2.6&diff_format=u Index: phd/formats/php.php diff -u phd/formats/php.php:1.4.2.5 phd/formats/php.php:1.4.2.6 --- phd/formats/php.php:1.4.2.5 Fri Aug 1 11:02:03 2008 +++ phd/formats/php.php Fri Aug 1 18:57:52 2008 @@ -77,6 +77,7 @@ public function __construct() { parent::__construct(); + parent::registerFormatName($this->simpleName); $this->versions = self::generateVersionInfo(PhDConfig::phpweb_version_filename()); $this->acronyms = self::generateAcronymInfo(PhDConfig::phpweb_acronym_filename()); @@ -135,7 +136,7 @@ break; case PhDRender::INIT: - v("Starting %s rendering", $this->simpleName, VERBOSE_FORMAT_RENDERING); + parent::update($event, $val); break; } } @@ -144,7 +145,7 @@ } protected function lookupRefname($for) { - return $this->refs[$for]; + return isset($this->refs[$for]) ? $this->refs[$for] : null; return NO_SQLITE; $rsl = $this->sqlite->query("SELECT filename, ldesc, sdesc FROM ids WHERE sdesc='$for' AND element='refentry'")->fetchArray(SQLITE3_ASSOC); if (isset($rsl[0])) { http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.68.2.6&r2=1.68.2.7&diff_format=u Index: phd/formats/xhtml.php diff -u phd/formats/xhtml.php:1.68.2.6 phd/formats/xhtml.php:1.68.2.7 --- phd/formats/xhtml.php:1.68.2.6 Fri Aug 1 16:35:52 2008 +++ phd/formats/xhtml.php Fri Aug 1 18:57:52 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: xhtml.php,v 1.68.2.6 2008/08/01 16:35:52 loudi Exp $ */ +/* $Id: xhtml.php,v 1.68.2.7 2008/08/01 18:57:52 bjori Exp $ */ class PhDXHTMLFormat extends PhDFormat { private $simpleName = "XHTML"; private $myelementmap = array( /* {{{ */ @@ -397,9 +397,11 @@ protected $flags; protected $ext = "html"; protected $fp = array(); + protected $outputdir = __DIR__; public function __construct() { parent::__construct(); + parent::registerFormatName($this->simpleName); } public function transformFromMap($open, $tag, $name, $attrs, $props) { if ($open) { @@ -480,7 +482,7 @@ return "\n</body>\n</html>\n"; } public function writeChunk($id, $fp) { - $filename = PhDConfig::output_dir() . $id . '.' .$this->ext; + $filename = $this->outputdir . $id . '.' .$this->ext; rewind($fp); file_put_contents($filename, $this->header($id)); @@ -597,7 +599,17 @@ break; case PhDRender::INIT: - v("Starting %s rendering", $this->simpleName, VERBOSE_FORMAT_RENDERING); + v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING); + $this->outputdir = $tmp = PhDConfig::output_dir() . strtolower($this->getFormatName()) . '/'; + if (file_exists($tmp)) { + if (!is_dir($tmp)) { + v("Output directory is a file?", E_USER_ERROR); + } + } else { + if (!mkdir($tmp)) { + v("Can't create output directory", E_USER_ERROR); + } + } break; } } @@ -772,6 +784,7 @@ if(isset($attrs[PhDReader::XMLNS_XML]["id"])) { $id = $attrs[PhDReader::XMLNS_XML]["id"]; } else { + /* FIXME: This will obviously not exist in the db.. */ $id = uniqid("phd"); } http://cvs.php.net/viewvc.cgi/phd/include/PhDFormat.class.php?r1=1.10.6.6&r2=1.10.6.7&diff_format=u Index: phd/include/PhDFormat.class.php diff -u phd/include/PhDFormat.class.php:1.10.6.6 phd/include/PhDFormat.class.php:1.10.6.7 --- phd/include/PhDFormat.class.php:1.10.6.6 Fri Aug 1 14:55:19 2008 +++ phd/include/PhDFormat.class.php Fri Aug 1 18:57:52 2008 @@ -6,13 +6,14 @@ private $elementmap = array(); private $textmap = array(); + private $formatname = "UNKNOWN"; protected $sqlite; private static $autogen = array(); public function __construct() { if (file_exists(PhDConfig::output_dir() . "index.sqlite")) { - $this->sqlite = new SQLite3('index.sqlite'); + $this->sqlite = new SQLite3(PhDConfig::output_dir() . 'index.sqlite'); $this->sortIDs(); } } @@ -21,7 +22,7 @@ abstract public function UNDEF($open, $name, $attrs, $props); abstract public function TEXT($value); abstract public function CDATA($value); - abstract public function createLink($for, &$desc = null, $desc = PhDFormat::SDESC); + abstract public function createLink($for, &$desc = null, $type = PhDFormat::SDESC); abstract public function appendData($data); abstract public function update($event, $value = null); @@ -73,6 +74,12 @@ final public function getTextMap() { return $this->textmap; } + final public function registerFormatName($name) { + $this->formatname = $name; + } + public function getFormatName() { + return $this->formatname; + } final public static function autogen($text, $lang) { if (isset(self::$autogen[$lang])) { http://cvs.php.net/viewvc.cgi/phd/include/PhDIndex.class.php?r1=1.2.2.6&r2=1.2.2.7&diff_format=u Index: phd/include/PhDIndex.class.php diff -u phd/include/PhDIndex.class.php:1.2.2.6 phd/include/PhDIndex.class.php:1.2.2.7 --- phd/include/PhDIndex.class.php:1.2.2.6 Fri Aug 1 14:55:19 2008 +++ phd/include/PhDIndex.class.php Fri Aug 1 18:57:52 2008 @@ -70,7 +70,7 @@ } public function CDATA($value) { } - public function createLink($for, &$desc = null, $desc = PhDFormat::SDESC) { + public function createLink($for, &$desc = null, $type = PhDFormat::SDESC) { } public function appendData($data) { } @@ -78,7 +78,7 @@ // 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'); + $db = new SQLite3(PhDConfig::output_dir() . '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);
« previous php.doc.cvs (#1977) next »