当前位置: 首页>>代码示例>>PHP>>正文


PHP OS::errorAndExit方法代码示例

本文整理汇总了PHP中OS::errorAndExit方法的典型用法代码示例。如果您正苦于以下问题:PHP OS::errorAndExit方法的具体用法?PHP OS::errorAndExit怎么用?PHP OS::errorAndExit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OS的用法示例。


在下文中一共展示了OS::errorAndExit方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parseArguments

function parseArguments()
{
    global $argv;
    $verbose = false;
    $fileName = FILE_NAME;
    for ($i = 1; $i < count($argv); $i++) {
        $arg = $argv[$i];
        if ($arg == "-v") {
            $verbose = true;
        } else {
            if ($arg == '-f') {
                $i++;
                $fileName = $argv[$i];
            } else {
                if ($arg == '-t') {
                    runTestSuite();
                    exit;
                } else {
                    OS::errorAndExit("Unknown flag: {$arg}");
                }
            }
        }
    }
    return array($verbose, $fileName);
}
开发者ID:florinp,项目名称:dexonline,代码行数:25,代码来源:common.php

示例2: GetWotdFromSubject

function GetWotdFromSubject($subject)
{
    $parts = preg_split("/\\s+/", trim($subject));
    if (count($parts) != 2) {
        OS::errorAndExit("Ignoring message '{$subject}' due to invalid subject", 0);
    }
    if ($parts[0] != Config::get('WotD.password')) {
        OS::errorAndExit("Ignoring message '{$subject}' due to invalid password in the subject", 0);
    }
    return $parts[1];
}
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:11,代码来源:getWotdImageByEmail.php

示例3: util_getRootPath

$LICENSE = util_getRootPath() . '/tools/dumpDatabaseLicense.txt';
$parts = db_splitDsn();
$COMMON_COMMAND = sprintf("mysqldump -h %s -u %s --password='%s' %s ", $parts['host'], $parts['user'], $parts['password'], $parts['database']);
$schemaOnly = array('RecentLink', 'Cookie', 'UserWordBookmark', 'DefinitionSimple', 'history_Comment', 'history_Definition');
$currentYear = date("Y");
// Full/Public dump: the public dump omits the user table, which contains emails and md5-ed passwords.
$doFullDump = false;
for ($i = 1; $i < count($argv); $i++) {
    $arg = $argv[$i];
    if ($arg == "--full") {
        $doFullDump = true;
    } else {
        if ($arg == '--public') {
            $doFullDump = false;
        } else {
            OS::errorAndExit("Unknown flag: {$arg}");
        }
    }
}
log_scriptLog('Running dumpDatabase.php with argument ' . ($doFullDump ? 'full' : 'public'));
$dbName = $parts['database'];
$tablesToIgnore = '';
foreach ($schemaOnly as $table) {
    $tablesToIgnore .= "--ignore-table={$dbName}.{$table} ";
}
if ($doFullDump) {
    $remoteFile = '/download/mirrorAccess/dex-database.sql.gz';
} else {
    $remoteFile = '/download/dex-database.sql.gz';
    $tablesToIgnore .= "--ignore-table={$dbName}.User --ignore-table={$dbName}.Definition --ignore-table={$dbName}.Source --ignore-table={$dbName}.diverta_Book --ignore-table={$dbName}.divertaIndex ";
}
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:dumpDatabase.php

示例4: foreach

$merge = false;
$split = false;
foreach ($argv as $i => $arg) {
    if ($arg == "--merge") {
        $merge = true;
    } else {
        if ($arg == '--split') {
            $split = true;
        } else {
            if ($i) {
                OS::errorAndExit("Unknown flag: {$arg}");
            }
        }
    }
}
if ($merge === $split) {
    OS::errorAndExit("Please specify exactly one of --merge or --split");
}
if ($merge) {
    OS::executeAndAssert("convert -size {$GEOMETRY} xc:white {$SPRITE}");
    foreach ($IMAGES as $i) {
        if ($i['bg']) {
            OS::executeAndAssert(sprintf("convert {$SPRITE} -fill '%s' -draw 'rectangle %s,%s %s,%s' {$SPRITE}", $i['bg'], $i['x'], $i['y'], $i['x'] + $i['width'] - 1, $i['y'] + $i['height'] - 1));
        }
        OS::executeAndAssert("convert {$SPRITE} {$i['file']} -geometry +{$i['x']}+{$i['y']} -compose over -composite {$SPRITE}");
    }
    OS::executeAndAssert("optipng {$SPRITE}");
    print "Composed and optimized sprite in {$SPRITE}\n";
} else {
    print "Splitting is not implemented yet.\n";
}
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:cssSprite.php

