function get() { require_once 'HTML/FlexyFramework/Generator.php'; HTML_FlexyFramework_Generator::$generateClasses = true; $ff = HTML_FlexyFramework::get(); $ff->DB_DataObject['debug'] = 1; $ff->debug = 1; if (empty($ff->dataObjectsCache)) { die("make sure dataObjectsCache in set to true the index file"); } // make sure the cache generator is on.. $ff->dataObjectsCache = true; $ff->generateDataobjectsCache(true); die("Generation done.."); }
/** * _generateDataobjectsCache: * * create xxx.ini and xxx.links.ini * * @arg force (boolean) force generation - default false; * */ function generateDataobjectsCache($force = false) { //$this->debug('generateDataobjectsCache: force=' . ($force ? 'yes' : 'no')); if (!$this->dataObjectsCache) { // does not use dataObjects Caching.. $this->debug('generateDataobjectsCache', 'dataObjectsCache - empty'); return; } $dburl = parse_url($this->database); $dbini = 'ini_' . basename($dburl['path']); $iniCache = $this->DB_DataObject[$dbini]; if ($force && file_exists($iniCache)) { unlink($iniCache); clearstatcache(); } $iniCacheTmp = $iniCache . '.tmp' . md5(rand()); // random to stop two processes using the same file. // has it expired.. $force = ($force ? $force : !file_exists($iniCache)) || !$this->dataObjectsCacheExpires; // $this->debug('generateDataobjectsCache: after check : force=' . ($force ? 'yes' : 'no')); // not force or not expired, do not bother.. if (!$force) { if (filemtime($iniCache) + $this->dataObjectsCacheExpires > time()) { return; } } //echo "GENERATE?"; // force quoting of column names.. // unless it forced off.. if (!isset($this->DB_DataObject['quote_identifiers_tableinfo'])) { $this->DB_DataObject['quote_identifiers_tableinfo'] = true; } if (!file_exists(dirname($iniCache))) { mkdir(dirname($iniCache), 0700, true); } $this->DB_DataObject[$dbini] = $iniCacheTmp; $this->_exposeToPear(); // DB_DataObject::debugLevel(1); require_once 'HTML/FlexyFramework/Generator.php'; $generator = new HTML_FlexyFramework_Generator(); $generator->start(); HTML_FlexyFramework_Generator::writeCache($iniCacheTmp, $iniCache); // reset the cache to the correct lcoation. $this->DB_DataObject[$dbini] = $iniCache; $this->_exposeToPear(); //$GLOBALS['_DB_DATAOBJECT']['INI'][$this->database] = parse_ini_file($iniCache, true); //$GLOBALS['_DB_DATAOBJECT']['SEQUENCE'] // clear any dataobject cache.. //die("done"); }