Index of: /package/eFilesystem/

File Name  ↓ File Size  ↓ Date  ↓ 
--
280 B2014-Jan-25 19:07
320 B2014-Jan-25 19:07
3.7 KiB2009-Aug-07 02:43
4.3 KiB2010-Nov-15 13:55
6.0 KiB2012-Oct-14 05:07
6.6 KiB2013-Aug-01 02:44
6.7 KiB2014-Jan-25 17:15

eFilesystem pear package

eFilesystem 클리스는 여러가지 확장된 시스템 function을 제공합니다.

  1. rm -rf 지원(unlink_r)
  2. php pure code로 find command 지원
  3. tree command 지원
  4. php ini보다 확장된 형식의 ini 형식 지원
  5. shell prompt 기능 지원 (hidden 기능 지원)
Reference: Example:
<?php
require_once 'eFilesystem.php';
 
function answer ($v) {
    echo ( $v === true ) ? 'OK' : 'FALSE';
    echo "\n";
}
 
echo "##### SELF test #############################################\n";
 
try {
    echo '1. check file_nr ... ';
    $r = eFilesystem::file_nr ('eFilesystem.php');
    answer (is_array ($r) ? true : false);
    /*
    if ( is_array ($r) ) {
        ePrint::echoi ($r, 4);
        echo "\n";
    }
     */
    unset ($r);
 
    echo '2. check mkdir_p ... ';
    #echo ePrint::whiteSpace (4, true) . "indent 4\n";
    $r = eFilesystem::mkdir_p ('./aaa/bbb');
    answer ($r);
    if ( $r === true ) {
        chdir ('./aaa/bbb');
        touch ('11.txt');
        touch ('1.txt');
        touch ('2.txt');
        chdir ('../../');
 
        echo "   check tree ... \n";
        ob_start ();
        eFilesystem::tree ('./aaa');
        $capture = ob_get_contents ();
        ob_end_clean ();
        ePrint::echoi ($capture, 4);
    }
 
    echo '3. check unlink_r ... ';
    $r = eFilesystem::unlink_r ('./aaa');
    answer ($r);
 
    echo "4. check dirlist ...\n";
    $r = eFilesystem::dirlist ('./');
    $r = array_merge ($r, eFilesystem::dirlist ('./', eFilesystem::RELATIVE));
    $r = array_merge ($r, eFilesystem::dirlist ('./', eFilesystem::ABSOLUTE));
    ePrint::echoi ($r, 4);
    echo "\n";
 
    echo "5. check find ... \n";
    $r = eFilesystem::find ('./');
    ePrint::echoi ($r, 4);
    echo "\n\n";
 
    echo "##### OBJ  test #############################################\n";
 
    echo '1. check file_nr ... ';
    $fs = new eFilesystem;
 
    $r = $fs->file_nr ('eFilesystem.php');
    answer (is_array ($r) ? true : false);
    /*
    if ( is_array ($r) ) {
        $fs->echoi ($r, 4);
        echo "\n";
    }
     */
    unset ($r);
 
    echo '2. check mkdir_p ... ';
    #echo $fs->whiteSpace (4, true) . "indent 4\n";
    $r = $fs->mkdir_p ('./aaa/bbb');
    answer ($r);
    if ( $r === true ) {
        chdir ('./aaa/bbb');
        touch ('11.txt');
        touch ('1.txt');
        touch ('2.txt');
        chdir ('../../');
 
        echo "   check tree ... \n";
        ob_start ();
        $fs->tree ('./aaa');
        $capture = ob_get_contents ();
        ob_end_clean ();
        $fs->echoi ($capture, 4);
    }
 
    echo '3. check unlink_r ... ';
    $r = $fs->unlink_r ('./aaa');
    answer ($r);
 
    echo "4. check dirlist ...\n";
    $r = $fs->dirlist ('./');
    $r = array_merge ($r, $fs->dirlist ('./', eFilesystem::RELATIVE));
    $r = array_merge ($r, $fs->dirlist ('./', eFilesystem::ABSOLUTE));
    $fs->echoi ($r, 4);
    echo "\n";
 
    echo "5. check find ... \n";
    $r = $fs->find ('./');
    $fs->echoi ($r, 4);
	echo "\n";
} catch ( myException $e ) {
    fprintf (STDERR, "%s\n", $e->Message ());
    #print_r ($e);
    #print_r ($e->Trace ());
    #echo $e->TraceAsString () . "\n";
    print_r ($e->TraceAsArray ()) . "\n";
    $e->finalize ();
}
?>
Installation:

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

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