示例5: array

<?php

require_once '../../phplib/util.php';
$FIELDS = array('Comment' => array('Contents', 'HtmlContents'), 'Definition' => array('Lexicon', 'InternalRep', 'HtmlRep'), 'GuideEntry' => array('Correct', 'CorrectHtml', 'Wrong', 'WrongHtml', 'Comments', 'CommentsHtml'), 'RecentLink' => array('Text'), 'Source' => array('ShortName', 'Name', 'Author', 'Publisher', 'Year'), 'Typo' => array('Problem'), 'User' => array('Name'), 'inflections' => array('infl_descr'), 'lexems' => array('lexem_forma', 'lexem_neaccentuat', 'lexem_utf8_general', 'lexem_invers', 'lexem_descr', 'lexem_parse_info', 'lexem_comment'), 'model_types' => array('mt_descr'), 'models' => array('model_descr', 'model_exponent'), 'transforms' => array('transf_from', 'transf_to', 'transf_descr'), 'wordlist' => array('wl_form', 'wl_neaccentuat', 'wl_utf8_general'));
$MAPPINGS = array(array('ş', 'ș'), array('Ş', 'Ș'), array('ţ', 'ț'), array('Ţ', 'Ț'));
foreach ($FIELDS as $table => $fields) {
    foreach ($fields as $field) {
        foreach ($MAPPINGS as $mapping) {
            $query = "update {$table} set {$field} = replace({$field}, '{$mapping[0]}', '{$mapping[1]}')";
            print "{$query}\n";
            if (mysql_query($query)) {
                print "    " . mysql_affected_rows() . " rows affected.\n";
            } else {
                OS::errorAndExit(mysql_error());
            }
        }
    }
}
开发者ID:florinp,项目名称:dexonline,代码行数:18,代码来源:replace_st.php

示例6: ini_set

<?php

require_once __DIR__ . '/../phplib/util.php';
ini_set('max_execution_time', '3600');
ini_set('memory_limit', '256M');
assert_options(ASSERT_BAIL, 1);
log_scriptLog('Running rebuildFullTextIndex.php.');
if (!Lock::acquire(LOCK_FULL_TEXT_INDEX)) {
    OS::errorAndExit('Lock already exists!');
    exit;
}
log_scriptLog("Clearing table FullTextIndex.");
db_execute('truncate table FullTextIndex');
$stopWordForms = array_flip(db_getArray('select distinct i.formNoAccent ' . 'from Lexem l, LexemModel lm, InflectedForm i ' . 'where l.id = lm.lexemId ' . 'and lm.id = i.lexemModelId ' . 'and l.stopWord'));
$ifMap = array();
$dbResult = db_execute('select id, internalRep from Definition where status = 0');
$numDefs = $dbResult->rowCount();
$defsSeen = 0;
$indexSize = 0;
$fileName = tempnam(Config::get('global.tempDir'), 'index_');
$handle = fopen($fileName, 'w');
log_scriptLog("Writing index to file {$fileName}.");
DebugInfo::disable();
foreach ($dbResult as $dbRow) {
    $words = extractWords($dbRow[1]);
    foreach ($words as $position => $word) {
        if (!isset($stopWordForms[$word])) {
            if (!array_key_exists($word, $ifMap)) {
                cacheWordForm($word);
            }
            if (array_key_exists($word, $ifMap)) {
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:rebuildFullTextIndex.php

示例7: parseArguments

function parseArguments()
{
    global $argv;
    $verbose = false;
    $fileName = '/tmp/dn.online';
    for ($i = 1; $i < count($argv); $i++) {
        $arg = $argv[$i];
        if ($arg == "-v") {
            $verbose = true;
        } else {
            if ($arg == '-f') {
                $i++;
                $fileName = $argv[$i];
            } else {
                OS::errorAndExit("Unknown flag: {$arg}");
            }
        }
    }
    return array($verbose, $fileName);
}
开发者ID:florinp,项目名称:dexonline,代码行数:20,代码来源:importMdn.php

示例8: round

            }
        }
    }
    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");
if (!db_execute("load data local infile '{$fileName}' into table FullTextIndex")) {
    OS::errorAndExit("MySQL error");
}
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);
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:rebuildFullTextIndex.php


注:本文中的OS::errorAndExit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。