Index of: /package/eSystem/

File Name  ↓ File Size  ↓ Date  ↓ 
--
6.3 KiB2005-Jul-11 14:59
6.3 KiB2005-Sep-06 13:55
6.4 KiB2006-Sep-15 04:23
7.1 KiB2007-Feb-19 03:30
8.1 KiB2007-Mar-04 01:27
8.2 KiB2007-Mar-18 02:34
8.4 KiB2009-Jul-07 22:43
6.8 KiB2009-Aug-08 18:03
6.8 KiB2011-May-12 19:00
7.4 KiB2016-Jan-07 06:03
826 B2016-Jan-07 06:08

eSystem pear package

eSystem 클리스는 php에서 제공하는 system funcion보다 확장된 기능을 제공하며, 많은 system mapping function을 제공한다.

  1. backspace 지원
  2. Ansi color 출력 지원
  3. find/tree command 지원
  4. getopt 지원man command 지원
  5. 등등등
Reference: Example:
<?php
require_once ('eSystem.php');
 
$e = new eSystem;
 
/*
 *  GETOPT test
 */
 
echo "\n";
echo "-- Getopt Test -------------------------------------------\n\n";
 
# init getopt global variables
$longopt = array (
    'longa' => 'a',
    'longb' => 'b',
    'longc' => 'c',
    'longd' => 'd'
);
 
while ( ($opt = $e->getopt ($argc, $argv, "abc:d")) != -1 ) :
    switch ($opt) :
        case 'a' :
            $a++;
            break;
        case 'b' :
            $b++;
            break;
        case 'c' :
            $c = $optarg;
            break;
        case 'd' :
            $d++;
            break;
        default:
            echo "getopt failed. option is abc:d ($opt)\n";
            exit (1);
    endswitch;
endwhile;
 
echo "Option a => $a\n";
echo "Option b => $b\n";
echo "Option c => $c\n";
echo "Option a => $d\n";
echo "Optcno   => $optcno\n";
echo "Optcmd array:\n";
print_r ($optcmd);
 
echo "\n";
echo "-- _system test ------------------------------------------\n\n";
 
/*
 * _system test
 */
 
$v = $e->system ("ls -al", $r);
echo "Last Line: $v\n";
unset ($v);
 
/*
 * _exec test
 */
 
echo "\n";
echo "-- _exec test --------------------------------------------\n\n";
$v = $e->exec ("ls -al", $o, $err);
 
print_r ($o);
echo "Last Line : $v\n";
echo "ERROR CODE: $err\n";
 
/*
 * mkdirp_p test
 */
 
echo "\n";
echo "-- mkdir_p test ------------------------------------------\n\n";
 
$v = $e->mkdir_p ("./ppp/yyy");
echo "mkdir_p test: ";
if ( $v === true ) {
    if ( is_dir ("./ppp/yyy") ) echo "OK";
    else echo "Fail";
    $v = 'true';
} else {
    $v = ( $v === false ) ? 'false' : $v;
}
echo " ==> Return Code: $v\n";
 
/*
 * unlink test
 */
 
echo "\n";
echo "-- unlink test ------------------------------------------\n\n";
 
touch ("unlinktest");
$v = $e->unlink ("unlinktests");
$v = ( $v === true ) ? 'true' : ($v === false) ? 'false' : $v;
echo "Unlink unlinktests: $v\n";
$v = $e->unlink ("unlinktest");
$v = ( $v === true ) ? 'true' : ($v === false) ? 'false' : $v;
echo "Unlink unlinktest: $v\n";
$v = $e->unlink ("ppp/yyy");
$v = ( $v === true ) ? 'true' : ($v === false) ? 'false' : $v;
echo "Unlink ppp/yyy: $v\n";
 
/*
 * unlink_r test
 */
 
echo "\n";
echo "-- unlink_R test ------------------------------------------\n\n";
 
$v = $e->unlink_r ("ppp");
$v = ( $v === true ) ? 'true' : 'false';
echo "Remove ppp: $v\n";
 
/*
 * tree test
 */
 
echo "\n";
echo "-- tree test ----------------------------------------------\n\n";
 
$v = $e->tree (".");
print_r ($v);
 
/*
 * find test
 */
 
echo "\n";
echo "-- find test ----------------------------------------------\n\n";
 
$v = $e->find ("."); #, '', false);
print_r ($v);
 
 
/*
 * color test
 */
 
echo "\n";
echo "-- color test ---------------------------------------------\n\n";
 
echo $e->putColor ('Color test red', 'red') . "\n";
 
/*
 * backspace test
 */
 
echo "\n";
echo "-- backspace test ---------------------------------------------\n\n";
 
echo "print abcdefghijklmn and backspace 3 times\n";
echo "abcdefghijklmn\n";
echo "abcdefghijklmn";
$e->backSpace (3);
echo "\n";
 
/*
 * man test
 */
 
echo "\n";
echo "-- man test ---------------------------------------------------\n\n";
 
echo "bash man path:\n";
print_r ($e->manPath ('bash'));
 
echo "view bash man page\n";
echo $e->man ('free', 1);
 
?>
Installation:

이 패키지는 다른 패키지에 의존성이 있습니다. 그러므로 아래의 pear 명령을 이용하여 설치하는 것을 권장 합니다.

shell> pear channel-discover pear.oops.org
shell> pear install oops/eSystem
shell> pear list -a