function apply_changes($file, $defines)
{
    $command = "src/phc {$file} --run plugins/tools/replace_include_constants.la --r-option='{$defines}' --dump=decomment 2>/dev/null";
    $newcode = _exec($command);
    $fh = fopen($file, "w");
    fwrite($fh, $newcode);
    fclose($fh);
}
function add_stat($package, $file, $file_stats)
{
    global $stats;
    $linecount = (int) _exec("cat {$file} | wc -l");
    $stats[$package]["eval"] += $file_stats[0];
    $stats[$package]["include"] += $file_stats[1];
    $stats[$package]["dynamic_include"] += $file_stats[2];
    $stats[$package]["filecount"] += 1;
    $stats[$package]["linecount"] += $linecount;
    $stats["all"]["eval"] += $file_stats[0];
    $stats["all"]["include"] += $file_stats[1];
    $stats["all"]["dynamic_include"] += $file_stats[2];
    $stats["all"]["filecount"] += 1;
    $stats["all"]["linecount"] += $linecount;
}
Example #3
0
function _set_permissions($image_name)
{
    _exec("chmod 755 {$image_name}/etc/rc*");
    _exec("chmod 644 {$image_name}/etc/pubkey.pem");
    _exec("chmod 644 {$image_name}/etc/inc/*");
    _exec("chmod 644 {$image_name}/conf.default/config.xml");
    _exec("chmod 644 {$image_name}/usr/local/www/*");
    _exec("chmod 755 {$image_name}/usr/local/www/*.php");
    _exec("chmod 755 {$image_name}/usr/local/www/*.cgi");
    _exec("chmod 644 {$image_name}/usr/local/captiveportal/*");
    _exec("chmod 755 {$image_name}/usr/local/captiveportal/*.php");
    _log("permissions set.");
}
        _exec('svn ps svn:externals %s %s', trim($externals), sfConfig::get('sf_plugins_dir'));
    } else {
        foreach ($plugins as $name => $path) {
            try {
                // export plugins from svn
                _exec('svn export %s %s', $path, sfConfig::get('sf_plugins_dir') . '/' . $name);
            } catch (Exception $e) {
                // install via PEAR
                $this->logSection('error', $e->getMessage(), null, 'ERROR');
                $this->getPluginManager()->installPlugin($name);
            }
        }
    }
    $filesystem->replaceTokens(sfConfig::get('sf_config_dir') . '/ProjectConfiguration.class.php', '##', '##', array('PLUGINS' => "      '" . implode("'," . PHP_EOL . "      '", array_keys($plugins)) . "',"));
} else {
    $filesystem->replaceTokens(sfConfig::get('sf_config_dir') . '/ProjectConfiguration.class.php', '##', '##', array('PLUGINS' => ''));
}
// copy core into project
if (sfConfig::get('sf_symfony_lib_dir') != sfConfig::get('sf_lib_dir') . '/vendor/symfony') {
    if ($isSubversion) {
        _exec('svn mkdir %s', sfConfig::get('sf_lib_dir') . '/vendor');
        _exec('svn ps svn:externals %s %s', 'symfony http://svn.symfony-project.com/branches/' . substr(SYMFONY_VERSION, 0, 3), sfConfig::get('sf_lib_dir') . '/vendor');
    } else {
        $filesystem->mkdirs(sfConfig::get('sf_lib_dir') . '/vendor');
    }
    if (!$isSubversion && file_exists(sfConfig::get('sf_symfony_lib_dir') . '/.svn')) {
        _exec('svn export %s %s', sfConfig::get('sf_symfony_lib_dir') . '/..', sfConfig::get('sf_lib_dir') . '/vendor/symfony');
    } else {
        _exec('cp -R %s %s', sfConfig::get('sf_symfony_lib_dir') . '/..', sfConfig::get('sf_lib_dir') . '/vendor/symfony');
    }
}
Example #5
0
function _do($log)
{
    global $form;
    // 라인개수
    $lines = getvalue($form['lines'], $_SESSION['log_lines'], 30);
    if (!$lines) {
        $lines = 30;
    }
    $search = $form['search'];
    if ($search) {
        // 콤마가 포함되면 콤마로 나누어서 egrep 으로 처리
        $items = preg_split("/,/", $search);
        $len = count($items);
        if ($len > 1) {
            $tmp = array();
            foreach ($items as $k) {
                $tmp[] = trim($k);
            }
            $find = join("|", $tmp);
            $cmd = "egrep \"{$find}\" {$log} | tail -n {$lines}";
        } else {
            $cmd = "grep {$search} {$log} | tail -n {$lines}";
        }
    } else {
        $cmd = "tail -n {$lines}  {$log}";
    }
    $t1 = microtime(true);
    _exec($cmd, $output);
    //dd($output);
    $t2 = microtime(true);
    $diff = sprintf("%10.3f", $t2 - $t1);
    print <<<EOS
<div class='title'>
{$log} (elapsed {$diff})
</div>
EOS;
    // reverse order
    if ($form['reod']) {
        $output = array_reverse($output);
    }
    // 최근 몇초까지의 로그만 출력함
    $latest = getvalue($form['latest'], $_SESSION['log_latest'], 'unlimited');
    _process($output, $mode, $latest);
}
Example #6
0
require_once 'google_calender.php';
require_once 'html_dom/simple_html_dom.php';
function _exec()
{
    $urls = array();
    foreach (todays_categories() as $japanese) {
        $book_category = convert($japanese);
        echo "<br/>";
        echo '"' . $book_category . '": [';
        $pattern = '/a href="(.*?)"/';
        preg_match_all($pattern, file_get_html('http://miraitosho.hateblo.jp/entry/2014/04/22/225652')->find("div[id={$book_category}]", 0), $matches);
        foreach ($matches[1] as $url) {
            $html = file_get_html($url);
            $img_url = $html->find('.hatena-fotolife', 0)->src;
            $title = $html->find('.entry-title-link', 0)->innertext;
            echo '{';
            echo '"url": "' . $url . '",';
            echo '"title": "' . $title . '",';
            echo '"img_url": "' . $img_url . '"},';
        }
        echo '],';
    }
}
function convert($japanese)
{
    $search = array('色の本', '黒', '緑', '赤', '白', '茶', '黄', 'ピンク', '青', '水', '灰', '銀', 'オレンジ', '10', '11', '12', '13', '14', '1', '2', '3', '4', '5', '6', '7', '8', '9');
    $replace = array('_', 'kuro', 'midori', 'aka', 'shiro', 'cha', 'kiiro', 'pinku', 'ao', 'mizu', 'hai', 'gin', 'orenji', '10', '11', '12', '13', '14', '1', '2', '3', '4', '5', '6', '7', '8', '9');
    return str_replace($search, $replace, $japanese);
}
echo _exec();
Example #7
0
}
function _onload() {
  setTimeout("_countdown()", 1000);
  var interval = parseInt(form.rftime.value);
  timer = interval;
}

if (window.addEventListener) {
  window.addEventListener("load", _onload, false);
} else if (document.attachEvent) {
  window.attachEvent("onload", _onload);
}
</script>
EOS;
## }}
// ps -eo pid,ppid,user,etime,time,%cpu,%mem,state,cmd
$cmd = "ps -eo pid,ppid,user,state,etime,time,%cpu,%mem,cmd  | grep java";
_exec($cmd, $output);
//print_r($output);
_process($output);
/*
  $str = join("\n", $output);
  print<<<EOS
<pre>
$str
</pre>
EOS;
*/
_health_graph();
pagetail();
exit;