コード例 #1
0
// Přípojení do databáze,
try {
    $db = new PDO(DB_DRIVER . ':host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASSWORD, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'));
} catch (PDOException $e) {
    echo $e->getMessage();
    echo "\r\n";
    echo "\r\n";
    die;
}
if (!file_exists(APP_PATH)) {
    echo "Nebyla nalezena slozka app";
    echo "\r\n";
    echo "\r\n";
    die;
}
checkPaths();
checkBases();
// Načtení názvu tabulek,
$tables = array();
foreach ($db->query('SHOW TABLES')->fetchAll(PDO::FETCH_COLUMN) as $table) {
    $name = implode('', array_map(function ($word) {
        return ucfirst($word);
    }, explode('_', $table)));
    $cols = array();
    foreach ($db->query("DESCRIBE `{$table}`") as $col) {
        $cols[$col['Field']] = '@property' . (strtolower($col['Extra']) == 'auto_increment' ? '-read' : NULL) . ' ' . getColType(strtolower($col['Type'])) . (strtolower($col['Null']) == 'yes' ? '|NULL' : NULL) . ' $' . $col['Field'] . "\n";
    }
    $tables[$name] = array($table => $cols);
}
// Generování tříd,
foreach ($tables as $className => $table) {
コード例 #2
0
ファイル: ezcache.php プロジェクト: robinmuilwijk/ezpublish
function purgeItems( $cacheEntries, $cli, $name )
{
    global $purgeSleep, $purgeMax, $purgeExpiry;
    if ( !$name )
        $name = 'All cache';
    $name = $cli->stylize( 'emphasize', $name );
    $cli->output( 'Purging ' . $name . ': ' );

    checkPaths( $cacheEntries, true );

    $i = 0;
    foreach ( $cacheEntries as $cacheEntry )
    {
        if ( $i > 0 )
            $cli->output( ', ', false );
        $cli->output( $cli->stylize( 'emphasize', $cacheEntry['name'] ), false );
        eZCache::clearItem( $cacheEntry, true, 'reportProgress', $purgeSleep, $purgeMax, $purgeExpiry );
        ++$i;
    }
    $cli->output();
}