Exemplo n.º 1
0
function closeCurrentFile()
{
    global $g_numFiles;
    global $g_curFileName;
    global $g_curFile;
    fprintf($g_curFile, "</urlset>\n");
    fclose($g_curFile);
    OS::executeAndAssert("gzip - < {$g_curFileName} > wwwbase/sitemap{$g_numFiles}.xml.gz");
    util_deleteFile($g_curFileName);
}
Exemplo n.º 2
0
    writeLexems($locVersion, $file1);
    writeLexems($newLocVersion, $file2);
    $diff = OS::executeAndReturnOutput("diff {$file1} {$file2} || true");
    print "<pre>\n";
    foreach ($diff as $line) {
        if (StringUtil::startsWith($line, '< ')) {
            print sprintf("<span style=\"color: red\">%s: %s</span>\n", $locVersion, substr($line, 2));
        } else {
            if (StringUtil::startsWith($line, '> ')) {
                print sprintf("<span style=\"color: green\">%s: %s</span>\n", $newLocVersion, substr($line, 2));
            }
        }
    }
    print "</pre>\n";
    util_deleteFile($file1);
    util_deleteFile($file2);
    exit;
}
if ($locVersion) {
    header('Content-type: text/plain; charset=UTF-8');
    writeLexems($locVersion, 'php://output');
    exit;
}
setlocale(LC_ALL, "ro_RO.utf8");
smarty_assign('locVersions', pref_getLocVersions());
smarty_displayCommonPageWithSkin('scrabble-loc.ihtml');
function writeLexems($locVersion, $fileName)
{
    LocVersion::changeDatabase($locVersion);
    $dbResult = db_execute(DB_QUERY, PDO::FETCH_ASSOC);
    $handle = fopen($fileName, 'w');
Exemplo n.º 3
0
            }
        }
    }
    if (++$defsSeen % 10000 == 0) {
        $runTime = DebugInfo::getRunningTimeInMillis() / 1000;
        $speed = round($defsSeen / $runTime);
        log_scriptLog("{$defsSeen} of {$numDefs} definitions indexed ({$speed} defs/sec). " . "Word map has " . count($ifMap) . " entries. " . "Memory used: " . round(memory_get_usage() / 1048576, 1) . " MB.");
    }
}
fclose($handle);
log_scriptLog("{$defsSeen} of {$numDefs} definitions indexed.");
log_scriptLog("Index size: {$indexSize} entries.");
OS::executeAndAssert("chmod 666 {$fileName}");
log_scriptLog("Importing file {$fileName} into table FullTextIndex");
db_executeFromOS("load data local infile '{$fileName}' into table FullTextIndex");
util_deleteFile($fileName);
if (!Lock::release(LOCK_FULL_TEXT_INDEX)) {
    log_scriptLog('WARNING: could not release lock!');
}
log_scriptLog('rebuildFullTextIndex.php completed successfully ' . '(against all odds)');
/***************************************************************************/
function extractWords($text)
{
    $alphabet = 'abcdefghijklmnopqrstuvwxyzăâîșț';
    $text = mb_strtolower($text);
    $text = AdminStringUtil::removeAccents($text);
    $result = array();
    $currentWord = '';
    $chars = AdminStringUtil::unicodeExplode($text);
    foreach ($chars as $c) {
        if (strpos($alphabet, $c) !== false) {