| | DocWeb Port: Sean Coates | +----------------------------------------------------------------------+ $Id$ */ set_time_limit(0); $scriptBegin = time(); $inCli = true; require_once '../include/init.inc.php'; require_once '../include/lib_meta_info.inc.php'; require_once '../include/docweb_dao_metainfo.class.php'; echo "Generating Missing Examples data...\n"; $DAO = new DocWeb_DAO_MetaInfo(TRUE); $reference = SVN_DIR . '/' .DOC_DIR .'/en/reference'; $excludefuncs = array( 'overload' => 'The example is in the introductory section', 'mysql-db-query' => 'Deprecated function', 'mysql-change-user' => 'PHP 3', 'delete' => 'Pseudo function', 'main' => 'Pseudo function' ); $exts = array(); $dir = opendir($reference); while ($entry = readdir($dir)) { if ($entry == "." || $entry == "..") { continue; } // entry is a directory, and has a valid functions sub-directory if (is_dir("$reference/$entry") && is_dir("$reference/$entry/functions")) { $exts[] = $entry; } } closedir($dir); sort($exts, SORT_STRING); $extfuncs = array(); $functotal = 0; foreach ($exts as $ext) { $extfuncs[$ext] = array(); $funcdir = "$reference/$ext/functions"; $dir = opendir($funcdir); while ($entry = readdir($dir)) { $function = substr($entry, 0, -4); // found a file in the functions directory, and it's an .xml file if ( is_file("$funcdir/$entry") && substr($entry, -4) == ".xml" && strstr(substr($entry, 0, -4), ".") === false && !isset($excludefuncs[$function]) ) { $file = file_get_contents("$funcdir/$entry"); $ufunction = str_replace('-', '_', $function); $alias = $DAO->isAlias($ufunction); if ( strstr($file, " $ext) { $exttotal = count($ext); if ($exttotal == 0) { $notmissing[] = $name; } else { $extcount++; $total += $exttotal; } } $DAO->purgeExamples(); foreach (array_diff($extfuncs, $notmissing) AS $ext => $extData) { foreach ($extData AS $func) { echo "[$ext] $func\n"; $DAO->storeMissingExample($ext, $func); } } echo "** Done.\n"; ?>